VIM is very useful feature reach development environment. Its look & feel is beet different than other well known IDE. This difference is VIM power – it is extremely fast, has syntax highlighting, auto indent, bracket matching, code folding, etc.
VIM can work as the fastest professional development environment but requires from user change some of his habits. For the convenience of working with VIM you will need few free lessons (from vimtutor) a bit time and tips from this blog. After all you will work the most efficiently with the VIM, faster than in any other editor.
[ad#Inside post ad]
As I wrote earlier at first you should learn a few lessons which includes tutorial. You will easily work with VIM after that. To take the tutorial, run following commands.
The basic version of Vim is not suitable for work as an IDE. Comfortable work with it will be possible after adding a few plugins and set the appropriate options.
I have installed some plug-ins and keyboard shortcuts on my
.vimrc file. I am using these settings later in this article. To install them run in console:
tar -xvzf vim-custom.tgz -C ~
Keyboard shortcuts info
In this post I am using the following notation of keyboard shortcuts:
c-x means that you must press both “Ctrl” and “x”
c-x c-o means that you must press both “Ctrl” and “x”, release them and press both “Ctrl” and “o”
My VIM settings and plugins
There are some interesting features in my .vimrc file:
esc ccapitalize current word
esc llowercase current word
esc uuppercase current word
- Word completion on
- Duplicate line
- Show file tree
- Change file encoding to ISO-8859-2 (without converting)
- Change file encoding to UTF-8 (without converting)
- Paste text from buffer without broken indent:
f11 shift-insert f11
Tabs, windows, screens
Keyboard shortcuts related to manipulate window, tabs and screens:
Jump between tabs
List opened tabs along with windows/buffers they contain
Close the active tab
Split screen horizontally
Split screen vertically
Jump between screens:
Completion of function names:
If you have several words you would like to complete, you can use
c-x c-p to extend the match.
Move to the declaration of functions / classes
To enable move to the declaration of functions / classes feature you must install
exuberant-ctags package and generate tags database.
To generate tags database (and save it in
.vimtags file) you can run below script (example for Symfony Framework):
# Check if is root
if [ ! -f 'symfony' ]
echo "Please run script from project root dir"
# Get working dir
if [ ! -d $MYDIR ]; then MYDIR=`dirname "$PWD/$0"`; fi
exec ctags-exuberant -f .vimtags \
-h ".php" -R \
--regex-PHP='/abstract class ([^ ]*)/\1/c/' \
--regex-PHP='/interface ([^ ]*)/\1/c/' \
--regex-PHP='/(public |static |abstract |protected |private )+function ([^ (]*)/\2/f/'
After run above script you will get
.vimtags file, which is loaded to VIM when it is run in main Symony directory.
You can load external tags file with command:
Move to the declaration:
Return to last edited file / place:
Open declaration as new screen:
Open/close list of current file functions:
Open/close file list:
Open directory/file: select directory/file and press
Open as new tab: select it and press
Open as new screen: select it and press
Version Controlling System – SVN
Before running any command from VCS you should write a file (
Other VCS commands:
do – Get changes from other window into the current window.
dp – Put the changes from current window into the other window.
]c – Jump to the next change.
[c – Jump to the previous change.
c-w c-w – Switch to the other split window.
Fast close file
- Cheatsheet & lesson
- VIM cheat sheet
- Advanced VIM Tutorial (PDF file)
- A visual walk through of a couple of the new features in Vim 7.0