How to Customize Your VIM From Zero to C/C++ (Ubuntu Cinnamon)
These procedures will also apply to other programming languages.
In these article we install plugins for:
- Autocomplete for C/C++
- Color Themes
- Autocomplete with Articial Intelligence and Machine Learning
- Powerline for Vim Airline
- Mappings
- Vim editor settings
- Snippets
- Fonts
- Language Server
- In addition to additional Tips
The procedures were performed on Ubuntu Cinnamon
All settings
01. Update your system
02. Install Vim, curl and Git
03. Install the Vim Plug
Add to
~/.vimrc
The plugin https://github.com/terroo/vim-simple-emoji will be used to test if everything is working.
Close ~/.vimrc
and open it again and then run:
Test to see if it’s working:
Type :smile:
and give space then, if the face appears: 😃 it’s because everything is right! Or run :ShowEmoji
.
04. Install fonts
05. Install a vim color theme
colorscheme pinkmare " OPTIONAL: hi! MatchParen cterm=NONE,bold gui=NONE,bold guibg=NONE guifg=#FFFF00
06. Additional and optional lines of my preference
07. Interesting mappings
08. Install YouCompleMe
- Install dependencies
- Add to your
.vimrc
:Plug 'ycm-core/YouCompleteMe'
- Complete the installation:
- Save this file: .ycm_extra_conf.py in
~/.vim/.ycm_extra_conf.py
- Add this for others libs:
vim ~/vim/.ycm_extra_conf.py
09. Settings to YouCompleteMe
I came testing.cpp
- By typing
#include <iostream>
and#include <vector>
it will autocomplete! If not, add this line to your~/.vimrc
- Removing the drop-down window when using the autocomplete, add this line:
- To disable write-time diagnostics:
Compiling:
:terminal
andg++ test.cpp
, to exit the terminal: exit.
10 Add Auto-pairs
11. Installing the ccls Language Server
Copy this code and paste into your ~/.vimrc
Note that when autocompleting now it automatically adds a header, if you don’t want that to happen, add this line to your
.vimrc
:let g:ycm_clangd_args=['--header-insertion=never']
12. Add UtilSnips and SuperTab
To work add this code:
Edit snippets in:
.vim/plugged/vim-snippets/UltiSnips/cpp.snippets
or.vim/plugged/vim-snippets/snippets/cpp.snippets
Bonus
- Add Vim Airline
- Install TabNine and make it compatible with YouCompleteMe
- Install Dracula Theme
Watch the video
If you want to see all the steps above on video I recommend watching the video below. However, the video is in Brazilian Portuguese, but you will be able to follow the commands and settings without any problems.
Comments