Archive for the ‘vi / vim’ Category

Vim 7.0 Tabs

December 23, 2006

Vim 7.0 also adds another marvelous feature to this star-studded editor, Tab Browsing

To open a tab, just use the following command

tabe filename

This shall open a new tab.

Vim 7 Tab browsing

To move between tabs you can use tabNext and tabPrevious. Ctrl+PgUp and Ctrl+PgDown work as well in the X version as well as on gnome-terminal.

tabclose shall do the needful as the command states.


Vim 7 Autocomplete

December 21, 2006

Vim 7.0 was lauched sometime back, but I wasn’t able to check it, But its awesome. The Autocomplete or intellisense built is just too good. It supports various filetypes, it will complete the function as well as show a preview of what arguments are expected out of it.

First check if you have Vim 7 installed and in the VIM directory if you have a folder called autoload. If you have check if it contains *complete.vim files. If everything is Good… lets move…

Lets add PHP autocomplete feature. In your $HOME/.vimrc file add the following command

autocmd FileType php set omnifunc=phpcomplete#CompletePHP

Once done, Open any PHP file and within the <?php tag, write mysql_c and press Ctrl-x Ctrl-o , and here is what happens

Vim 7 PHP autocomplete

You can see a Full list of functions begining with mysql_c


Vim: File Browsing

August 23, 2006

Not all must have used this feature of Vim, You can use Vim’s file browsing feature, to select and open a file all you need to do is know a “vsp” command.

To the “vsp” or the Vertical Split command give argument as “.”, a period. Which will prompt Vim to open left bar that will list all directories and files, directories first, just like any directory listing command of your OS.

Vim file browsing


Vim: Auto Complete

May 4, 2006

Most of you programming freaks, like the Auto Complete idea of an IDE (using Ctrl+Space) to complete the word. And all the GUI IDE lovers think Vi is just another “Notepad”.

Beware, VIM is noway behind the IDEs, It too supports your Auto-Complete.
Ctrl+P (match previous tokens) or Ctrl+N (match tokens ahead/next) is an alternative to Ctrl+Space


Vim: Find Visual Difference using diffsplit

February 25, 2006

Many a times you want to compare two different files… Unless you have a good utility… you cant. But for Vim as its a wonderful tool, get a good visual difference.



Tidy-ing your XML, HTML

January 21, 2006

If you ever wonder how would you get your messy XML and HTML well-formatted, Here is the whizard, Tidy tidy is a small but very effective tool written by Dave Raggett.

Tidy can clean, indent XML and HTML data very effectively.

tidy -mi -xml file-name