junio 03, 2008

Referencia Rápida Vi

Buscando un dato particular de vi (como borrar desde un punto determinado hasta el final del archivo), me topé con esta Guía de Referencia Rápida para uno de los editores mas utilizados en el mundo Unix (tranquilos los fans de emacs :P), me pareció interesante reproducirla aquí, el URL es:


http://goanna.cs.rmit.edu.au/~saied/Downloads/Basics/Basics.vi.pdf

Quick Reference: vi-based editors

S.Tahaghoghi, July 2000

Misc:

:r File_F read File_F

:w File_F write File_F

:wq exit with save

:q! exit without save

Cursor movement:

h/¬ left

l/® right

k/­ up

j/¯ down

B/b back one word

W/w forward one word

E/e forward to end of next word

(/) back/forward one sentence

{/} back/forward one paragraph

0/$ beginning/end of line

-/¿ beginning of previous/next line

[CTRL]-d down one page

[CTRL]-u up one page

H Home line of page

M Middle line of page

L Lowest line of page

Line_LG Go to line Line_L (if Line_L not specified, go to end of file)

Editing:

v mark (in vim)

Esc switch to command mode

I/i insert before first non-blank character on line / before cursor

A/a append at end of line/after cursor

O/o open a line above/below current line

R/r replace current character/until Escape

C/c change to end of line/specified point

D/d delete to end of line/specified point

X/x delete character to left/right

S/s substitute line / characters

Y/y yank to end of line/specified point

P/p paste before/after cursor position

~ toggle case

J join lines

gq justify lines

U/u undo last change / all changes to line

[CTRL]-r redo

. repeat last command

cM change M (e.g. cw = change word)

ncc change (n) line(s)

dM delete M

ndd delete (n) line(s)

yM yank M

nyy yank (n) line(s)

Examples:

d'r delete till r

d0 delete till beginning of line

d) delete till end of sentence

dL delete till last line on screen

dG delete till end of file

d1G delete till beginning of file

Search and Replace:

/ search forward

? search backward

n/N repeat search forward/backward

:[address]s/search-string/replace-string[/g]

Search

and replace (/g does globally)

Special characters:

^ begining of line

$ end of line

. any character

\< beginning of word

\> end of word

% whole file

[CTRL]-V next character is literal (e.g. Ctrl+V ¿ = ^M)

1 comentario:

Ricardo Pel dijo...

Gracias por compartirlo. Volveré a intentar Vi con esta guía impresa. El PDF no está más, si te quedó una copia, ¿la subís?