fixed esc for terminals

This commit is contained in:
Oliver Hartmann 2022-11-17 14:15:49 +01:00
parent 861b60e4f7
commit 4b3bc84837

View File

@ -12,8 +12,12 @@ function _G.set_terminal_keymaps()
vim.api.nvim_buf_set_keymap(0, 't', '<C-l>', [[<C-\><C-n><C-W>l]], opts) vim.api.nvim_buf_set_keymap(0, 't', '<C-l>', [[<C-\><C-n><C-W>l]], opts)
end end
-- Disbled for the moment because it is also set for lazygit vim.api.nvim_create_autocmd({ "TermOpen" }, {
-- vim.cmd('autocmd! TermOpen term://* lua set_terminal_keymaps()') pattern = { 'term://*' },
callback = function()
set_terminal_keymaps()
end
})
local lazygit = Terminal:new({ local lazygit = Terminal:new({
cmd = 'lazygit', cmd = 'lazygit',
@ -22,6 +26,7 @@ local lazygit = Terminal:new({
direction = 'float', direction = 'float',
on_open = function(term) on_open = function(term)
vim.api.nvim_buf_set_keymap(term.bufnr, "n", "q", "<cmd>close<CR>", {noremap = true, silent = true}) vim.api.nvim_buf_set_keymap(term.bufnr, "n", "q", "<cmd>close<CR>", {noremap = true, silent = true})
vim.api.nvim_buf_set_keymap(term.bufnr, 't', '<esc>', '<esc>', {noremap = true, silent = true})
end, end,
}) })