Show pageOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== syntax ====== First check the vim installation files, under the 'syntax' directory to see if you can find a sensible match for the type of file you have. ===== manually specifying the syntax ===== If vim has failed to auto-detect your filetype, you may specify the syntax with **:set syntax=javascript**. Filetype detection is enabled with **:filetype on**, and filetype plugin usage is enabled with **:filetype plugin on**. ===== changing an existing syntax ===== If you find a syntax to use, but you wish to tweak something about it, you can create a syntax file to run 'after' vim has loaded the default file. Simply create a file in $VIMRUNTIME/after/syntax/ with the same name as the syntax file you are starting with. For example, to add folding to the Progress syntax, create $VIMRUNTIME/after/syntax/progress.vim. This is an easy way to add customized folding to an existing language that didn't have it set up by default. ===== new file type syntax ===== If you can't find a matching syntax file, you can create a new one. See **:help syntax** to understand how this is done. Create your syntax file at $VIMRUNTIME/syntax/newtype.vim. Load your file into vim, then load your syntax like this:<code> :set syntax=newtype </code> You may also have vim automatically detect your new filetype, and set up the syntax for you. See **:help new-filetype** in vim for more information. It basically involves creating a file 'newtype.vim' in /ftdetect/ with this line:<code> au BufRead,BufNewFile *.newtype set filetype=newtype </code> ===== See Also ===== * [[vim_files_location]] * [[folding]] * [[plugins]] docs/vim/syntax.txt Last modified: 2008/09/14 01:23by billh