1

Let's say I have the following line in my .vimrc:

noremap ge w

Sometimes I want to unmap it locally to the current buffer, so I run: :unmap <buffer> ge. When I do this, I get an error message that the mapping doesn't exist. I understand that the mapping doesn't exist specifically for the current buffer only but it exist in all the buffers I will ever open in this session, I can see the mapping is active when I run :verb map ge but not when I run :verb map <buffer> ge.

It seems like running unmap <buffer> can only undo commands containing map <buffer>. I don't want to noremap ge <nop> because that will delete the original key-sequence's command. Is it possible to unmap a mapping from .vimrc only in the current <buffer>?

1

You can use:

:nnoremap <buffer> ge ge

To map the command back to original for this buffer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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