Command Line

Aside from using Rubymine and occasionally using a bunch of GUI editors, I enjoy the occasional geeking with Vim, a text editor written by Bram Moolenaar, as my command line editor of choice.

It is probably one of the most popular editors of our times and will continue to be, most probably because of the fact that it is cross platform and has been pre-installed in a lot of unix systems. Not only does it make you look cool, not using a mouse, it boasts having to help you become more productive.

Vim commands basically removes the need to hold a mouse, everything is at your fingertips, literally. Moving your cursor through a document requires the use of 4 basic keys, j for down, k for up, h for left and l for right.

How cool is that!?

Now here a few VIM commands that will make you a VIM expert in no time:

Command Description
:e Open a file
:w Save a file
:q Close a file
:qa Close all files
:wqa Save and Close all files
Command Description
Ctrl+v Block Selection
gg Go to first line
Shift+g Go to last line
o Go to next line and start editing
Shift+o Go to previous line and start editing
Shift+v Highlight current line
Shift+v Shift+g Highlight current line until end of file
Shift+^ Go to to the beginning of the line
Shift+$ Go to the end of the line
Search and Replace
Command Description
/keyword Search from top to bottom
?keyword Search from bottom to top
%s/old/new/g Search and replace old with new on current document
Working with multiple files
Command Description
:split filename Split window and open file in new split
:vsplit filename Split window vertically and open file in new split
:vs filename Split window vertically and open file in new split
ctrl-w ctrl-w Go to next window
Command Description
gg Shift+v Shift+g Highlight the whole file
Ctrl+v Block Selection

Most of this commands I have learned working on web applications. It has made me faster for most tasks that needed text manipulation. I learned to love it. Trust me. After a few days or months on Vim, you’ll seem to hate all GUI editors.