I want my Enter key to follow links in help files because my keyboard doesn't have a ] key. Therefore I've put:
nnoremap <Enter> <C-]>
In ftplugin/help.vim
. This works, but this key map is now "global" and messes up the use of the key in other places, for example the q:
command window.
So how do I restrict a key-bind to a single buffer, or perhaps even a single file type?
map the command using autocmd:
autocmd FileType c,cpp,php nnoremap <buffer> <Enter> <C-]>
maps only for filetypes: c,cpp and php
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With