fix esc in lazygit

This commit is contained in:
Mitchell Hingley committed 2026-10-20 16:28:46 -04:00
1 parent 4ae09d7685
commit e8cd889db4
1 file changed
+13
+13
View File
@@ -8,6 +8,19 @@ vim.keymap.set("n", "<Leader>h", "<cmd>:noh<CR>", {desc = "Remove current highli
-- Exit terminal mode easily with Escape
vim.keymap.set('t', '<Esc>', [[<C-\><C-n>]], { desc = 'Exit terminal mode' })
-- In lazygit, keep every key inside the terminal so only Ctrl+C (handled by
-- lazygit itself) can close it -- no nvim key drops you into normal mode.
vim.api.nvim_create_autocmd("TermOpen", {
callback = function()
if vim.fn.expand("%"):match("lazygit") then
-- let <Esc> pass through to lazygit instead of exiting terminal mode
vim.keymap.set('t', '<Esc>', '<Esc>', { buffer = true })
-- disable the built-in exit-terminal-mode chord
vim.keymap.set('t', [[<C-\><C-n>]], '<nop>', { buffer = true })
end
end,
})
vim.keymap.set("v", "<Leader>y", '"+y', {desc='Yank to "+ register for external copy/paste'})
--CODE/LSP