Super Spread Sheet S³

Or little computing tricks and hacks

Peculiarities in vi

I have been using the vi editor for some time now, and is still my favourite editor. emacs is very powerful, and it has a lot of tools but if you don’t need nor use those tools, well is like having a complicated gedit.

I really had a laugh when I started the tutorial “Learn Python the Hard Way”, and was told not to use vi because it is too complicated. If you are not good at the keyboard, as in you are far from touch-typing, it will take you a while to get around to it. But when you do, you can really fly. There is also gvim, a combination of GUI and vi.

Nevertheless, vi has some quirks that make me wonder…

Starting one of my tutorials (Ruby on Rails?), it suggested to the reader to adjust the settings of the editor to have some automatic indentation for nested blocks. In vi this was:

set expandtab
set shiftwidth=4
set ts=4
set autoindent

And this works wonderfully when coding. But when doing cut-and-paste, the results leave much to be desired. So each time I want to cut and paste I had to unset the last line. Initially I did it by commenting the line, that is adding a double-quote at the beginning of the line. But then I decided to do it within the editor.

My first guess was:

:unset autoindent

Makes sense right? Except that is not… The correct command is:

:set noautoindent

How unconventional is that!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: