My personal guidelines, and only added shortcuts tested by myself.
e
Move to the end of a word.w
Move forward to the beginning of a word.3w
Move forward three words.W
Move forward a WORD (any non-whitespace characters).b
Move backward to the beginning of a word.3b
Move backward three words.$
Move to the end of the line.0
Move to the beginning of the line.^
Move to the first non-blank character of the line.)
Jump forward one sentence.(
Jump backward one sentence.}
Jump forward one paragraph.{
Jump backward one paragraph.j
Jump forward one line.10j
Jump forward 10 linesk
Jump backward one line.10k
Jump backward 10 lines.H
Jump to the top of the screen.M
Jump to the middle of the screen.L
Jump to the bottom of the screen.10<PageUp>
or10<CTRL-B>
Move 10 pages up.5<PageDown>
or5<CTRL-F>
Move 5 pages down.G
Jump to end of file.g
Jump x screen lines in direction (up,down,left,right) - useful for moving through a long, wrapped line of text.1G
Jump to beginning of file (same as gg).50G
Jump to line 50.'x
Jump to the beginning of the line of mark x.\
x` Jump to the cursor position of mark x.''
Return to the line where the cursor was before the latest jump. (Two single quotes.)\
`` Return to the cursor position before the latest jump (undo the jump). (Two back ticks. This is above the Tab key on some keyboards.)'.
Jump to the last-changed line.%
Jump to corresponding item, e.g. from an open brace to its matching closing brace. See Moving to matching braces for more.|
Jump to the 1st column of the current line.42|
Jump to the 42nd column of the current line.g;
Jump to the place of last edit. Can be quite helpful while debugging or editing files.CTRL
+f
Jump to forward page.CTRL
+b
Jump to backward page.f<character>
Move cursor on the next character ex:
and,F<character>
for the previous one.
- Delete backward word: db
- Delete forward word: dw
- Delete in this point until end: d$
- Delete in this point until start: d0
- Elimina hacia atrás del cursor hasta delante del caracter X, la T representa (backward = hacia atrás): dT=
- Elimina hacia adelante del cursor hasta atrás del caracter X, la t representa (forward = adelante): dt=
- Elimina hacia atrás del cursor hasta el caracter X, la F representa (backward = hacia atrás): dF=
- Elimina hacia adelante del cursor hasta el caracter X, la f representa (forward = adelante): df=
- Eliminar una palabra: daw
- Eliminar una palabra y poner pone en modo inserción: caw
- Delete forward character: x
- Delete backward character: X
- Delete line: dd
- Insertar texto: i
- Insertar texto al final: a
- Remplazar caracter: r
- Copiar un caracter: y
- Copia una linea: yy
- Copiar lo seleccionado: y
- Pegar: p
- Deshacer: u
- Rehacer: Ctrl + R
- Regresar a la ultima linea modificada: U
- Añade una nueva linea en blanco, bajo la línea actual: o
- Añade una nueva linea en blanco, sobre la línea actual: O
- Mueve el texto a la derecha: Shift + >
- Mueve el texto a la izquierda: <
- Podemos repetir estos coamdnos usando el
- Mueve una linea: :m (row num)
- Mueve el cursor al final de la linea listo para editar: A
- Mueve el cursor al inicio de la linea listo para editar: I
- ~ Toggle case of current character
- gUw Uppercase until end of word (u for lower, ~ to toggle)
- gUiw Uppercase entire word (u for lower, ~ to toggle)
- gUU Uppercase entire line
- gu$ Lowercase until the end of the line
- da" Delete the next double-quoted string
- S Delete current line and go into insert mode
- I insert at the beginning of the line
Press Ctrl+v to enter Visual Block mode
Use arrow keys to select the ; characters you want to delete (or the other "first few characters") , press ESC to apply changes.
To insert, press Shift+I to enter in edir mode. To delete all lines selected, press x. To apply changes, press ESC.
- ci" - Change what’s inside the next double-quoted string
- ciw - Change inside a word
- ci( - Change inside parentheses
- ca{ - Change inside the curly braces (try [, (, etc.)
- dit - Delete inside an HTML tag, etc.
?text
Find this text into file.n
Repeat the find.:noh
Clear the find.%s/\"old\"/\"new\"/g
Find and replace.
- Lista los buffers: :ls
- Cierra el buffer: :bd
- Cambia de buffer: :b #
- Divide la ventana de forma horizontal: Ctrl + w s
- Divide la ventana de forma vertical: Ctrl + w v
- Crea una nueva ventana: Ctrl + w n
- Cierra un tab actual: Ctrl + w c
- Cierra la ventana actual: Ctrl + w q
- Ir a la siguiente ventana: Ctrl + w w
- Abrir un nuevo fichero en otra ventana horizontal: ":sp filena"
- Abrir un nuevo fichero en otra ventana vertical: ":vsp filename”
- Mover al siguiente tab gt
- Mover al anterior tab gT
Press this combination key in insert mode ctrl-k
and write the code, ex: Eu
.
To see the special characters list, write :dig
, each two-letter combination
(“di-graph”) is designed to be memorable.
- With user and hostname:
vim scp://[email protected]//absolute/path/to/document
- With ssh config name:
vim scp://ssh-config-name//absolute/path/to/document
With this command you can delete the line number 13
on the file /Users/nstrappazzonc/.ssh/known_hosts
.
$ vim /Users/nstrappazzonc/.ssh/known_hosts +"13d|x"
Type :Vex
to split in vertical file ex(ploring) the files on your system if you want to use something different from :e
.