简体   繁体   English

运行“source .vimrc”时出错

[英]error while running “source .vimrc”

i am having a simple vimrc file when i run "source .vimrc" in ubuntu I am getting the following error. 当我在ubuntu中运行“ source .vimrc”时,我有一个简单的vimrc文件,出现以下错误。

$ source .vimrc 
bash: .vimrc: line 3: syntax error near unexpected token `"syntax"'
bash: .vimrc: line 3: `if has("syntax")'

Here is my script file 这是我的脚本文件

set term=builtin_ansi
set nu
if has("syntax")
    syntax on
endif

I do have syntax installed in my vim. 我的vim中确实安装了语法。

vim --version | grep syntax
vim: /home/shankaran/src/ns/service/build/dp/lib/libcrypto.so.1.0.0: no version information available (required by /usr/lib/libpython2.7.so.1.0)
vim: /home/shankaran/src/ns/service/build/dp/lib/libssl.so.1.0.0: no version information available (required by /usr/lib/libpython2.7.so.1.0)
-sniff +startuptime +statusline -sun_workshop +syntax +tag_binary 

You tried to source your Vim configuration file from bash. 您试图从bash中获取Vim配置文件。 Do it from Vim: 从Vim做到:

$ vim
:source /path/to/.vimrc

If it's located at ~/.vimrc , Vim will source that file automatically. 如果它位于~/.vimrc ,Vim将自动获取该文件。

I usually do :so $MYVIMRC 我通常这样做:所以$ MYVIMRC

Just type :so $MY[tab] and it will autocomplete for you. 只需输入:所以$ MY [tab]它会自动完成。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM