How do I unmap only when a mapping exists in Vim -


as follow-on accepted answer in how override gf vim-rails, editing same file multiple times results in following error:

error detected while processing user auto commands "rails.javascript.coffee*": e31 : no such mapping 

the offending line in vimrc is

:autocmd user rails.javascript.coffee* nunmap <buffer> gf 

how can avoid error unmapping if mapping exists?

(note: editing same file multiple times may seem strange thing do, believe happens side effect of searching ack.vim or ag.vim)

you check mapping if ! empty(maparg('gf', 'n')) ..., usual solution suppress error prepending silent! before nunmap <buffer> gf command.


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -