chore(neovim): move from iron.nvim to toggleterm (#8)

I use the terminal to access `repl` available in a `docker container`, or a remote one available in `kubernetes` or virtual machine.

Reviewed-on: #8
This commit is contained in:
João Paulo Dubas 2023-10-29 20:46:14 +00:00
parent e9d47a7fcd
commit 093c3dc49f

View File

@ -69,27 +69,46 @@ return {
} }
end end
}, },
'nvim-treesitter/nvim-treesitter-context',
{ {
'Vigemus/iron.nvim', 'akinsho/toggleterm.nvim',
config = function () opts = {
local iron = require('iron.core') size = vim.o.lines * 0.3,
iron.setup({ open_mapping = [[<c-\>]],
config = { hide_numbers = true,
scratch_repl = true, shade_filetypes = { },
repl_definition = { shade_terminals = true,
sh = { shading_factor = 2,
command = { 'fish' } direction = 'horizontal',
}, shell = vim.o.shell,
elixir = require('iron.fts.elixir').iex, },
javascript = require('iron.fts.javascript').node, keys = function ()
python = require('iron.fts.python').ipython, local status_ok, which_key = pcall(require, 'which_key')
typescript = require('iron.fts.typescript').ts if status_ok then
} which_key.register({
}, ['<leader>o'] = { name = 'To[g]gle terminal', _ = 'which_key_ignore' }
highlight = { italic = true }, })
ignore_blank_lines = true end
vim.api.nvim_create_autocmd('TermOpen', {
group = vim.api.nvim_create_augroup('kickstart-custom-term-open-mapping', { clear = true }),
callback = function (args)
local bufnr = args.buf
local opts = { buffer = bufnr }
vim.keymap.set('t', '<esc>', [[<C-\><C-n>]], opts)
vim.keymap.set('t', 'jk', [[<C-\><C-n>]], opts)
vim.keymap.set('t', '<C-h>', [[<Cmd>wincmd h<CR>]], opts)
vim.keymap.set('t', '<C-j>', [[<Cmd>wincmd j<CR>]], opts)
vim.keymap.set('t', '<C-k>', [[<Cmd>wincmd k<CR>]], opts)
vim.keymap.set('t', '<C-l>', [[<Cmd>wincmd l<CR>]], opts)
vim.keymap.set('t', '<C-w>', [[<C-\><C-n><C-w>]], opts)
end
}) })
return {
{ '<leader>oh', '<cmd>ToggleTerm direction=horizontal size=' .. tostring(vim.o.lines * 0.3) .. '<cr>', desc = 'Open terminal horizontally' },
{ '<leader>oc', '<cmd>ToggleTermSendCurrentLine<cr>', desc = 'Send current line under the cursor' },
{ '<leader>ov', '<cmd>ToggleTermSendVisualLines<cr>', desc = 'Send all lines visually selected' },
{ '<leader>os', '<cmd>ToggleTermSendVisualSelection<cr>', desc = 'Send visually selected text' }
}
end end
}, }
'nvim-treesitter/nvim-treesitter-context'
} }