Vi editor and its usage

:q
quits
:q!
forces to quit without saving 
:w
save
h
left
k
up
j
down
l
right
$
move to the end of the line
0
move to the beginning of the line
Ctrl+f
shows next screendisplay
Ctrl+b
shows the screendisplay before
Ctrl+u
show screen half way up
Ctrl+d
show screen half way down
w
move forward one word
b
move backward one word 
O
open a new line over the one you are at
o
open a new line under the one you are at  
:!command
quickly use unix commands while staying in vi.
!!command
outputs the command inside of vi to current line.
!}command
takes the input from the lines and output to given command
!}fmt
reformats the text
G
goes to the last line
3G
goes to line number 3
vi +17
starts vi from line number 17
vi +/name
starts vi from first found word name
:s/old/new
changes old with new
:s/old/new/g
changes every old with new on the same line
:1,$ s/old/new/g
changes all old in every line with new
!G
uses the given command for all lines (mut place the marker on 1st line)
Ctrl+g
shows the current line number and other info
:/
searches string forward (n repeats search)
:?
searches string backward (SHIFT-n repeats search in oppersite direction)

No comments:

Post a Comment