How to test if an escape sequence is currently mapped
Thanks to everyone who offered very helpful suggestion regarding my previous question on the best way to conditionally map function keys using autocmd BufReadPre, when editing particular files.
I wanted to unmap the keys upon exiting the file and have done that also using aucocmd BufLeave. However, I found that an attempt to unmap a key sequence that isn't currently mapped results in an error. If there a way to perform a test to see if a particular key or escape sequence is mapped, and only then unmap it? Something like:
:if ismapped <Esc>[1;3S
: nunmap <Esc>[1;3S
: iunmap <Esc>[1;3S
If I can do this, then I can write a single universal function that handles all conditions.
And if there is some sort of test, is it generic to all mappings or particular to the mode such as imap, nmap, etc?
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php