Monday, May 26, 2008

Search and delete lines in vim

vim is great editor but one must remember some commands. Sometimes we want to delete line as per the search criteria. vim is capable of that also. To delete the lines as per search use

:g/editor choice/d

This will delete all the lines that have the word "editor choice". Offcourse we can use regular expression too.

:g/regex/d

Pretty simple g tells to do thing globally. / for pattern enclosing . d for deleting.

Enjoy vim :)

Monday, April 28, 2008

Setting port forwarding for Torrent Client

Port forwarding is required for getting good download speed from torrent. To make sure port forwarding is ok with your torrent client find Test if port forwarded properly option in u r torrent client. Normally its under the speed test / speed guide.

If it is configured it says ok else say some error. In Azures client is shows in the status bar whether NAT is ok or fire walled.

Lets see how we can configure port forwarding. If u are using BSNL or any other connection open you configuration page.

1. Type 192.168.1.1 in address bar of your browser which take you to your configuration page which look like

















2. Go in to Advance option -> NAT

3. Click on Add. Give custom name say torrent

4. Give your server ip address (192.168.1.1)

5. In the port start and end column enter the port you find in speed guide of your torrent client. Save it

6. Reboot your modem and torrent client.

7. Speed test will be success on port and NAT will show ok in status bar.

Enjoy downloading torrent with good speed

Friday, April 25, 2008

Giving power to vim - 2

vim one of powerful editor in linux. Here are few tips to make it more powerful

1. Setting auto completion
autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
autocmd FileType php set omnifunc=phpcomplete#CompletePHP
autocmd FileType c set omnifunc=ccomplete#Complete

Tuesday, April 22, 2008

Giving power to vim - 1

To use vim efficiently and effectively we need to do some settings.

Open vimrc file. Its normally under HOME directory and hidden. On ubuntu
gedit ~/.vimrc will open it in gedit .

Add Following in to it:

1. Keeping History : Vim only remembers the last 20 commands and search patterns entered.
set history 1000

2. To show line numbers : set nu

3. To show syntax highlighting : set syntax on

4. To show menu with possible tab completions : set
wildmenu

5. To set background : set background=dark

6. To set terminal title to filename : set title

Sunday, April 13, 2008

Installing / adding fonts in ubuntu

Ubuntu comes with variety of fonts. But if we still have an urge for installing some extra fonts from windows or some other fonts how we do it. To add the fonts in ubuntu is very easy and can be done in few steps.

Fonts normally get installed in /usr/share/fonts/truetype. Simple way of adding font is to make one folder in said path and copy the font files in it. To open this folder with root access type sudo nautalius. This will open the file explorer in root mode.

The other way is to add the fonts in /home//.fonts

To refresh or update font cache run sudo fc-cache -f -v.
There was an error in this gadget