Vim: Shortcuts specific to a file extension? -


this question has answer here:

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

Popular posts from this blog

mysql - java.sql.SQLException Parameter index out of range (1 > number of parameters, which is 0) -

c - ALSA programming: how to stop immediately -