auto-pairs seems like a great feature for vim. As per instructions, I copied the auto-pairs.vim file to ~/.vim/plugin/ and sourced the .vim file by executing :source % in the auto-pairs.vim file according to the most voted instructions. I restarted the terminal, but it doesn't seem to work. Am I missing something?

I am using a Macbook, iterm2 and VIM - Vi IMproved 7.4


I'll break down my answer in two parts:

  • I'll start with some guidelines:

    1. First of all, most of the time plugins have two or more directories where code resides, not only a root/plugin directory.

    2. Second, you need to place these plugins, in a specified directory and later set the runtimepath from your ~/.vimrc. I've ~/.vim/bundle as my plugin directory and in my vimrc I have set runtimepath+=~/.vim/bundle. Be sure to clone plugin repositories properly.

    3. Observing your obvious lack of info of using plugins and then assuming you're new to vim, I suggest using a package manager for vim. Many would suggest vim-pathogen. But I'd suggest vim-plug. But you should check others out for yourself. Just google it.

  • Now, to get back to the problem you currently have.
    So, if you want to use any plugin manager, then do that. But for first time's sake, do these following:

    1. create ~/.vim/bundle : mkdir -p ~/.vim/bundle
    2. git clone https://github.com/jiangmiao/auto-pairs.git
    3. add this line to vimrc : set runtimepath+=~/.vim/bundle/auto-pairs
    4. Restart vim.

you should get the plugin working now. If you find out anything odd reply here.


You say "it doesn't seem to work" so I'm assuming this simple test fails: while in Insert mode enter [ and you should see [|] where | is the cursor. If not then let's look at the installation...

:source in the context of plugins is for vimball files and you would do something like this, once, to install the plugin:

    vim someplugin.vba
    :source %

(Generally speaking :source just executes the Ex commands in a file.)

But, of course, this plugin is not in a vimball. All you should need to do is copy the file to ~/.vim/plugin/ then start vim. I just did exactly that with the current version of auto-pairs and everything is working fine. (I'm not on Mac, though.) Note that by sourcing it you may even be causing problems that wouldn't normally exist.

If you're using a fairly up-to-date version of Vim you could also try copying the entire plugin directory (including docs\, plugin\, etc.) to the following (create the parent directories if you don't have them already):


(Note: directory "bundle" can actually be named anything you want.)

Alternatively, if you know git you can clone the whole thing into the start/ directory.

The next time you run vim the plugin will be available. One advantage of this is that you'll have local access to the help file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.