Vim-pathogen: E117: Unknown function: pathogen#infect

Created on 25 Nov 2011  路  30Comments  路  Source: tpope/vim-pathogen

New installation, with newbie vim user and first install of pathogen (so probably user error!)

Vim 7.2.2, pathogen 2.0
disabled the global /etc/vimrc
put the following in .vimrc

call pathogen#infect()
syntax on
filetype plugin indent on

pathogen is in

~$ ls .vim/autoload/pathogen.vim
.vim/autoload/pathogen.vim

starting vim:

vim -Vdebug -u NONE
:so .vimrc

error displayed

Error detected while processing /home/ec2-user/.vimrc:
line    1:
E117: Unknown function: pathogen#infect

debug text follows:

sourcing ".vimrc"
Searching for "autoload/pathogen.vim" in "/home/me/.vim,/usr/share/vim/vimfiles,/usr/share/vim/vim72,/usr/share/vim/vimfiles/after,/home/me/.vim/after"
Searching for "/home/me/.vim/autoload/pathogen.vim"
chdir(/home/me/.vim/autoload)
fchdir() to previous dir
line 1: sourcing "/home/me/.vim/autoload/pathogen.vim"
finished sourcing /home/me/.vim/autoload/pathogen.vim
continuing in /home/me/.vimrc
Searching for "autoload/pathogen.vim" in "/home/me/.vim,/usr/share/vim/vimfiles,/usr/share/vim/vim72,/usr/share/vim/vimfiles/after,/home/me/.vim/after"
Searching for "/home/me/.vim/autoload/pathogen.vim"
chdir(/home/me/.vim/autoload)
fchdir() to previous dir
line 1: sourcing "/home/me/.vim/autoload/pathogen.vim"
finished sourcing /home/me/.vim/autoload/pathogen.vim
continuing in /home/me/.vimrc
Error detected while processing /home/me/.vimrc:
line    1:
E117: Unknown function: pathogen#infect
chdir(/usr/share/vim/vim72/syntax)
fchdir() to previous dir
line 2: sourcing "/usr/share/vim/vim72/syntax/syntax.vim"
Searching for "syntax/synload.vim" in "/home/me/.vim,/usr/share/vim/vimfiles,/usr/share/vim/vim72,/usr/share/vim/vimfiles/after,/home/me/.vim/after"
Searching for "/home/me/.vim/syntax/synload.vim"
Searching for "/usr/share/vim/vimfiles/syntax/synload.vim"
Searching for "/usr/share/vim/vim72/syntax/synload.vim"
chdir(/usr/share/vim/vim72/syntax)
fchdir() to previous dir
line 19: sourcing "/usr/share/vim/vim72/syntax/synload.vim"
Searching for "syntax/syncolor.vim" in "/home/me/.vim,/usr/share/vim/vimfiles,/usr/share/vim/vim72,/usr/share/vim/vimfiles/after,/home/me/.vim/after"
Searching for "/home/me/.vim/syntax/syncolor.vim"
Searching for "/usr/share/vim/vimfiles/syntax/syncolor.vim"
Searching for "/usr/share/vim/vim72/syntax/syncolor.vim"
chdir(/usr/share/vim/vim72/syntax)
fchdir() to previous dir
line 21: sourcing "/usr/share/vim/vim72/syntax/syncolor.vim"
finished sourcing /usr/share/vim/vim72/syntax/syncolor.vim
continuing in /usr/share/vim/vim72/syntax/synload.vim
Searching for "/usr/share/vim/vimfiles/after/syntax/syncolor.vim"
Searching for "/home/me/.vim/after/syntax/syncolor.vim"
finished sourcing /usr/share/vim/vim72/syntax/synload.vim
continuing in /usr/share/vim/vim72/syntax/syntax.vim
Searching for "filetype.vim" in "/home/me/.vim,/usr/share/vim/vimfiles,/usr/share/vim/vim72,/usr/share/vim/vimfiles/after,/home/me/.vim/after"
Searching for "/home/me/.vim/filetype.vim"
Searching for "/usr/share/vim/vimfiles/filetype.vim"
Searching for "/usr/share/vim/vim72/filetype.vim"
chdir(/usr/share/vim/vim72)
fchdir() to previous dir
line 25: sourcing "/usr/share/vim/vim72/filetype.vim"
Searching for "ftdetect/*.vim" in "/home/me/.vim,/usr/share/vim/vimfiles,/usr/share/vim/vim72,/usr/share/vim/vimfiles/after,/home/me/.vim/after"
Searching for "/home/me/.vim/ftdetect/*.vim"
Searching for "/usr/share/vim/vimfiles/ftdetect/*.vim"
Searching for "/usr/share/vim/vim72/ftdetect/*.vim"
Searching for "/usr/share/vim/vimfiles/after/ftdetect/*.vim"
Searching for "/home/me/.vim/after/ftdetect/*.vim"
not found in 'runtimepath': "ftdetect/*.vim"
finished sourcing /usr/share/vim/vim72/filetype.vim
continuing in /usr/share/vim/vim72/syntax/syntax.vim
Searching for "/usr/share/vim/vimfiles/after/filetype.vim"
Searching for "/home/me/.vim/after/filetype.vim"
Executing FileType Auto commands for "*"
autocommand exe "set syntax=" . expand("<amatch>")  

