local g={"\097\107\105\110\115\104\111\047\110\118\105\109-\116\111\103\103\108\101\116\101\114\109\046\108\117\097",enabled=false,config=function()local g=vim.api.nvim_set_keymap local z=vim.api.nvim_buf_set_keymap;(require("\116\111\103\103\108\101\116\101\114\109")).setup({size=function(g)if g.direction=="\104\111\114\105\122\111\110\116\097\108"then return 15 elseif g.direction=="\118\101\114\116\105\099\097\108"then return vim.o.columns*.4 end end;open_mapping="\060\067-\110\062";hide_numbers=true;shade_filetypes={},shade_terminals=true;shading_factor="\049";start_in_insert=true;insert_mappings=true,persist_size=true;persist_mode=false,direction="\118\101\114\116\105\099\097\108",close_on_exit=true;shell=vim.o.shell;float_opts={border="\115\105\110\103\108\101";winblend=3;highlights={border="\078\111\114\109\097\108";background="\078\111\114\109\097\108"}}})g("\116","\060\069\083\067\062","\060\067-\092\062\060\067-\110\062",{noremap=true,silent=true})local P=function()local g={noremap=true}z(0,"\116","\060\101\115\099\062","\060\067-\092\062\060\067-\110\062",g)z(0,"\116","\060\067-\104\062","\060\067-\092\062\060\067-\110\062\060\067-\087\062\104",g)z(0,"\116","\060\067-\106\062","\060\067-\092\062\060\067-\110\062\060\067-\087\062\106",g)z(0,"\116","\060\067-\107\062","\060\067-\092\062\060\067-\110\062\060\067-\087\062\107",g)z(0,"\116","\060\067-\108\062","\060\067-\092\062\060\067-\110\062\060\067-\087\062\108",g)end vim.api.nvim_create_autocmd("\084\101\114\109\079\112\101\110",{pattern="\116\101\114\109\058\047\047\042",callback=function()P()end;desc="\077\097\112\112\105\110\103\115 \102\111\114 \110\097\118\105\103\097\116\105\111\110 \119\105\116\104 \097 \116\101\114\109\105\110\097\108"})end}return g
local M = {
  'akinsho/nvim-toggleterm.lua',
  -- Temporary disabled, neovim is freezing and I am trying to
  -- figure out whether or not this plugin was the root cause.
  enabled = false,
  config = function()
    local map = vim.api.nvim_set_keymap
    local buf_map = vim.api.nvim_buf_set_keymap

    require('toggleterm').setup {
      -- size can be a number or function which is passed the current terminal
      size = function(term)
        if term.direction == 'horizontal' then
          return 15
        elseif term.direction == 'vertical' then
          return vim.o.columns * 0.4
        end
      end,
      open_mapping = '<C-n>',
      hide_numbers = true, -- hide the number column in toggleterm buffers
      shade_filetypes = {},
      shade_terminals = true,
      shading_factor = '1', -- the degree by which to darken to terminal colour, default: 1 for dark backgrounds, 3 for light
      start_in_insert = true,
      insert_mappings = true, -- whether or not the open mapping applies in insert mode
      persist_size = true,
      persist_mode = false,
      direction = 'vertical', -- 'vertical' | 'horizontal' | 'window' | 'float',
      close_on_exit = true, -- close the terminal window when the process exits
      shell = vim.o.shell, -- change the default shell
      -- This field is only relevant if direction is set to 'float'
      float_opts = {
        -- The border key is *almost* the same as 'nvim_win_open'
        -- see :h nvim_win_open for details on borders however
        -- the 'curved' border is a custom border type
        -- not natively supported but implemented in this plugin.
        border = 'single', -- 'single' | 'double' | 'shadow' | 'curved' | ... other options supported by win open
        -- width = <value>,
        -- height = <value>,
        winblend = 3,
        highlights = {
          border = 'Normal',
          background = 'Normal',
        },
      },
    }
    map('t', '<ESC>', '<C-\\><C-n>', { noremap = true, silent = true }) -- back to normal mode in Terminal

    -- Better navigation to and from terminal
    local set_terminal_keymaps = function()
      local opts = { noremap = true }
      buf_map(0, 't', '<esc>', [[<C-\><C-n>]], opts)
      buf_map(0, 't', '<C-h>', [[<C-\><C-n><C-W>h]], opts)
      buf_map(0, 't', '<C-j>', [[<C-\><C-n><C-W>j]], opts)
      buf_map(0, 't', '<C-k>', [[<C-\><C-n><C-W>k]], opts)
      buf_map(0, 't', '<C-l>', [[<C-\><C-n><C-W>l]], opts)
    end
    -- if you only want these mappings for toggle term use term://*toggleterm#* instead
    vim.api.nvim_create_autocmd('TermOpen', {
      pattern = 'term://*',
      callback = function()
        set_terminal_keymaps()
      end,
      desc = 'Mappings for navigation with a terminal',
    })
  end,
}

return M
