La Boina Roja

Linux, the struggles are real!


Leave a comment

vi, lessons learned so far

Let me start with, I fell completely in love with viPhotobucket! After using it more then a week I can tell, it loads incredibly fast, you only need to know the most basic of commands to make the mouse completely obsolete and if you can type with 10 fingers blind, you’ll work like lightening. If  you are not recovering from a broken wrist that isPhotobucket

Something I can’t relate to though, is the so called steep learning curve.  I don’t see what there is so  steep about itPhotobucket Within a day I got used to the 2 modes and I learned the basic commands by heart. Plus, I’m adding new commands to my repertoire each day.  I wonder if this has something to do with the fact that  I am learning to program while learning vi, or that I am just highly intelligentPhotobucket

The main reason why I started learning vi; is that when learning Linux it’s highly recommended to learn it. You see vi, is always available on every *nix system, and it can be  your life boat when the GUI or the X configuration breaks.

Being the aspiring l337 h4x0r I am Photobucket I of course only use vim-minimal. These days *nix systems come shipped with vim-minimal which is the same as vi.


Yes the minimal indicates that you can add extra modules, to make life easier. Vim is based on vi, everything that’s possible in vi is possible in Vim, but it doesn’t work the other way round! Keep that in mind when installing those extra modules. The more Vim-modules you’ll install the farther you’ll get from vi!


Leave a comment

Basic vi commands

Right now, I am Learning Python the Hard Way,  after lesson 10, I decided screw gedit Photobucket
I am going to learn vi. Vi is known to have a steep learning curve, but  these basic commands are enough to help you to get through Learning Python the Hard Way.

The good thing about this course is you start with rather small code, not much then 10 lines in the first couple of lessons.  This makes it perfect to get a more then decent grip on vi,  knowledge of the basic workings of the Terminal is assumed though!

If you want to see some vids about vi first,  then I would suggest watching the Lullabot vids called Command Line Basics, at vid 9 she discusses vi. The whole series is worth watching though Photobucket

This cheat sheet is based on this vi command summary, I added one help full Python command Photobucket

Starting vi

Command Description
vi file start at line 1 of file
vi +n file start at line n of file
vi + file start at last line of file
vi -r file recover file after a system crash

Saving files and quitting vi

Command Description
:q quit vi
:”x” save the file if it has changed and quit vi (don’t use the quotation marks around the x!)
:”q”! quit vi without saving changes(don’t use the quotation marks around the q!)

Setting line numbers

Keys pressed Effect
:set number displays line numbers
:set no number remove line numbers

Moving the cursor

Keys pressed Effect
h left one character
l right one character
k up one line
j down one line
b left one word
w right one word
( start of sentence
) end of sentence
{ start of paragraph
} end of paragraph
1G top of file
nG line n
G end of file

Inserting text

Keys pressed Text inserted
a after the cursor
i before the cursor

Deleting text

Keys pressed Text deleted
x character under cursor
dd current line

CTR + z stops a Python script

Want a pdf file of this cheat sheet? Cliccie on the pinkPhotobucketbutton!