17

The only documentation for installing YCM seems to be for Vundle and I'm fairly new to vim-plug and plugins in general so I'm not sure how well it translates to vim-plug.

  • neovim didn't install it, vim-plug did. Where you told it to! – user6249 Feb 2 '16 at 12:31
9

neovim version 0.1 has breaking changes. It uses directory ~/.config/nvim (On Mac OS X. Linux or Windows may use slightly different paths.)

If you want your neovim configuration independent of vim configuration, you can rename .nvimrc to ~/.config/nvim/init.vim (See the docs here and here).

Install vim-plug to ~/.config/nvim/autoload/plug.vim
The directory tree looks like this:

.config
├── nvim
    ├── autoload
    │   └── plug.vim
    ├── init.vim
    └── plugged
        ├── YouCompleteMe
        ├── ctrlp.vim

In neovim when you run :PlugInstall, vim-plug will install your plugins to the path you specified in init.vim
Use .config/nvim/plugged

" for vim
" call plug#begin('~/.vim/plugged')
" for neovim
call plug#begin('~/.config/nvim/plugged')
" Keep Plug commands between plug#begin/end.
Plug 'https://github.com/Valloric/YouCompleteMe'

If you want neovim to use vim's plugin location, replace directory .config/nvim with a symlink named .config/nvim that points to .vim

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

In .vim either add init.vim similar to .vimrc, or add symlink named init.vim to point to .vimrc

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

In .vimrc

call plug#begin('~/.vim/plugged')

If you use Homebrew to install neovim, at the end of the install it provides some helpful info about setting the symlinks: https://github.com/neovim/homebrew-neovim

Also many people create a git repo in a directory named "dotfiles" or similar to version control configuration files like init.vim and .vimrc. In other directories add symlinks to your dotfiles
(e.g. ~/.config/neovim/init.vim could be symlinked to ~/dotfiles/init.vim)
This is handy when setting up a new machine.

YouCompleteMe

As warsong mentioned

pip install neovim

For C family language completion:

cd ~/.config/nvim/plugged/YouCompleteMe
./install.py

https://github.com/Valloric/YouCompleteMe

I ran install.py separately, hadn't seen nifty one-liner method

Plug 'Valloric/YouCompleteMe', { 'do': './install.py' }
2

I managed to install it.

What I did was install python for neovim using

pip install neovim

The next thing I did was

:PlugInstall YouCompleteMe

from within neovim and it started installing as it normally does (if you have all the usual YCM dependencies installed).

My .nvimrc still had the section for YCM in it and I guess vim-plug still uses those.

Edit: I don't understand why YCM gets installed to the old vim plugins folder (/.vim) instead of neovim's folder (well I do, because I specified it, but shouldn't neovim install plugins to it's own folder structure? I thought it would be smart enough..) Is it even a good idea to be sharing folder hierarchies like that?

This is what I had in my .nvimrc

call plug#begin('~/.vim/plugged')

" Make sure you use single quotes
Plug 'Valloric/YouCompleteMe', { 'do': './install.py' }

call plug#end()
1

It's installed in the .vim/ dir, because of

call plug#begin('~/.vim/plugged')

try:

call plug#begin('~/.config/nvim/plugged')

Instead, as answered above

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.