Sie sind auf Seite 1von 8

1

1
Editors

Editors are used for inserting or deleting text.


Windows : Notepad
DOS : Edit
Linux/Unix
CLI based : EX , ED , VI
GUI based : Emacs, Gedit, nedit, nano, pico

2
VI Editor modes

There are three modes of operations in VI Editor :


Insert Mode
Command Mode
Execute Mode

3
VI Editor - Modes

Press
Press
Press i,i,II a,
a,A,
A,o,o,O
O
Press or
Shift
Shift++:: orINSERT
INSERT
to to
to enter
enter intointo the
the
to go
go into
into execute
execute Command Mode
insert
mode
mode insert mode from
mode from
command
commandmode mode

Press Press
Press
Press ESCAPE
You can ESCAPE ESCAPE
ESCAPEto come out from
Youto
Executecansave
save
Mode to
Insert
Insertyour
come out Insert
from your
Mode
to come
yourtext come
here
out from
outthe
from text
yourtext
the here mode
insert thetoexcute
excute mode
mode texthere
here
the insert mode
to to
command
commandmodemodetocommand
commandmodemode

4
How to get into Insert Mode

i - inserts the text at current cursor position


I - inserts the text at beginning of line
a - appends the text after current cursor position
A - appends the text at end of line
o - inserts a line below current cursor position
O - inserts a line above current cursor position
r - replace a single char at current cursor position

5
At Execute Mode

:q - quit without saving


:q! - quit forcefully without saving
:w - save
:wq - save & quit
:wq! - save & quit forcefully
:x - save & quit
Shift+ZZ - save & quit
:sh - Provides temporary shell

6
At Execute Mode

:set number - Setting line numbers


:se nu - Setting line numbers
:set nonumber - Removing line numbers
:se nonu - Removing line numbers
:84 - Press enter goes to line 84

7
Delete/Copy/Paste/Undo in command mode

dd - Deletes a line
2dd - Deletes 2 lines
yy - Copy a line
2yy - Copies 2 lines
p - After deleting or copying, by pressing
the deleted or copied contents will
be pasted below the position of cursor.
u - Undo (can undo 1000 times)
Ctrl+r - Redo
G - Moves cursor to last line of file
5G - Moves cursor to 5th line of file
8

Das könnte Ihnen auch gefallen