I'd like to add this tnoremap <esc> <c-\><c-n> to my .vimrc but the problem is that it breaks the ESC with fzf. So is there is any way I can check if the terminal buffer is related to fzf or not and then decide to apply this key binding to it or not?
tnoremap <expr> <esc> &filetype == 'fzf' ? "\<esc>" : "\<c-\>\<c-n>"
FYI, you can use CTRL-C instead of ESC to close fzf.
@junegunn Thanks!
I know about CTRL+C but it's just that my brain is programmed to use ESC for exit while CTRL+C is for killing processes :)
For the record, I just came with this solution:
tnoremap <Esc> <C-\><C-n>
au TermOpen term://*fzf* tnoremap <buffer> <Esc> <Esc>
Note that tunmap does not work. I also have to use the double wildcard in *fzf*.
In any case, junegunn's solution is better tmo.
Most helpful comment
FYI, you can use CTRL-C instead of ESC to close fzf.