I have some character maps for typing braces that I’d like to behave differently based on the file’s extension – I imagine that would be pretty useful ability to have in general.
Any ideas on how to make this happen from my .vimrc or a plugin?
Thank you!
There are basically two ways. Use the filetype plugin, or use filetype or extension autocommands.
The autocommands (placed in your .vimrc/_vimrc) take the form of either
or
(Obviously
set textwidth=100can be replaced with any other command)The better solution, particularly if you have alot of custom commands for a filetype, is to use the files
~/.vim/after/ftplugin/<filetype>.vimfor each filetype. Commands in those files will be executed after loading a file of the given type.