This section below is obtained from gvim session by typing 'help syntax' -
bash$ gvim some_test :help syntax
If a file type that you want to use is not detected yet, there are two ways to add it. It's better not modify the $VIMRUNTIME/filetype.vim file. It will be overwritten when installing a new version of Vim. Create a file in $HOME/vim/myfiletypes.vim and put these line in it -
" Filename : $HOME/vim/myfiletypes.vim " myfiletypefile augroup filetype au! BufRead,BufNewFile *.mine set filetype=mine au! BufRead,BufNewFile *.xyz set filetype=drawing au! BufRead,BufNewFile *.prc set filetype=plsql augroup END
Then add a line in your $HOME/.vimrc and $HOME/.gvimrc file to set the "myfiletypefile" variable to the name of this file. (CAUTION: You MUST put this in both vimrc and gvimrc files in order for this to work) Example:
let myfiletypefile = "~/vim/myfiletypes.vim"
NOTE: Make sure that you set "myfiletypefile" before switching on file type detection. This is must be before any ":filetype on" or ":syntax on" command.
Your file will then be sourced after the default FileType autocommands have been installed. This allows you to overrule any of the defaults, by using ":au!" to remove any existing FileType autocommands for the same pattern. Only the autocommand to source the scripts.vim file is given later. This makes sure that your autocommands in "myfiletypefile" are used before checking the contents of the file.
Instead of using "Syntax" menu you can also manually source in the syntax file. Edit the file with gvim and at : (colon) command give 'so' command. For example -
gvim foo.pc :so $VIM/syntax/esqlc.vim
Each syntax file supports one or more default file name extensions, for example, JavaScript syntax file supports the *.js extension. If you happen to use an extension that conflicts with another default syntax file (such as adding JavaScript to a *.html file) than you can source in the additional syntax file with the command :so $VIM/syntax/javascript.vim. To avoid all of this typing, you can create a soft link like -
ln -s $VIM/syntax/javascript.vim js gvim foo.html (... this file contains javascript functions and HTML) :so js