NOTA: utilizzare il tasto ESC senza paura
ricordarsi di premere ESC ad ogni chiusura di operazione di scrittura
operazione tipo comando note fine ins
inserimento char i inserisce dal carattere su cui e’ il cursore ESC *
char I inserisce dall’inizio della linea ESC *
line o inserisce una nuova linea al di sotto della corrente ESC *
line O inserisce una nuova linea al di sopra della corrente ESC *
cancellazione char x cancella il singolo carattere sotto il cursore
line dd cancella la linea corrente
char D cancella dal carattere sotto il cursore alla fine della linea
word dw cancella dal cursore fino alla fine della parola
sovrascrittura char r sovrascrive il singolo carattere sotto il cursore
line R sovrascrive a partire dalla linea corrente ESC *
word cw cambia dal cursore fino alla fine della parola ESC *
movimenti next-pg cntrl-F avanza di una pagina
prev-pg cntrl-B ritorna indietro di una pagina
finefile G va alla fine del file
iniziofile 1G vai alla prima linea del file
linea G vai alla del file
varie Cntr-g display nome, n.linee,...
linee :set number mostra le linee del file
uscita salvando :wq
abort :q
Vi commands
... means that something needs to be specified before or after the command, as appropriate.
This is normally a cursor movement keys (h,j,k,l,w,b, etc.) or a line number.
# (where # is a number) following command n times...
: go to ex-mode
) next sentence
( previous sentence
} next paragraph
{ previous paragraph
]] next section
[[ previous section
0 beginning of line
$ end of line
^ first non-whitespace character
+ first character of next line
- first character of previous line
(spacebar) next character
(return) next line
/ search forward
? search backward
% find match of current parenthesis, brace, or bracket
, reverse direction of last f, F, t, or T
; repeat last f, F, t, or T
. repeat last command
` goto mark
' goto beginning of line with mark
`` return to previous mark or location before a search
'' go to start of line of previous mark or location before search
~ switch case of current character
" store in register
!! repeat last shell command
! send next to command, replace output (eg !}fmt passes the current
paragraph to the command fmt, and replaces the output with
whatever fmt returns.)
>> shift paragraph one shiftwidth to the right
<< shift paragraph one shiftwidth to the left
>% shift until matching (, [, or { to the right
<% shift until matching (, [, or { to the left
a append after the current location
A append at the end of the line
^a unused
b beginning of previous word
B beginning of previous word, ignore punctuation
^b scroll back one screen
c change until...
C change to end of line
^c ends insert mode, unused in command mode
d delete until...
D delete to end of line
^d scroll down half a window, moves to previous shiftwidth in insert
mode
e end of word
E end of word, ignore punctuation
^e scroll screen down one line
f find...
F find backward...
^f scroll forward one screen
g unused
G ...Goto [defaults to end of file]
^g show status line
h left
H first line on screen
^h backspace in insert mode, left in command mode
i insert before current location
I insert before first non-whitespace character on line
^i tab in insert, unused in command
j down
J join next line with current line
^j down in command, create newline in insert
k up
K unused
^k unused
l right
L last line on screen
^l redraw screen
m mark position into register
M middle of screen
^m carriage return
n repeat last search
N repeat last search, reverse direction
^n down in command
o open line below current
O open line above current
^o unused
p put below current line
P put above current line
^p up in command
q unused
Q quit and run ex
^q unused
r replace current character
R replace characters until insert mode is left
^r redraw screen in command mode
s substitute
S substitute entire line
^s unused
t to...
T backward to...
^t moves to next shiftwidth.
u undo last change
U undo changes to current line
^u scroll up half a window
v unused
V unused
^v unused
w beginning of next word
W beginning of next word, ignore punctuation
^w unused in command, in insert move back to beginning of previous
word
x delete current character
X delete previous character
^x unused
y yank...
Y yank current line
^y scroll screen up one line
z reposition screen around line (Return to top of screen, . to
middle, - to bottom)
ZZ write and quit
^z unused
Command mode input options ( : commands)
(Note: this is not a canonical list, just some of the more important ones.)
:r read into current text
:r ! read output from command into current text
:nr read in at line number
:! run command, return
:sh goto shell
:so read and execute commands from
:x write and quit
:wq write and quit
:l1,l2w write between lines l1 and l2 to . If
is not specified, assume current. If l1,l2 not
specified, assume entire file (making it :w)
:w >&g;t append to . May use line numbers
:w! overwrite current file
:q quit
:q! quit, forget changes
:e edit without leaving vi
:e! forget changes since last write
:n edit next file
:e +n edit at line n, if no end, assume end of file
:n specify as new list of files to edit
:e# edit alternate file (if :e is used, alternate is
the original file)
:args show files to be edited
:rew rewind life of files to top
:map m n create a macro (make m do n)
:map! m n create an insert mode macro (make m do n)
:unmap m destroy macro m
:unmap! m destroy insert mode macro m
:ab <1> <2> abbreviate - replace <1> with <2> whenever typed as
a word
:unab <1> unabbreviate <1>
:set
Set Options
The abbreviations in parenthesis may be used. Syntax:
:set