Executing Syntax Auto commands for "*"
autocommand call s:SynSet()

Executing BufRead Auto commands for "*"
autocommand if !did_filetype() && expand("<amatch>") !~ g:ft_ignore_pat | runtime! scripts.vim | endif

Searching for "scripts.vim" in "/home/me/.vim,/usr/share/vim/vimfiles,/usr/share/vim/vim72,/usr/share/vim/vimfiles/after,/home/me/.vim/after"
Searching for "/home/me/.vim/scripts.vim"
Searching for "/usr/share/vim/vimfiles/scripts.vim"
Searching for "/usr/share/vim/vim72/scripts.vim"
chdir(/usr/share/vim/vim72)
fchdir() to previous dir
line 0: sourcing "/usr/share/vim/vim72/scripts.vim"
finished sourcing /usr/share/vim/vim72/scripts.vim
continuing in BufRead Auto commands for "*"
Searching for "/usr/share/vim/vimfiles/after/scripts.vim" 
Searching for "/home/me/.vim/after/scripts.vim"
Executing BufRead Auto commands for "*"
autocommand if !did_filetype() && expand("<amatch>") !~ g:ft_ignore_pat    && (getline(1) =~ '^#' || getline(2) =~ '^#' || getline(3) =~ '^#'^I|| getline(4) =~ '^#' || getline(5) =~ '^#') |   setf conf | endif 

finished sourcing /usr/share/vim/vim72/syntax/syntax.vim
continuing in /home/me/.vimrc
Searching for "filetype.vim" in "/home/me/.vim,/usr/share/vim/vimfiles,/usr/share/vim/vim72,/usr/share/vim/vimfiles/after,/home/me/.vim/after"
Searching for "/home/me/.vim/filetype.vim"
Searching for "/usr/share/vim/vimfiles/filetype.vim"
Searching for "/usr/share/vim/vim72/filetype.vim"
chdir(/usr/share/vim/vim72)
fchdir() to previous dir
line 3: sourcing "/usr/share/vim/vim72/filetype.vim"
finished sourcing /usr/share/vim/vim72/filetype.vim
continuing in /home/me/.vimrc
Searching for "/usr/share/vim/vimfiles/after/filetype.vim"
Searching for "/home/me/.vim/after/filetype.vim"
Searching for "ftplugin.vim" in "/home/me/.vim,/usr/share/vim/vimfiles,/usr/share/vim/vim72,/usr/share/vim/vimfiles/after,/home/me/.vim/after"
Searching for "/home/me/.vim/ftplugin.vim"
Searching for "/usr/share/vim/vimfiles/ftplugin.vim"
Searching for "/usr/share/vim/vim72/ftplugin.vim"
chdir(/usr/share/vim/vim72)
fchdir() to previous dir
line 3: sourcing "/usr/share/vim/vim72/ftplugin.vim"
finished sourcing /usr/share/vim/vim72/ftplugin.vim
continuing in /home/me/.vimrc
Searching for "/usr/share/vim/vimfiles/after/ftplugin.vim"
Searching for "/home/me/.vim/after/ftplugin.vim"
Searching for "indent.vim" in "/home/me/.vim,/usr/share/vim/vimfiles,/usr/share/vim/vim72,/usr/share/vim/vimfiles/after,/home/me/.vim/after"
Searching for "/home/me/.vim/indent.vim"
Searching for "/usr/share/vim/vimfiles/indent.vim"
Searching for "/usr/share/vim/vim72/indent.vim"
chdir(/usr/share/vim/vim72)
fchdir() to previous dir
line 3: sourcing "/usr/share/vim/vim72/indent.vim"
finished sourcing /usr/share/vim/vim72/indent.vim
continuing in /home/me/.vimrc
Searching for "/usr/share/vim/vimfiles/after/indent.vim"
Searching for "/home/me/.vim/after/indent.vim"
finished sourcing .vimrc 

