Problems with vim-pathogen on mac osx

3.3k views Asked by At

I have recently moved from Ubuntu to Mac osx. And my first thing is to bring my vim with me.

I downloaded source from vim.org and compiled with gcc.( I'll put the version output at the bottom of my post)

I added pathogen.vim to ~/.vim/autoload directory. But when I add the code in ~/.vim/vimrc:

execute pathogen#infect()

I got errors when tring to start vim, here is the error output:

Error detected while processing /Users/jack/.vim/vimrc:
line    3:
E117: Unknown function: pathogen#infect
E15: Invalid expression: pathogen#infect()
Press ENTER or type command to continue

First I though perhaps vim did not load pathogen.vim, but :scriptnames showed it did load!

  1: ~/.vim/vimrc
  2: ~/.vim/bundle/vim-pathogen/autoload/pathogen.vim

After I ran :function, something caught my attention, there is a "abort" after the infect function, I google around, and found it did not solve my problem either:

function pathogen#legacyjoin(...) abort
function pathogen#runtime_append_all_bundles(...) abort
function pathogen#surround(path) abort
function <SNR>2_Findcomplete(A, L, P)
function pathogen#uniq(list) abort
function pathogen#incubate(...) abort
function pathogen#glob(pattern) abort
function <SNR>2_warn(msg)
function pathogen#runtime_findfile(file, count) abort
function pathogen#separator() abort
function pathogen#runtime_prepend_subdirectories(path)
function pathogen#glob_directories(pattern) abort
function pathogen#infect(...) abort
function pathogen#is_disabled(path)
function pathogen#join(...) abort
function pathogen#cycle_filetype()
function pathogen#split(path) abort
function <SNR>2_find(count, cmd, file, lcd)
function pathogen#fnameescape(string) abort
function pathogen#execute(...) abort
function pathogen#helptags() abort

Can anyone help point out what should I do to solve this problem?

Here is the version output with command "vim --version":

JacktekiMac-Pro:.vim$ vim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Dec  6 2013 17:01:30)
MacOS X (unix) version
Huge version without GUI.  Features included (+) or not (-):
+arabic          +file_in_path    +mouse_sgr       +tag_binary
+autocmd         +find_in_path    -mouse_sysmouse  +tag_old_static
-balloon_eval    +float           +mouse_urxvt     -tag_any_white
-browse          +folding         +mouse_xterm     -tcl
++builtin_terms  -footer          +multi_byte      +terminfo
+byte_offset     +fork()          +multi_lang      +termresponse
+cindent         -gettext         -mzscheme        +textobjects
-clientserver    -hangul_input    +netbeans_intg   +title
+clipboard       +iconv           +path_extra      -toolbar
+cmdline_compl   +insert_expand   -perl            +user_commands
+cmdline_hist    +jumplist        +persistent_undo +vertsplit
+cmdline_info    +keymap          +postscript      +virtualedit
+comments        +langmap         +printer         +visual
+conceal         +libcall         +profile         +visualextra
+cryptv          +linebreak       +python/dyn      +viminfo
-cscope          +lispindent      -python3         +vreplace
+cursorbind      +listcmds        +quickfix        +wildignore
+cursorshape     +localmap        +reltime         +wildmenu
+dialog_con      -lua             +rightleft       +windows
+diff            +menu            -ruby            +writebackup
+digraphs        +mksession       +scrollbind      -X11
-dnd             +modify_fname    +signs           -xfontset
-ebcdic          +mouse           +smartindent     -xim
+emacs_tags      -mouseshape      -sniff           -xsmp
+eval            +mouse_dec       +startuptime     -xterm_clipboard
+ex_extra        -mouse_gpm       +statusline      -xterm_save
+extra_search    -mouse_jsbterm   -sun_workshop
+farsi           +mouse_netterm   +syntax
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  fall-back for $VIM: "/usr/local/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H   -DMACOS_X_UNIX -no-cpp-precomp  -O2 -fno-strength-reduce -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc    -o vim        -lm -lncurses  -liconv -framework Cocoa
2

There are 2 answers

4
Jack On

I found the problem.

system vimrc file: "$VIM/vimrc" user vimrc file: "$HOME/.vimrc" 2nd user vimrc file: "~/.vim/vimrc" user exrc file: "$HOME/.exrc"

I set $VIM to ~/.vim, which is the same as the 2nd user vimrc file. So the vimrc file load twice.

After I change $VIM to /etc/vim, everything turns out be good.

0
debo On

I had a similar problem and found that I had not created the ~/.vim directory correctly. I created it in the root by changing directory there and typing mkdir /.vim but for some reason it was not working. Then I deleted this folder and did mkdir ~/.vim and was ably to install and use pathogen.