Many people really want to do tnoremap <Esc> <C-\><C-n>
. However, there is a few command line utilties they rely on also use <Esc>
. This is a plugin that let you map <Esc>
to <C-\><C-n>
except when these command line utilties are running in the termial.
It is built based on justinmk's reply.
Plug 'sychen52/smart-term-esc.nvim'
require('smart-term-esc').setup{
key='<Esc>',
except={'nvim', 'fzf'}
}
key
is what you want to map to <C-\><C-n>
.
except
is a list of processes. Once any of them is running in the terminal, the key will not be mapped.
By default, key='<Esc>', except={'nvim'}
.