运行"source .vimrc"时出现错误 [英] error while running "source .vimrc"

查看:472
本文介绍了运行"source .vimrc"时出现错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在ubuntu中运行"source .vimrc"时,我有一个简单的vimrc文件,出现以下错误.

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")'

这是我的脚本文件

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

我的vim中确实安装了语法.

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 

推荐答案

您试图从bash中获取Vim配置文件.从Vim做到这一点:

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

$ vim
:source /path/to/.vimrc

如果位于~/.vimrc,Vim将自动为该文件提供源.

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

这篇关于运行"source .vimrc"时出现错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