Vim Pathogen won't load - E117: Unknown function: pathogen#infect
Asked Answered
M

3

9

This should be a very straightforward problem. I have a simple .vimrc file. It is 15 lines in its entirety:

filetype off
set nocompatible
call pathogen#infect()
syntax on
filetype plugin indent on

set hlsearch
set colorcolumn=79
set number
set list
set expandtab
set tabstop=4
set softtabstop=4

colorscheme vividchalk

When I try to start vim, though, I get the following error message:

Error detected while processing /Users/Jon/.vimrc:
line    3:
E117: Unknown function: pathogen#infect
line   15:
E185: Cannot find color scheme 'vividchalk'

I have worked quite a while at solving this, including looking here: Vim: Pathogen not loading and here: Pathogen does not load plugins and here: https://github.com/tpope/vim-pathogen/issues/50

I am storing all my vim-related files in a ~/.dotfiles/vim/ directory and have symlinked .vimrc and .gvimrc and .vim/from my home directory. I have three plugins I am trying to load: command-t, commentary, and fugitive. These plugins are all git submodules. The directory structure is as follows:

.dotfiles/
 ├──vim/
    ├── autoload/
    │   └── pathogen.vim
    ├── bundle/
    │   ├── command-t/
    │   ├── commentary/
    │   └── fugitive/
    ├── colors/
    │   ├── distinguished.vim
    │   └── vividchalk.vim
    ├── ftdetect/
    │   ├── markdown.vim
    │   └── vim.vim
    ├── gvimrc
    ├── snippets/
    │   └── markdown.snippets
    ├── syntax/
    │   ├── markdown.vim
    │   └── python.vim
    ├── test.txt
    └── vimrc
Mclane answered 26/10, 2012 at 3:53 Comment(1)
Why the ~/.dotfiles/ directory? It's probably what is messing stuff up.Conferva
W
8

Since vividchalk can't load either, I'd guess vim can't access your .vim.

Are you on OS X? Are you using MacVim?

You may have incorrectly created your ~/.vim. I would do this (with absolute paths):

ln -s ~/.dotfiles/vim ~/.vim

You could try this:

mkdir ~/vim_archive
mv ~/.*vim* ~/vim_archive/.
mkdir -p ~/.vim/colors
cp ~/vim_archive/.vim/colors/vividchalk.vim ~/.vim/colors/.
echo colorscheme vividchalk > ~/.vimrc

If that successfully loads, then vim is correctly reading your vimrc and .vim. Then try it with a linked folder. If that works, then add pathogen and see if it loads.

Workday answered 26/10, 2012 at 4:47 Comment(1)
You're right. I had a ~/.vim/ symlinked in my home directory to ~/.dotfiles/.vim instead of ~/.dotfiles/vim. I should have just thought more carefully about the issue since I also noticed that vividchalk couldn't load and so it wasn't a pathogen-specific thing. Thanks for doing my thinking for me, though.Mclane
C
3

The most obvious solution is to move your ~/.dotfiles/vim folder out of that ~/.dotfiles directory to its normal location and name:

~/.vim

You can use a symlink like in pydave's answer.

Another solution would be to add the following line to your ~/.vimrc:

set runtimepath+=~/.dotfiles/vim/autoload (and all the other subdirs)
Conferva answered 26/10, 2012 at 6:1 Comment(0)
U
0

I was facing the same issue, finally after lot of google and tweaking the vimrc file, found the solution. Hope the following code snippet would resolve the issue.

In my home directory all the files are linked to the their relevant location as follows

ln -s ~/dotfiles/vim ~/.vim ln -s ~/dotfiles/vim/vimrc ~/.vimrc ln -s ~/dotfiles/bash/bashrc ~/.bashrc ln -s ~/dotfiles/bash/aliases ~/.bash_aliases

Add the following lines to your vimrc file.

set nocp source /home/ameet/.vim/autoload/pathogen.vim "location of my pathogen.vim call pathogen#infect() call pathogen#helptags()

Underwood answered 13/5, 2014 at 15:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.