Wednesday, February 27, 2013

Use gvim efficiently-2

**) Open different files in same window with different tabs

Sometimes you write two or more filenames in front of gvim command  and find that those files are open but you have to writ :n or :N command each time you want to switch from one file to another.

In this case to can open different file in different tabs in same window by using the following command.
    gvim -p file1.sv file2.sv
and its done.

 **) adding same text in multiple lines using gvim

suppose one file having following text is edited in gvim.

   bit  var1 ;
   bit  var2 ;
   bit  var3 ;
   bit  var4 ;
you want to add [31:0] in front of variable name in each line. NO NEED TO ADD EACH AND EVERY LINE IF YOU ARE USING gvim.
jist press cntr+v  keeping courser  ant 4th place of 1st line. then reach to 4th line vertically. Now you have selected one-one place in each line. Press shift+i and write text [31:0]. Then press Esc. And you have done it. This is the most amazing feature of gvim I have found. I am sure you will like it.

**) Make some tedious editing easy using gvim

Suppose you want to repeat some editing  wile editing file. Your last editing step is always recorded in your gvim buffer.

add_              _data      ad_dr         aw_len
if you want add "gvim " at the places where _ is given.
--> press Esc and go to that place of edting. Press "i" to move into insert mode. Then type "gvim"  at that place than type Escp. Then goto "_" in second word. Then press "." and its done. As gvim stores last action and by press sing . it is repeated you do not need to write four times "gvim".



                                                      GO BACK TO INDEX

No comments:

Post a Comment