Archive for the ‘vim’ Category

typing tutor for linux

Saturday, May 20th, 2006

Features -
1. A split interface with text paragraph shown in upper view, and a typing interface in lower view.
2. The current line the user is typing is highlighted with different color.
3. Any error made in typing is highlighted with another color.
4. Can save the current typing session and load it again.
5. Can specify the source text as a file.
6. And all of this in real editor like environment.

If these features are good enough to call something a typing tutor.. then i am talking about something that was there all along and we didnt realize. The vimdiff ( aka vim -d ).

vimdiff.typingtutor

Steps :
- get a input/source text. say its in file input.txt
- start vimdiff with following command
vimdiff -o input.txt /tmp/temp.txt \
“+exe 2 \”wincmd w\”" “+normal 1000i ” \
“+diffupdate” “+go 1″ “+startinsert”

( Don’t worry about the long argument list. They are used to customize the starting point. Otherwise just the command vimdiff input.txt /tmp/temp.txt is enough.)

A few other setting might make it a better experiance -
- :set wrap
- :set diffopt=filler,iwhite,icase
— iwhite for ignoring amount of white spaces
— icase for ignoring case senstivity
- :set scrollbind
- omit the -o option for vertical split
- :diffupdate to sync the two windows forcefully

enjoy vimtt !!

Related : Advanced Vim Tutorial

Advanced Vim Tutorial

Wednesday, March 29th, 2006

Vim is not just an editor. It can be an IDE if used at its best. I have found it more convenient to use than any other word processing tool i have used. With proper knowledge of the countless features provided by vim, one can be much more efficient in whatever editing job, and programming in my case.

Every time i wished for a feature, i found it there in vim. I didnt allow myself to do anything the stupid way, and always figured out a better way to do the same thing. Thats how i have got a decent expertise on vim. With this tutorial i wish to give you a feel of what all is possible with vim, and show you a direction to learn more.

Before i proceed, i would like to ask you a question. Suppose you have got a file with about 50 lines only, and you have to make few changes to the file. Lets assume that you are asked to add 10 to every number present in the file. Lets assume that there are only 25 numbers in the file and rest is text. Would you start doing it the stupid way or search for a efficient way to do it ?
Most of the times one will think that its just 25 numbers, and without thinking about a better way to do it, he just starts doing it right away. Or even if one does want to do it a better way he doesnt do it thinking that figuring out the better way will take much more time than doing it the ‘obvious way’. But what we always ignore is that its not just this time. We do it many times, and thats why it makes sense to go for the better way to do it, even if it takes more time at first time.

So next time when the thought “its just this much” comes to your mind, just remember that “its not just this time” , and the choice is yours.

If we go by Brook’s words “The tool that save the most labor in a programming project is probably a text-editing system” [The Mythical Man-Month, proposition 12.10], then we should probably work on our editing skills more than our programming skills.

In this tutorial I assume the reader to have a basic knowledge of vim. Basic features like editing, movement, searching, replacing, opening, saving etc not covered in this tutorial. I’d recommend going through vimtutor for basic understanding of vim.

Lets start.

Link to the tutorial (pdf)

“if its just this much, its not just this time”


This tutorial was prepared for my guest tutorial on March 28, 2006 for ug1 batch.
Updated May 12th, 2006 with features of vim 7.0 ( Tabs, Undo Branching and Spell Checking).

Thanks to Paresh Jain for helping me with LaTeX. Otherwise it wouldnt have been possible to write it using vim and I wasnt doing fair to it by writing it in anything else.

related -
* vim recording