error while running “source .vimrc”

末鹿安然 提交于 2019-11-26 21:59:12

问题


i am having a simple vimrc file when i run "source .vimrc" in ubuntu I am getting the following error.

$ 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 --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 

回答1:


You tried to source your Vim configuration file from bash. Do it from Vim:

$ vim
:source /path/to/.vimrc

If it's located at ~/.vimrc, Vim will source that file automatically.




回答2:


I usually do :so $MYVIMRC

Just type :so $MY[tab] and it will autocomplete for you.



来源:https://stackoverflow.com/questions/21651114/error-while-running-source-vimrc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!