Warning message when sourcing .vimrc

混江龙づ霸主 提交于 2019-11-27 12:56:29

问题


I am trying to set up a .vimrc file in my home directory. The only thing it contains is the following.

" Enable syntax highlighting
syntax on

Whenever I want to source the file running . ~/.vimrc this message is returned.

/Users/username/.vimrc:3: unmatched "

My working environment is the following.

  • MacOS Lion 10.7.2
  • zsh 4.3.12 (i386-apple-darwin11.2.0)
  • oh_my_zsh
  • Terminal 2.2.1
  • VIM 7.3

How can I get rid of this warning/error message. What does it mean?!

EDIT

When I try the same from bash it does not work either.

bash-3.2$ . ~/.vimrc 
bash: /Users/username/.vimrc: line 1: unexpected EOF while looking for matching `"'
bash: /Users/username/.vimrc: line 3: syntax error: unexpected end of file
bash-3.2$ 

回答1:


you can run . ~/.bashrc in console
but you should run :source ~/.vimrc in vim
vim will run ~/.vimrc automatically, you don't need run it manually.

type :ver to check:

   system vimrc file: "$VIM\vimrc"
     user vimrc file: "$HOME\_vimrc"
 2nd user vimrc file: "$VIM\_vimrc"
      user exrc file: "$HOME\_exrc"
  2nd user exrc file: "$VIM\_exrc"
  system gvimrc file: "$VIM\gvimrc"
    user gvimrc file: "$HOME\_gvimrc"
2nd user gvimrc file: "$VIM\_gvimrc"
    system menu file: "$VIMRUNTIME\menu.vim"



回答2:


Put following code on head in your ~/.vimrc.

"return" 2>&- || "exit"


来源:https://stackoverflow.com/questions/8457599/warning-message-when-sourcing-vimrc

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