"syntax on" should be ok. Please use :version to confirm your vim was compiled with "+syntax" function and keep the corresponding syntax file in vim runtime folder.
Also to check if there has any "syntax off" in /etc/vim/vimrc.local. wangxu wrote: > Why don't I have the syntax highlighting when editing files like *.sh > *.xml,etc? > After commands like "syntax on",still nothing happened. > below is my /etc/vim/vimrc,what else should I do to turn the syntax > highlighting on? > Thanks, > shell. > > > set > runtimepath=~/.vim,/etc/vim,/usr/share/vim/vimfiles,/usr/share/vim/addons,/usr/share/vim/vim63,/usr/share/vim/vimfiles,/usr/share/vim/addons/after,~/.vim/after > > set nocompatible " Use Vim defaults instead of 100% vi compatibility > set backspace=indent,eol,start " more powerful backspacing > > set autoindent " always set autoindenting on > set textwidth=0 " Don't wrap lines by default > set viminfo='20,\"50 " read/write a .viminfo file, don't store more than > " 50 lines of registers > set history=50 " keep 50 lines of command line history > set ruler " show the cursor position all the time > > set > suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc > > if &term =~ "xterm-debian" || &term =~ "xterm-xfree86" || &term =~ "xterm" > set t_Co=16 > set t_Sf=[3%dm > set t_Sb=[4%dm > endif > > vnoremap p <Esc>:let current_reg = @"<CR>gvdi<C-R>=current_reg<CR><Esc> > > > syntax on > > > if has("autocmd") > " Enabled file type detection > " Use the default filetype settings. If you also want to load indent files > " to automatically do language-dependent indenting add 'indent' as well. > filetype plugin on > > endif " has ("autocmd") > > augroup filetype > au BufRead reportbug.* set ft=mail > au BufRead reportbug-* set ft=mail > augroup END > > try > if filereadable('/etc/papersize') > let s:papersize = matchstr(system('/bin/cat /etc/papersize'), '\p*') > if strlen(s:papersize) > let &printoptions = "paper:" . s:papersize > endif > unlet! s:papersize > endif > catch /E145/ > endtry > > > if filereadable("/etc/vim/vimrc.local") > source /etc/vim/vimrc.local > endif > > > > if &t_Co > 2 || has("gui_running") > syntax on > set hlsearch > endif > > > >