I have the following mapping in tnoremap <Esc> <C-\><C-n> init.conf to exit insert mode while in the terminal. In certain terminal buffers I would like to not have that global mapping applied.

The command :tunmap <buffer> <Esc> doesn't effect globally set mappings.

The command :tunmap <buffer> will remove the mapping for all buffers.

Is there a way to not apply global config to a certain buffer only?

  • 2
    Would that work? tnoremap <buffer> <ESC> <ESC>?
    – Ralf
    Jan 5, 2019 at 22:14
  • @Ralf Yes! Just phrase it please as an answer and I will accept it. Jan 5, 2019 at 22:58

1 Answer 1


You could overwrite the mapping by a buffer-local mapping. Just map <ESC> to <ESC>:

tnoremap <buffer> <ESC> <ESC>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.