Cannot escape terminal mode on neovim
September 25, 2021 — (Last edited on October 24, 2021)
Press <Ctrl-\><Ctrl-n>
As this is a pretty awkward keymapping, i’d strongly recommend using mapping it
to something else simpler like <Esc>
on your config, as shown in the example
below:
tnoremap <Esc> <C-\\><C-n>
Otherwise, if you’re using lua, this one might suit better your needs:
vim.api.nvim_set_keymap('t', '<Esc>', [[<C-\\><C-n>]], { noremap = true })
Using
[[...]]
as string delimiter removes the need to have it’s special characters manually escaped, in contrast to when using quotes, for example:"<C-\\><C-n>"