Monday, 13 August 2018

vi/vim Text Editors

Vim is a highly configurable text editor built to enable efficient text editing.

The vi/vim editors are used in three modes:
1.Command Mode
2.Insert Mode
3.Ex-Mode

Command Mode: 
This mode is the default mode. Following things we can do in this mode.

yy (Yank/copy)

copying the single line.
  1. Press the ESC key to be sure you are in vi Command mode.
  2. Place the cursor on the line you wish to copy.
  3. Type yy to copy the line.
  4. Move the cursor to the place you wish to insert the copied line.
p Paste a content below the cursor
P Paste a content above the cursor
nyy

copying the multiple lines or n numbers of lines at a time.
For example, to copy 12 consecutive lines from one part of a file to another, follow these steps:
  1. Press the ESC key to be sure you are in vi Command mode.
  2. Place the cursor on the first line of the text you wish to copy.
  3. Type 12yy to copy the 12 lines.
  4. Move the cursor to the place where you wish to insert the copied lines. lines after the current line on which the cursor is resting or type P to insert the copied line before the current line.
dd Delete a single line
ndd Delete multiple line or n number of line at a time.
x Deleting a single character
dw Deleting a single word
. Redo
u Undo
j joining the line
r Replace the character
Arrow Key
h Left
j Down
k Up
l> Right
Ctrl+d
Scroll Down
Ctrl+u Scroll up        

Insert Mode:
This mode is used to insert the text into line


i Inserting the content before the cursor position
I Insert the character starting of the line
a Insert the character of the cursor append
A Append the character from end of the line
O Insert a new line above the cursor
o Insert a new line below the cursor
s Substitute the stream

EX-Mode:
Press Esc (Escape) key to enter the EX-Mode


:w save the modification
:q quit
:wq save & quit
:w! save forcefully
:q! quit forcefully
:set nu set the line number
:set nonu remove line number
:<number> it will goes to particular line
:r reading the another file from here
:!<command> command will be execute from here
:r!date output(date,date & time) will save in current file

1 comment:

  1. Procure microsoft office 2019 home & business, Step up with the new range of Microsoft Office, containing the 2019 versions of your favorite productivity software. Upgraded Word, Excel, PowerPoint and OneNote come with enhanced new time-saving features and a sleek, modern look.

    ReplyDelete

Create a New Virtual Machine

1.In the left pane, Click on the Hyper-V manager that you wish to host the new virtual machine. 2. In the right-hand Action pane, Click Ne...