Linux or UNIX : vi editor command

No comments
GNU/Linux Documentation - Vi command mode instructions

                          ^ = Control key
                          10 can be replaced by any number
Many commands can use a number prefix in this way, only examples are listed.

Operation                                                                                                Keys
Return to Command mode from Insert, overwrite or append mode Escape
Enter Insert mode i
Enter overwRite mode R
Enter append mode a
Enter append mode at end of this line A
Enter Insert mode on a new line after this o
Enter Insert mode on a new line before this O
Delete this word and enter Insert mode here cw
Delete this line and enter Insert mode here cc
Delete the next 10 lines and enter Insert mode here 10cc
Move cursor left one character left arrow or h
Move cursor left e.g. 10 characters 10h
Move cursor down one line down arrow or j
Move cursor down 10 lines 10j
Move cursor up one line up arrow or k
Move cursor right one character right arrow or l
Save this file and continue :w
Save this file and exit :wq
Abort without saving changes to this file :q!
Quit (no changes made) :q
Save as a new file "new-file" :w new-file
Load the file "myfile" into vi :e myfile
Delete the character under the cursor x or Del
Delete the current word (inc. space) dw
Delete the next 10 words 10dw
Delete the current line dd
Delete the next 10 lines 10dd
Delete rest of this line, right of the cursor d$
Yank the current line onto the clipboard yy
Yank the current word onto the clipboard yw
Paste the clipboard p
Undo u
Redo ^r
Jump to the bottom of the file G
Jump to e.g. the tenth line of the file 10G
Jump to the top of the file gg
Jump one page forward ^f
Jump half a page forward ^u
Jump one page back ^b
Jump half a page back ^d
Search for text from cursor /text
Find next occurrence of text n
Find previous occurrence of text N
Start of next word w
End of next word e
Start of the tenth word forward 10w
Start of next sentence )
Start of previous sentence (
Start of line 0 (zero)
End of line $
Top of screen H
Bottom of screen L
Middle of screen M

No comments :

Post a Comment