سؤال

I'm trying to add a keymap to my NERDTree configuration which executes the current FileNode and displays the output. I put this script file in my ~/.vim/plugin directory.

The keymap actually works when I source the script file from within Vim, but displays the error "Unknown function: NERDTreeAddKeyMap" when starting Vim.

I used Pathogen for my plugins, and in my ~/.vimrc I have all the necessary :

" Enable filetype plugins
filetype plugin indent on

" Start Pathogen plugin to load bundle
call pathogen#infect()
call pathogen#helptags()

As well as NERDTree in my ~/.vim/bundle directory.

Where should I move the script so that it is automatically loaded on Vim startup, without this ugly error ?

هل كانت مفيدة؟

المحلول

  1. The filetype plugin indent on line is supposed to come after the two Pathogen lines.

  2. The relevant documentation says:

    This code should sit in a file like ~/.vim/nerdtree_plugin/mymapping.vim.

    So, since you use Pathogen, the right place is probably:

    ~/.vim/bundle/[nerdtree directory]/nerdtree_plugin/mymapping.vim
    
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top