Vim text editor

Vim (Vi Improved) is a powerfull text/code editor. Carefull, it’s not a classic text editor, you’ll need to learn how to use it.


# Installation

sudo apt-get install vim
nano ~/.vimrc

The .vimrc file is loaded at Vim start and will load personnal configuration.

# Configuration

  • To add line number edit .vimrc:
set number
highlight LineNr term=bold cterm=NONE ctermfg=DarkGrey ctermbg=Black gui=NONE guifg=DarkGrey guibg=NONE
  • To manage several settings files: add the following to your .vimrc header. You will be able to use any ~/.vim/config/settings.vim file to store the configuration:
runtime! config/**/*.vim**

# Keyboard

Look at the wiki and learn the main shortcuts:

i           : insert mode
<Esc>       : Escape from insert mode so you can navigate
h j k l     : move cursor ( h: ←  j: ↓  k: ↑  l: → )
A           : Append at end of line
o           : Insert at new line below
u           : undo last command, again and again
x           : delete character under cursor
dw          : delete everything from the cursor to the start of next word
dd          : delete line (and put it into the default register)
p           : paste the default register
/myname     : search forward for myname
v           : visual mode -- use to select text with cursor
y           : use to yank (copy) what was selected
:w :x       : write / write and quit
:w filename : write a copy of the file you are editing as filename
:q!         : quit without saving even if changes were made!
<Tab>       : use tab completion

# Plugins manager

Vim has lots of plugins and plugin managers. We’ll chose Vundle. Create a ~/.vim/ folder, move .vimrc inside and create a symlink in ~:

mkdir -p .vim/{autoload,colors,syntax,plugin,spell,config}
mv .vimrc .vim/vimrc
ln -s .vim/vimrc .vimrc

Then install Vundle from its Github:

 git clone ~/.vim/bundle/vundle

Add to .vimrc the lines needed (see the Readme

# Plugins

  • Vim-airline (enhanced statusbar). Just add to .vimrc the github line and run in vim ‘:BundleInstall’
Bundle 'bling/vim-airline'

Chose a theme by adding: let g:airline_theme=’name’

  • CtrlP (quick file searcher/opener)
Bundle 'kien/ctrlp.vim'
  • NERDTree (panel file manager)
 Bundle 'scrooloose/nerdtree'

Then run in vim :NERDTree /home/usr/

You’re set! 

  • :BundleList will lits all your bundles
  • :BundleInstall will install or update bundles added to .vimrc

Comments are closed.

Blog at

Up ↑