Important Visuals Hacks in VIM

1. Numbering

VIM is not improved without custom configuration. It varies from a developer to developer but everyone will agree on having line-numbers.

set number

But do you know that you can move between lines by doing following:

: +2 ---> Two lines Below
: -2 ---> Two lines Above

Because of this and because of the fact that Y/D J/K all goes with numbers, you must be interested in showing numbers relative to the cursor.

set relativenumber
VIM Relative numbers!

2. Highlight Current Line and Column

If you are working in tabs/windows, it is a bit frustrating to mover your cursor every time just to find where are you typing! Following two lines will make your life a bit easier.

set cursorline        "highlight current line                                                                                                                            
set cursorcolumn      "highlight current column

3. Highlight Searches

Can you spot the difference between two searches? – Of course “set” is highlighted in the second screen. Here is how I did it:

set hlsearch
set incsearch

Worth Sharing?


Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>