Vim: Shortcuts specific to a file extension? -
this question has answer here:
- gvim , multiple programming languages 4 answers
in vim, possible attach syntax highlighter file extension.
is possible same keyboard shortcuts?
i.e. shortcuts switch on if file particular extension being edited.
the association not directly file extensions, filetypes (which can detected based on file extensions, other file patterns or contents). :setl filetype?
shows current buffer's.
to define filetype-specific mapping, append <buffer>
attribute after :map
command. (same custom commands, use -buffer
after :command
.)
you can define filetypes prepending :autocmd filetype {filetype} ...
, , put ~/.vimrc
. gets unwieldy add mappings , other settings various filetypes. better put commands ~/.vim/ftplugin/{filetype}_mappings.vim
. (this requires have :filetype plugin on
.)
Comments
Post a Comment