For example, I'd like to map a key when in a tex
-like file, which includes many different flavor of tex
files. Do I have to use multiple commands like this?
au FileType tex nm <C-H> <Plug>IMAP_JumpForward
au FileType latex nm <C-H> <Plug>IMAP_JumpForward
au FileType context nm <C-H> <Plug>IMAP_JumpForward
au FileType plaintex nm <C-H> <Plug>IMAP_JumpForward
...
Absolutely:
au FileType tex,latex,context,plaintex nm <C-H> <Plug>IMAP_JumpForward
Some thoughts:
~/.vim/after/ftplugin/tex.vim
instead of an :autocmd
as they are easier to manageCleaned up version:
augroup tex_mappings
autocmd!
autocmd FileType tex,latex,context,plaintex nmap <buffer> <c-h> <Plug>IMAP_JumpForward
augroup END
Alternatively add the following to ~/.vim/after/ftplugin/txt.vim
:
nmap <buffer> <c-h> <Plug>IMAP_JumpForward
Note: with the ftplugin approach you will need to add this line for each FileType
(or use :source
)
For more help see:
:h :au
:h :aug
:h :map-local
:h after-directory
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