custom vim syntax highlighting scripts-- why do they work in Windows but not Linux?
I have written a vim script for highlighting the syntax of a proprietary query language. It works fine on my Windows 7 machine running gvim 7.3, but it refuses to work on Linux (my test box is CentOS 6). I have gotten the built-in language highlight scripts to work in CentOS, but for some reason any custom syntax scripts I add to the /usr/share/vim/vim72/syntax directory are not recognized even when I explicitly run
:set filetype=on
:set syntax=on
:set ft=cy
with cy.vim being the name of my syntax script. I checked out the ftplugin scripts to see if there was anything special pointing a filetype to a syntax script, but I couldn't see anything... I have another cy.vim file there anyway which reads
augroup cy,Q,q
au BufNewFile,BufRead *.cy,*.Q,*.q set filetype=cy
augroup end
normally I just keep the above in my _vimrc file, but as I can't even get the highlighting to work with explicit commands I doubt automatic filetype recognition on load would work.
Can anyone shed some light on why my syntax scri开发者_如何学编程pt works perfectly on Windows but not at all on Linux? I have tried all the usual avenues already, such as making sure I have vim-common/vim-full/vim-enhanced installed rather than vim-minimal/vim-tiny. Any help would be appreciated!thanks, CCJ
On Linux box vim will use ~/.vimrc and ~/.vim/.
Try the following command to see vim file type:
:echo &ft
Try the following to command see if your file is loaded:
:scriptnames
I believe the issue may have been with my xterm settings; on Solaris I ran into the same problem until I explicitly set the xterm window to support text colors and updated ncurses, per the wiki here: http://vim.wikia.com/wiki/Getting_colors_to_work_on_solaris I haven't been able to revisit on CentOS Linux yet, but this solved the problem for Solaris
Can you load the syntax file via the full path?
:so /path/to/file.vim
What are the permissions on the syntax file?
ls -l /path/to/file.vim
精彩评论