About Me

My photo
Working as Technical Lead in CollabNET software private limited.
Showing posts with label vi. Show all posts
Showing posts with label vi. Show all posts

Wednesday, 8 October 2008

Visual block in VI

Do you need to perform multiple line edits at a single stretch.

I came across VISUAL BLOCK in vi editor.


   CTRL + v makes you to enter the visual mode for your file.
   select multiple lines
   SHIFT + i gives you the insert mode
   Enter the text at beginning of the block
   Press ESC twice to apply changes to all lines.



Blogged with the Flock Browser

Wednesday, 28 May 2008

Making your vi for default settings

If you want your vi editor to load with default settings (i.e) the line number to be displayed and also tabspace to set for 4 characters.

Here the way to do...

create a file ~/.exrc with settings

set nu
set tabstop=3

Then opening the vi will have these settings common for all.

Thursday, 27 March 2008

Mastering VI


D
To delete remaining characters under cursor in current line.
dd To delete entire line and copy to clipboard
$
Move the cursor to the end of the current line.
C-g To display filename and number of lines in end of the terminal
r To replace single character under cursor
R To replace multiple character under cursor untill escape is pressed
dw To replace a word under cursor

Wednesday, 20 February 2008

To open mutiple files in vi

vi -o file1 file2

To switch between splitted windows use

< ctrl >+ w

To Quit all qa!
To save all wa!
To save&quit wqa!