On 2012-01-13, Taylor Hedberg wrote:
> carugnom, Fri 2012-01-13 @ 10:45:55-0800:
> > Does somebody have a vim configuration example, where separated
> > configuration files by each language (c, python, etc) can be used. So
> > when i open a .c source, configuration for c files is applied, when i
> > open a .py source, configuration for python files is applied, and so
> > on
>
> This is called an "ftplugin" (file type plugin). Just write a script,
> and name it <filetype>.vim, where <filetype> is the name of the file
> type you want it to apply to ("c" for C source files, "python" for
> Python, etc.). Then put it in your ~/.vim/ftplugin directory and it
> should take effect the next time you load a buffer with that filetype.
>
> If you want more than one script to execute for a given filetype, there
> is an alternate method: Rather than naming the script <filetype>.vim and
> putting it in ~/.vim/ftplugin, you can instead create a directory called
> ~/.vim/ftplugin/<filetype> and place any number of scripts in that
> directory. They will all be sourced when loading a buffer of that type.
There is also an after/ftplugin directory where you can put scripts
to make settings after the standard filetype settings are made, in
case you want to override any settings made by the standard plugin.
The scripts are sourced in this order:
1. ~/.vim/ftplugin/<filetype>.vim
2. $VIMRUNTIME/ftplugin/<filetype>.vim
3. ~/.vim/after/ftplugin/<filetype>.vim
Regards,
Gary
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php