Most helpful comment

I just ran into this error as well. The problem is I put pathogen.vim in $HOME/vimfiles/autoload. vim from Git for windows will only recognize $HOME/.vim by default.

Here is how I fixed the error.
cd $HOME
ln -s vimfiles .vim

All 30 comments

What is the output of :set cp?. Pathogen does not work in compatibility mode.

:set cp? results in:
nocompatible

I guess that some pathogen.vim is exists in your rtp. try to check :scriptnames results.

got this:
1: /home/ec2-user/.vimrc
2: /home/ec2-user/.vim/autoload/pathogen.vim
3: /usr/share/vim/vim72/syntax/syntax.vim
4: /usr/share/vim/vim72/syntax/synload.vim
5: /usr/share/vim/vim72/syntax/syncolor.vim
6: /usr/share/vim/vim72/filetype.vim
7: /home/ec2-user/.vim/ftdetect/go.vim
8: /usr/share/vim/vim72/scripts.vim
9: /usr/share/vim/vim72/ftplugin.vim
0: /usr/share/vim/vim72/indent.vim

me is real user name? or ec2-user ?

ec2-user is the current user (i did a search and replace on "ec2-user" to "me" on first post)

Try following .vimrc

set nocp
" set rtp+=/path/to/rtp/that/included/pathogen/vim " if needed
call pathogen#infect()
syntax on
filetype plugin indent on

fixed! adding "set nocp" just before the call fixed the error

thanks!

I would like to update this page for future googlers, as I just ran into this problem with a slightly different solution and this is the first result when searching for "Unknown function: pathogen#infect".

