Vin is the superseded text editor of VI, an historical utility of UNIX. It has been initially developed on the Amiga OS (the last offspring of Amiga?) and is now available in most of Linux distributions. If you are on this page you probably already know that. Vim has a steep learning curve. The first steps are not easy, but once you master a couple of commands, it is really handful and even powerful. You can do almost anything dealing with text file with it, and more specifically coding. You will find below my personal Vim cheat sheet.
Clik here to view.
![Yet another Vim cheat sheet [personal] Screenshot of a Python piece of code edited using VIM Yet another Vim cheat sheet [personal]](http://zombiebrainzjuice.cc/wp-content/uploads/2013/08/Screenshot-of-a-Python-piece-of-code-edited-using-VIM.png)
Screenshot of a Python piece of code edited using VIM
INSTALLATION
Vim can be customized at several levels, the first one being maintained in the ~/.vimrc
configuration file. I found the following customizing helpful:
set background=dark filetype indent plugin on
By default in Ubuntu, the syntax highlight is activated. By specifying that the background is dark, the Vim uses a dedicated set of colors. The second line tells to Vim to activated the indent plugin based on the type of edited files.
Python specific installation
This customizing is maintained in the file ~/.vim/ftplugin/python.vim
. According to the Pyhton wiki page for Vim (see link bellow, for all the details), I have used the following values for a perfect Pythonic layout:
set tabstop=8 set expandtab set shiftwidth=4 set softtabstop=4
NAVIGATION
Move down: j
Move up: k
Move right: m
Move left: h
Go to end of file: G
Go to head of file: gg
Go to end of line: $ (useful with very large lines)
1/2 page down: ctrl-d
1/2 page up: ctrl-u
EDITOR MODE
Editor mode and insert before: i
Editor mode and insert after: a (better than i + move right)
Go to the end of line and editor mode: A
Omni completion: C-x C-o
Exit editor mode: ESC
COMMAND MODE
Delete character: x
Delete line: dd
Undo: u
Select text: v + move cursor
Select lines: V + move cursor
Copy (after selection): y
Cut (or delete) (after selection) : d
Paste after the current position: p
Keep one window: :only (you may open several windows using the auto-completion)
RESSOURCES
- Pyhton Wiki, “Vim”, the dedicated page of the Python Wiki for Vim with a handful of advice
- Michael Jakl blog, “Vim Introduction and Tutorial”, a pretty nice Vim tutorial
- Vim Wikia, “Best Vim Tips”, check the easter egg chapter
Clik here to view.
![Yet another Vim cheat sheet [personal] An extended and graphical VIM cheat sheet 1024x696 Yet another Vim cheat sheet [personal]](http://zombiebrainzjuice.cc/wp-content/uploads/2013/08/An-extended-and-graphical-VIM-cheat-sheet-1024x696.png)
An extended and graphical VIM cheat sheet
Clik here to view.
![Yet another Vim cheat sheet [personal] The VIM logo in the style of its creation years Yet another Vim cheat sheet [personal]](http://zombiebrainzjuice.cc/wp-content/uploads/2013/08/The-VIM-logo-in-the-style-of-its-creation-years.png)
The VIM logo (in the style of its creation years)
The post Yet another Vim cheat sheet [personal] appeared first on Zombie Brainz' Juice.