现在的位置: 首页 > 综合 > 正文

vimrc文件是让vim执行的

2012年12月26日 ⁄ 综合 ⁄ 共 894字 ⁄ 字号 评论关闭

有关vim设置。

2012-6-4 16:54

提问者:
水阁公子
| 浏览次数:58次

本人vim新手,只是想启用一下vim的设置而已,望知道的大哥指点。 运行bash-3.2# source ./vimrc_example.vi结果失败, 不知道是怎么了。

bash-3.2# cd /usr/share/vim/vim71/
bash-3.2# source ./vimrc_example.vim 
bash:  An example for a vimrc file.
: command not found
bash:  Maintainer:      Bram Moolenaar <Bram@vim.org>
: command not found
bash: 
: command not found
bash:      for Unix and OS/2:  ~/.vimrc
: No such file or directory
bash:   for MS-DOS and Win32:  \_vimrc
: command not found
bash: ./vimrc_example.vim: line 17: syntax error near unexpected token `('
bash: ./vimrc_example.vim: line 17: `" Use Vim settings, rather then Vi settings (much better!).'
我来帮他解答

   

检举|2012-6-4 22:00

满意回答

当然错了, vimrc 文件是让vim执行的。
你在 bash中执行 source命令,shell把vimrc作为 shell脚本执行。
vim /usr/share/vim/vim71/vimrc_example.vim 
然后在vim中输入 
:so %
就可以了。

追问

谢谢你的帮助,那我还想问下,怎么能让vimrc对每次vim打开都有效呢,我发现我那样设了之后,也只是对当前的vim窗口管用而已?不好意思,新手的问题,难免幼稚些。

回答

vim每次启动都会加载~/.vimrc文件,只要把初始设置写在这个文件里,就会自动加载。
执行以下命令
cat /usr/share/vim/vim71/vimrc_example.vim >> ~/.vimrc
就可以了。

抱歉!评论已关闭.