My setup is slightly different. I prefer to have all my personal config files in ~/.config. I run Mac OS X 10.9 and install the latest vim with homebrew. I have a export variable in my bashrc that tells programs where to install config files (for me it's export DOTFILES=~/.config). In vim though, the first vimrc read is always /usr/local/share/vim/vimrc, followed by ~/.vimrc.

So future googlers, if you were hoping to find a fix for pathogen when you enjoy having a nonstandard vim directory, this is the /usr/local/share/vim/vimrc file that works for me:

set nocp
if exists('$DOTFILES') 
  source $DOTFILES/vim/autoload/pathogen.vim
  source $DOTFILES/vim/vimrc
endif

Apologies if this annoys anyone with an email.

Similar experience, different solution. I'm sharing my vimrc between Windows and OSX machines and encountered this issue on Windows, where I've gone to using the Unix folder layout (.vim folder). As a result, autoload stopped working on Windows. The guidance from this article hit the nail on the head with this suggestion:

if has('win32') || has('win64')
  set runtimepath=$HOME/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,$HOME/.vim/after
endif

Cool, thank you! Your command works on my Windows 7!

if has('win32') || has('win64')
  set runtimepath=$HOME/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,$HOME/.vim/after
endif

I just ran into this error as well. The problem is I put pathogen.vim in $HOME/vimfiles/autoload. vim from Git for windows will only recognize $HOME/.vim by default.

Here is how I fixed the error.
cd $HOME
ln -s vimfiles .vim

I'm using vim on a mac running El capitan version 10.11.4 and am using vim 7.3 and i'm using the same code as above and I get this error:
Error detected while processing /Users/smrengel/.vimrc:
line 1:
E117: Unknown function: pathogen#infect

I've tried using the method above , but no luck

Getting this problem again as well, on a new Mac.

Literally the only thing that can cause this is installing Pathogen in the wrong place, or not at all.

Does it need to be installed differently for neovim than vim? Cause it works fine with vim and breaks with neovim.

Scratch that, definitely a user error here.

I got this same error and I saw that I indeed installed it in the wrong directory.
Install in that autoload directory.

fixed!

Solved this for latest NeoVim by moving theautoload directory into ./config/nvim/

I'm getting this error on Windows and I've tried the "if has()" solution but it still gives the same error.

Solved this on OSX (running bash) by linking my .vim directory to .config/nvim and creating an init.vim file in there linking to my .vimrc.

ln -s ~/.vim ~/.config/nvim
ln -s ~/.vimrc ~/.config/nvim/init.vim

It's IMPORTANT that you create the symlink:

ln -s ~/.vim ~/.config/nvim

FIRST, before the second one:

ln -s ~/.vimrc ~/.config/nvim/init.vim

for this to work.

If you create the symlink for the vimrc file first (init.vim) then you'll end up creating a nvim folder instead of a symlinked one, which will put the vim folder inside it and not it's contents. That's how the pathogen install will fail.

For windows, I've just rename ~/.vim to ~/vimfiles

I installed pathogen from Ubuntu repository and caused this error in neovim, though vim was running file. Installed it in autoload, now the error is gone

I am getting the same error. I am a new user of vim 8 (Windows 10).
I moved autoload to the vimfiles folder (after deleting all files in that folder) and installed pathogen.vim. Then i created a bundle folder in vimfiles and installed vim-markdown. Any suggestions?

How I correct the error (archlinux) for only root user (simple user worked well) :

mv /root/.vim{,.old}
mv /root/.vimrc{,.old}
ln -sv /home/$USER/.vim /root/.vim
[[ -e /root/.vimrc && -e  /home/$USER/.vimrc ]] && ln -sv /home/$USER/.vimrc /root/.vimrc

pathogen is only installed in $USER files

For those on windows who couldn't solve the issue with any of the suggestions above, you may want to check this out.

In my case, the problem was that I had two copies of vim, the one that I got from the vim website (installed in `C:\Program Files (x86)\Vim\Vim80") and the one that comes bundled with gitbash. So, every time I ran "vim" from the command line, instead of loading vim.exe from program files (let's say "the right version") it was loading vim from gitbash and none of the suggestions above worked out.

What I ended up doing was creating a bat file called "vi.bat" and place that file on a directory visible to my PATH. So every time I run vi from the command line, that bat file gets called and it launches the right version of vim.

It looks something like this

@echo off
rem vi.bat
"C:\program files (x86)\Vim\Vim80\vim.exe" %1 %2

Hope this help someone else...

My distribution's package manager installed pathogen in /usr/share/vim/vimfiles. The issue was solved by adding

set runtimepath^=/usr/share/vim/vimfiles runtimepath^=~/.vim runtimepath+=~/.vim/after

to my ~/.config/nvim/init.vim

I'll add another more recent case since this page is coming up as a top result in google.

My system is Windows 10 and I'm trying to set up my vim config for Neovim to share it across machines that will likely include a Mac soon at my new gig. There's a few things I did to facilitate this which had me running into this error.

  1. My Neovim config is located in %userprofile%\AppData\nvim\init.vim because I'm using megasync for that nvim folder across multiple machines.
  2. Within that file, I have the following:
" add ~/.vim to the packpath so windows works like linux
set packpath^=~/.vim
set runtimepath^=~/.vim
execute pathogen#infect()

It's important that both packpath and runtimepath are being set here. Having only the packpath set was what caused the issue for me. Neovim's Windows install doesn't have the ~/.vim folder in the runtimepath by default, and thus can't find Pathogen if I don't add the folder to it.

This worked for me on Win 10 (with gVim and Git Vim in Command Prompt): https://kevinlocke.name/bits/2020/07/30/sharing-vimrc-in-git-for-windows/

let &runtimepath = '~/vimfiles,'
\ . join(filter(split(&runtimepath, ','), 'v:val !~? "/\\.vim"'), ',')
\ . ',~/vimfiles/after'
let &packpath = &runtimepath
Was this page helpful?
0 / 5 - 0 ratings

Related issues

andreasmischke picture andreasmischke  路  25Comments

dkowis picture dkowis  路  4Comments

zerobatu picture zerobatu  路  3Comments

derekchiang picture derekchiang  路  3Comments

janko picture janko  路  3Comments