Download as rtf, pdf, or txt
Download as rtf, pdf, or txt
You are on page 1of 5

Vi

General Startup
=============
Open a file: vi filename
insert before cursor:-

To exit vi and save changes::wq


To exit vi without saving changes:
:q!
To enter vi command mode: [esc]
saves the current file without
quitting :w
Cusor Movement:
A
$

append at end of line


last Colum on the current

line
0
move cursor to the first
column on the
current line
w
move to the beginning of
the next word or
punctuation mark
b
move to the beginning of the
previous word
or punctuation mark
H
move cursor to the top of
the screen
M
move cursor to the middle
of the screen
L
move cursor to the bottom
of the screen
:$ move to last line of file

G move to the last line of file


gg move to the first line of file
:x go to line x [ex- :40]

^f

move forward one screen

^b

move backward one line

Copying Code
yy
copy line
p
paste the copied line
Find Commands
/string-you-wanna-seach
finds a word going forwards
n - find next matched

occurrence in forward direction


N - find next matched
occurrence in backward direction
u undo last command issued

Misc:
dw - delete immediate word
.
- repeat last command
Line Number:
:set number
VI EDITOR DEFAULT SETTINGS FILE:
===========
- Create a file called .vimrc in your
$USER_HOME.
- Each time you open a file in vim
editor, vim loads the short cuts that
you defined in your .vimrc. So you
dont need to set them up every

time.
set
set
set
set
set
set

number
hlsearch
incsearch
wildmode=longest,list
scrolloff=2
tabstop=4

GOOD ONLINE TUTORIALS:

===================
===
http://www.openvim.com/tutori
al.html

You might also like