为什么我在安装 vundle 后无法获取我的 vimrc?

  • 本文关键字:获取 vimrc vundle 安装 vim
  • 更新时间 :
  • 英文 :


我试图在编辑 vimrc 后让我的 Vim 即时更新。所以我按照 Vimcast 的说明进行操作,基本上每次点击保存时都会获取 vimrc。

但是由于某种原因这不起作用(当我保存我的 vimrc 时,它不会给出任何错误),所以我决定手动运行source $HOME/.vimrc,这就是我得到的:

    -bash:  Configuration file for vim
            set nocompatible                              : command not found
    -bash:  Plugin Management {
            filetype off                                  : command not found
    -bash: .vimrc: line 7: syntax error near unexpected token `('
    -bash: .vimrc: line 7: `        call vundle#rc()'

这是我的 Vim 信息(我运行的是 Mac OS X 10.7.3):

    VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Jul 31 2011 19:27:29)
    Compiled by root@apple.com
    Normal version without GUI.  Features included (+) or not (-):
    -arabic +autocmd -balloon_eval -browse +builtin_terms +byte_offset +cindent 
    -clientserver -clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments 
    -conceal +cryptv +cscope +cursorbind +cursorshape +dialog_con +diff +digraphs 
    -dnd -ebcdic -emacs_tags +eval +ex_extra +extra_search -farsi +file_in_path 
    +find_in_path +float +folding -footer +fork() -gettext -hangul_input +iconv 
    +insert_expand +jumplist -keymap -langmap +libcall +linebreak +lispindent 
    +listcmds +localmap -lua +menu +mksession +modify_fname +mouse -mouseshape 
    -mouse_dec -mouse_gpm -mouse_jsbterm -mouse_netterm -mouse_sysmouse 
    +mouse_xterm +multi_byte +multi_lang -mzscheme +netbeans_intg -osfiletype 
    +path_extra -perl +persistent_undo +postscript +printer -profile -python 
    -python3 +quickfix +reltime -rightleft -ruby +scrollbind +signs +smartindent 
    -sniff +startuptime +statusline -sun_workshop +syntax +tag_binary 
    +tag_old_static -tag_any_white -tcl +terminfo +termresponse +textobjects +title
    -toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo 
    +vreplace +wildignore +wildmenu +windows +writebackup -X11 -xfontset -xim -xsmp
    -xterm_clipboard -xterm_save 
    system vimrc file: "$VIM/vimrc"
    user vimrc file: "$HOME/.vimrc"
    user exrc file: "$HOME/.exrc"
    fall-back for $VIM: "/usr/share/vim"
    Compilation: gcc -c -I. -D_FORTIFY_SOURCE=0 -Iproto -DHAVE_CONFIG_H -arch i386 -arch x86_64 -g -Os -pipe
    Linking: gcc -arch i386 -arch x86_64 -o vim -lncurses

有人可以在这里帮我一把吗?非常感谢!

== 更新 ==

所以正如你们所有人指出的那样,我混淆了 Vim 源代码和 Bash 源代码命令 - 谢谢。

现在我尝试在 Vim 中运行源代码,它没有错误。但是,它似乎仍然没有更新我的 vimrc。我的 vimrc 中有这条线

    nnoremap <leader><TAB> :sp ~/.vimrc<CR>

无论我是否注释掉了该行,在运行source ~/.vimrc后点击<leader><TAB>仍然会在分屏中打开我的 vimrc。

这是:source ...,从 Vim 中执行。从您的输出来看,您似乎错误地在 Bash shell 本身中执行了它(可能通过 :!source ); source也是一个 Bash 内置命令(如 . ),用于将文件内容作为 Bash 命令执行。

要调试不适合您的:autocmd,您可以临时添加

:echomsg "executing .vimrc"

或者用:15verbose write.vimrc,看看发生了什么。

最新更新