I look through my virtual files to clean them. I noticed that over time I added various specific file type parameters in various inconsistent ways. Suppose I configure Python:
au BufRead,BufNewFile *.py (do something) . I don't like this because some Python files may not have .py completion.
au FileType python (do something) . This seems like the best option since it is independent of the file with the .py ending. The disadvantage is that Vim is not aware of some file types. I can get Vim to recognize additional file types, but I also have various inconsistent ways to do this: a .vim/filetype.vim , another in .vim/after/filetype.vim and various set filetype in .vimrc .
Add a .vim/ftplugin/python.vim with specific file type settings. I understand that $VIMRUNTIME/ftplugin/python.vim can override all the settings I make here. One problem is that I'm not sure how this interacts with .vim/filetype.vim and .vim/after/filetype.vim .
Add .vim/after/ftplugin/python.vim . I understand that this loads after $VIMRUNTIME/ftplugin/python.vim so that it can overwrite the settings. As in the previous method, I'm not sure how it interacts with filetype.vim files.
So, I have at least four ways to do this, not to mention syntax files and file-specific plugins. It seems to me that the best way to do this is to set the specific parameters of the file in after/ftplugin so that they are not overwritten, and filetypes.vim in after for the same reason.
However, before continuing, I would like to ask if anyone has any suggestions on the best way to work with specific file type settings.
vim file-type ftplugin
dimatura May 22 '10 at 21:05 2010-05-22 21:05
source share