Documentation support in Vim

Vim is a cool editor for Linux. I will now show you how to create a html documentation of your source code using vim.

The following tip has been suggested in  ILUGC mailing list.

1. Open the source code file using vim. I am using a tcl script file named sample.tcl

$ vim sample.tcl

2. In command mode type the following

:TOhtml

A new buffer will be opened with the html source

Just save and quit

:wq

3. You will find a new html file with the same name of the source code file in the directory where you the latter (in this case it is sample.html)

This is the documented code.

Have a look at it!

To add salt to the delicacy try out the following procedure before you try out the above tip…

Before performing the above conversion, running the following commands in command mode would produce an html file with a black background and lines numbered.

:sy on

:se nu

:se background=dark

Here is how it looks!!

 

 

 

Manipulating the time-out during XP-Ubuntu dual boot

Tips

Do you want to increase or decrease the Grub loader time-out during an XP-Ubuntu Os selection in a  dual boot ?
The method is simple and straight forward .

xp_ubuntu dual boot

Just open the Terminal / Console ( Application –> Accessories –> Terminal)

Type the following and hit <enter>
$ sudo vim /boot/grub/menu.lst

You will be prompted to enter the password . Go ahead and enter your password and hit < enter > .
What you have actually done is to open the menu.lst file as a root user ,using an editor like vim .
You can also use an editor of your choice , say kate or leafpad.
In this case you should type

$ sudo kate  /boot/grub/menu.lst
or
$ sudo leafpad /boot/grub/menu.lst

In menu.lst file , search for the word “timeout” .It would be set to the default value 10 , like the following :
## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).

timeout         10

Now change the time-out value to 60 and thus it should look like
## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).

timeout         60

Thats all !

if you have used vim or vi editor for viewing the menu.lst file , then press <esc> then type :wq and then hit <enter>. Thus you have saved and quit the editor . If you use leafpad or kate , justsaveit and quit .

All done !
Reboot and feel the difference !
Happy ubuntuing 🙂

Article updates:

You may be wondering that menu.lst is not found in karmic koala(ubuntu 9.10). Thats because Ubuntu 9.10 has moved on from Grub legacy to Grub2 (or grub-pc as the package is called). Editing menu.lst is a thing of the past. Grub2 uses grub.cfg which is automatically generated from script. DO NOT EDIT  /boot/grub/grub.cfg. Instead edit the timeout or default OS to boot in /etc/default/grub. Changes made in this file will be imported into grub.cfg when “update-grub” is executed.

so in short, ubuntu 9.10 users should the following commands (in order):

$ sudo vim /etc/default/grub

make edits then run the following command

$ sudo update-grub

more details could be found here.