Vim Plugins Installation with Vundle in macOS

Vundle Installation

Vundle is short for Vim bundle and is a Vim plugin manager.

Clone Vundle to local

1
$ git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim

Modify ~/.vimrc

Put this at the top of your .vimrc to use Vundle. Remove plugins you don’t need, they are for illustration purposes:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
set nocompatible              " be iMproved, required
filetype off " required

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')

" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'

" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo
Plugin 'tpope/vim-fugitive'
" plugin from http://vim-scripts.org/vim/scripts.html
" Plugin 'L9'
" Git plugin not hosted on GitHub
Plugin 'git://git.wincent.com/command-t.git'
" git repos on your local machine (i.e. when working on your own plugin)
Plugin 'file:///home/gmarik/path/to/plugin'
" The sparkup vim script is in a subdirectory of this repo called vim.
" Pass the path to set the runtimepath properly.
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
" Install L9 and avoid a Naming conflict if you've already installed a
" different version somewhere else.
" Plugin 'ascenator/L9', {'name': 'newL9'}

" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line

Note: All Plugin should be added between call vundle#begin() and call vundle#end().

After saving and exiting, revoke vim with sudo, then type command :PluginInstall

The NERDTree

The NERDTree is a file system explorer for the Vim editor. Using this plugin, users can visually browse complex directory hierarchies, quickly open files for reading or editing, and perform basic file system operations.

Installation

Add Plugin 'scrooloose/nerdtree' in your ~/.vimrc .

Then run :PluginInstall in Vim.

Finally, you can call it through :NERDTree.

YouCompleteMe

YouCompleteMe is a fast, as-you-type, fuzzy-search code completion engine for Vim.

Installation

Add Plugin 'valloric/youcompleteme' in your ~/.vimrc .

Then run :PluginInstall in Vim.

Compilation

If you try to run vim now, there will be one prompt message at the bottom:

The ycmd server SHUT DOWN (restart with ‘:YcmRestartServer’). Unexpected error while loading the YCM core library. Use the ‘:YcmToggleLogs’ command to check the logs.

Change working directory to ~/.vim/bundle/YouCompleteMe.

Compiling YCM with semantic support for C-family languages:

1
2
$ cd ~/.vim/bundle/YouCompleteMe
$ ./install.py --clang-completer

Compiling YCM without semantic support for C-family languages:

1
2
$ cd ~/.vim/bundle/YouCompleteMe
$ ./install.py

For other languages support options, please refer to the official installation guide.

However, after compiling with support for C-family languages, when opening vim again, there’s still one message:

No .ycm_extra_conf.py file detected, so no compile flags are available. Thus no semantic support for C/C++/ObjC/ObjC++.

Now we need to give YCM one .ycm_extra_conf.py.

The easiest way is to use the one under path /Users/XXX/.vim/bundle/youcompleteme/third_party/ycmd.

mkdir cpp in YouCompleteMe folder and copy the config file into it.

Of course, you could also manually config .ycm_extra_conf.py.

Last, add this line into your ~/.vimrc:

1
let g:ycm_global_ycm_extra_conf='/Users/XXX/.vim/bundle/youcompleteme/cpp/.ycm_extra_conf.py'

Have fun!

Other Plugins

Vimawesome