Question about the <Esc> in terminal
Closed this issue ยท 6 comments
Let me know if you prefer questions elsewhere :)
Why is <Esc>
only set when the terminal is open through an autocommand as in here? Since it's anyway a buffer keymap couldn't it be set as normal?
Are you suggesting vim.api.nvim_set_keymap('n', '<Esc>', '<c-\\><c-n>', { noremap = true})
? Did you try it? I believe terminal mode unmaps any key bound to escape :)
Yes, except to use t
-mode :) ie
vim.api.nvim_set_keymap('t', '<Esc>', [[<c-\><c-n>]], {noremap = true})
I have this in my config and works fine, additionally I have:
vim.api.nvim_set_keymap('t', '<A-[>', '<Esc>', {noremap = true})
to be able to send escape to the terminal itself.
The autcommand can probably be swapped out then :) I think I've had that snippet in my config since :term
first shipped.
Cool :)
You also removed the set nonu
but maybe that was intentional?
I removed it intentionally, this could be added to tips, but I'm trying to simplify this configuration as much as possible.