local H={number=false;signcolumn="\110\111",colorcolumn=""}local A={"\102\111\108\107\101\047\116\119\105\108\105\103\104\116\046\110\118\105\109",dependencies={"\110\118\105\109-\116\114\101\101\115\105\116\116\101\114\047\110\118\105\109-\116\114\101\101\115\105\116\116\101\114"};cmd={"\084\119\105\108\105\103\104\116","\084\119\105\108\105\103\104\116\069\110\097\098\108\101";"\084\119\105\108\105\103\104\116\068\105\115\097\098\108\101"},opts={context=15,treesitter=true}}local K={"\102\111\108\107\101\047\122\101\110-\109\111\100\101\046\110\118\105\109",dependencies={"\102\111\108\107\101\047\116\119\105\108\105\103\104\116\046\110\118\105\109"};cmd={"\090\101\110\077\111\100\101"};keys={{"\060\108\101\097\100\101\114\062\122";function()(require("\122\101\110-\109\111\100\101")).toggle()end,desc="\084\111\103\103\108\101 \090\101\110 \109\111\100\101"}},opts=function()return{window={width=.6},plugins={twilight={enabled=true},kitty={enabled=os.getenv("\075\073\084\084\089\095\076\073\083\084\069\078\095\079\078")~=nil;font="\043\052"},tmux={enabled=os.getenv("\084\077\085\088")~=nil};gitsigns={enabled=false}};on_open=function()local A={}vim.w.__old_zen=A for H,K in pairs(H)do A[H]=vim.wo[H]vim.wo[H]=K end end,on_close=function()for H,A in pairs(vim.w.__old_zen or{})do vim.wo[H]=A end end}end}return{A;K}
-- zen modes
-- https://github.com/pocco81/true-zen.nvim

local ZEN_SETTINGS = {
  number = false,
  signcolumn = "no",
  colorcolumn = "",
}

local twilight_config = {
  "folke/twilight.nvim",
  dependencies = {
    "nvim-treesitter/nvim-treesitter",
  },
  cmd = {
    "Twilight",
    "TwilightEnable",
    "TwilightDisable",
  },

  opts = {
    context = 15,
    treesitter = true,
  },
}

local zen_mode_config = {
  "folke/zen-mode.nvim",
  dependencies = {
    "folke/twilight.nvim",
  },
  cmd = {
    "ZenMode",
  },
  keys = {
    {
      "<leader>z",
      function()
        require("zen-mode").toggle()
      end,
      desc = "Toggle Zen mode",
    },
  },

  opts = function()
    return {
      window = {
        width = 0.6,
      },
      plugins = {
        twilight = {
          enabled = true,
        },
        kitty = {
          enabled = os.getenv("KITTY_LISTEN_ON") ~= nil,
          font = "+4",
        },
        tmux = {
          enabled = os.getenv("TMUX") ~= nil,
        },
        gitsigns = {
          enabled = false,
        },
      },

      on_open = function()
        local old_zen = {}
        vim.w.__old_zen = old_zen

        for key, value in pairs(ZEN_SETTINGS) do
          old_zen[key] = vim.wo[key]
          vim.wo[key] = value
        end
      end,

      on_close = function()
        for key, value in pairs(vim.w.__old_zen or {}) do
          vim.wo[key] = value
        end
      end,
    }
  end,
}

return {
  twilight_config,
  zen_mode_config,
}
