I use vim daily, and am the kind of Linux person to snicker at those using nano, pico and all the lesser editors of the world. But recently a project I was working on became a bit more complex both in size and structure that I needed vim to have a bit more umpf than just the normal powers it was providing. So I started to do some research and discuss with other developers around the world to find the best solution to me. Mainly because I haven’t jumped on the whole IDE/Eclipse movement and don’t want to lose vim as a tool.
Fortunately, it appears I am not the only person who needs/wants these functionalities in an editor and was able to find the perfect solution for me and hopefully you. Vim as an IDE gives me the flexibility of vim and the powers of auto completion and syntax highlighting without the overhead of a JVM and clunky GUI. Lets get started.
I run on a Fedora workstation so for any other distro or Windows/Mac see: https://github.com/Valloric/YouCompleteMe#installation
Short demo
Here you will see a quick example of me changing a few variables and the autocompletion functionality YouCompleteMe provides.
If you haven’t already, install vim with some prerequisites.
sudo dnf install vim automake gcc gcc-c++ kernel-devel cmake python-devel git
Depending on your os you may need to use another package manager (apt, yum, brew, etc)
Download and configure vundle
Vundle is a vim plugin management system that will help you install all the things nice and easily.
cd ~
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
Add the following to the top of your .vimrc
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'Valloric/YouCompleteMe'
call vundle#end()
filetype plugin indent on
This is needed to complete the install Vundle as well as YouCompleteMe.
Install vundle and ycm
Now we will actually install Vundle and YouCompleteMe, YouCompleteMe is a library to add auto completion functionality to vim.
vim +PluginInstall +qall
Compile C++ libs for faster auto completion
cd ~
mkdir ycm_build
cd ycm_build
cmake -G "Unix Makefiles" . ~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp
cmake --build . --target ycm_support_libs --config Release
And now vim is your ide for all development purposes.