2010-09-23 78 views
1

在我.vimrc,我有以下片段:VIM無法打開syntax.vim

if has('autocmd') 
    filetype plugin indent on 
    syntax on 

但是當我開始VIM它顯示了以下錯誤:

Can't open file /usr/share/vim/syntax/syntax.vim 

錯誤似乎已發生在syntax on.vimrc

我沒有在路徑/usr/share/vim/syntaxsyntax.vim雖然我也有其它像clojure.vim cpp.vim java.vim etc...

我搜索,但似乎無法找到默認syntax.vim如果附帶vim的默認版本。

我一直堅持這一段時間,並希望得到一些幫助。

回答

0

它應該在那裏,所以可能有其他文件丟失。我建議你重新安裝!

對於這裏QDF是 syntax.vim文件看起來應該是這樣的: -

" Vim syntax support file 
" Maintainer: Bram Moolenaar <Bram[email protected]> 
" Last Change: 2001 Sep 04 

" This file is used for ":syntax on". 
" It installs the autocommands and starts highlighting for all buffers. 

if !has("syntax") 
    finish 
endif 

" If Syntax highlighting appears to be on already, turn it off first, so that 
" any leftovers are cleared. 
if exists("syntax_on") || exists("syntax_manual") 
    so <sfile>:p:h/nosyntax.vim 
endif 

" Load the Syntax autocommands and set the default methods for highlighting. 
runtime syntax/synload.vim 

" Load the FileType autocommands if not done yet. 
if exists("did_load_filetypes") 
    let s:did_ft = 1 
else 
    filetype on 
    let s:did_ft = 0 
endif 

" Set up the connection between FileType and Syntax autocommands. 
" This makes the syntax automatically set when the file type is detected. 
augroup syntaxset 
    au! FileType * exe "set syntax=" . expand("<amatch>") 
augroup END 


" Execute the syntax autocommands for the each buffer. 
" If the filetype wasn't detected yet, do that now. 
" Always do the syntaxset autocommands, for buffers where the 'filetype' 
" already was set manually (e.g., help buffers). 
doautoall syntaxset FileType 
if !s:did_ft 
    doautoall filetypedetect BufRead 
endif 
0

我升級到7.3(我用的cygwin)後出現這個問題爲好。檢查運行「vi」而不是「vim」是否有同樣的問題。我發現vim實際上是舊的7.2可執行文件,但語法文件位於7.3預期的位置; vi是正確的7.3可執行文件。