在我的.vimrc中,我有以下代码片段:
if has('autocmd')
filetype plugin indent on
syntax on但当我启动vim时,它显示以下错误:
Can't open file /usr/share/vim/syntax/syntax.vim.vimrc中的syntax on行似乎发生了错误。
我在path /usr/share/vim/syntax中没有syntax.vim,但我有像clojure.vim cpp.vim java.vim etc...这样的其他产品
我搜索了一下,但似乎找不到默认的syntax.vim,如果它是vim的默认版本。
我已经被这个问题困扰了一段时间了,需要一些帮助。
发布于 2018-05-18 00:29:54
我使用Arch,并使用vim-git PKGBUILD从AUR构建vim。对我来说,这是使用vim-git的情况,但vim-runtime来自官方repos,而不是来自AUR的vim-runtime-git。
切换到vim-runtime-git为我解决了这个问题,并提供了语法文件(以及颜色和...)。
发布于 2010-09-23 11:19:08
它应该在那里,所以可能会丢失其他文件。我建议您重新安装!
对于QDF,syntax.vim文件应该是这样的:-
" Vim syntax support file
" Maintainer: Bram Moolenaar <Bram@vim.org>
" 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发布于 2010-12-02 00:20:41
我在升级到7.3之后也遇到了这个问题(我正在使用cygwin)。检查运行"vi“而不是"vim”是否有同样的问题。我发现vim实际上是旧的7.2可执行文件,但是语法文件位于7.3预期的位置;vi是正确的7.3可执行文件。
https://stackoverflow.com/questions/3775126
复制相似问题