Convertidor gratuït

Ordres Vim Full de trucs

Full de trampes d'ordres Vim complet. Cerqueu més de 80 ordres essencials de Vim amb exemples, descripcions i còpia amb un sol clic.

i
Enter Insert mode before the cursor
Exemple:i
I
Enter Insert mode at the beginning of the line
Exemple:I
a
Enter Insert mode after the cursor
Exemple:a
A
Enter Insert mode at the end of the line
Exemple:A
o
Open a new line below and enter Insert mode
Exemple:o
O
Open a new line above and enter Insert mode
Exemple:O
v
Enter Visual mode (character selection)
Exemple:v
V
Enter Visual Line mode (line selection)
Exemple:V
Ctrl+v
Enter Visual Block mode (column selection)
Exemple:Ctrl+v
:
Enter Command-line mode
Exemple::w
Esc
Return to Normal mode from any mode
Exemple:Esc
R
Enter Replace mode (overwrite characters)
Exemple:R
h
Move cursor left
Exemple:5h
j
Move cursor down
Exemple:10j
k
Move cursor up
Exemple:10k
l
Move cursor right
Exemple:5l
w
Move to the start of the next word
Exemple:3w
b
Move to the start of the previous word
Exemple:3b
e
Move to the end of the current word
Exemple:2e
0
Move to the beginning of the line
Exemple:0
^
Move to the first non-blank character of the line
Exemple:^
$
Move to the end of the line
Exemple:$
gg
Move to the first line of the file
Exemple:gg
G
Move to the last line of the file
Exemple:G
:N
Jump to line number N
Exemple::42
Ctrl+f
Scroll forward (down) one screen
Exemple:Ctrl+f
Ctrl+b
Scroll backward (up) one screen
Exemple:Ctrl+b
Ctrl+d
Scroll down half a screen
Exemple:Ctrl+d
Ctrl+u
Scroll up half a screen
Exemple:Ctrl+u
H
Move cursor to the top of the screen
Exemple:H
M
Move cursor to the middle of the screen
Exemple:M
L
Move cursor to the bottom of the screen
Exemple:L
%
Jump to matching bracket, parenthesis, or brace
Exemple:%
x
Delete the character under the cursor
Exemple:x
dd
Delete (cut) the current line
Exemple:dd
dw
Delete from cursor to the end of the word
Exemple:dw
d$
Delete from cursor to the end of the line
Exemple:d$
D
Delete from cursor to end of line (same as d$)
Exemple:D
yy
Yank (copy) the current line
Exemple:yy
yw
Yank (copy) from cursor to end of word
Exemple:yw
p
Paste after the cursor
Exemple:p
P
Paste before the cursor
Exemple:P
u
Undo the last change
Exemple:u
Ctrl+r
Redo the last undone change
Exemple:Ctrl+r
cc
Change (delete and enter insert mode) the current line
Exemple:cc
cw
Change from cursor to end of word
Exemple:cw
c$
Change from cursor to end of line
Exemple:c$
.
Repeat the last change
Exemple:.
>>
Indent the current line one level to the right
Exemple:>>
<<
Unindent the current line one level to the left
Exemple:<<
==
Auto-indent the current line
Exemple:==
J
Join the current line with the line below
Exemple:J
~
Toggle case of character under cursor
Exemple:~
r{char}
Replace the character under the cursor with {char}
Exemple:ra
/{pattern}
Search forward for pattern
Exemple:/foo
?{pattern}
Search backward for pattern
Exemple:?foo
n
Repeat the last search in the same direction
Exemple:n
N
Repeat the last search in the opposite direction
Exemple:N
*
Search forward for the word under the cursor
Exemple:*
#
Search backward for the word under the cursor
Exemple:#
:s/old/new/g
Replace all occurrences of old with new on the current line
Exemple::s/foo/bar/g
:%s/old/new/g
Replace all occurrences of old with new in the whole file
Exemple::%s/foo/bar/g
:%s/old/new/gc
Replace all with confirmation prompts
Exemple::%s/foo/bar/gc
:noh
Clear the search highlight
Exemple::noh
:w
Save the current file
Exemple::w
:w filename
Save the current buffer as a new filename
Exemple::w newfile.txt
:q
Quit (close the window)
Exemple::q
:wq
Save and quit
Exemple::wq
:q!
Quit without saving (force quit)
Exemple::q!
:x
Save and quit (only writes if changes were made)
Exemple::x
:e filename
Open a file for editing
Exemple::e README.md
:sp
Split the window horizontally
Exemple::sp file.txt
:vsp
Split the window vertically
Exemple::vsp file.txt
Ctrl+w+w
Switch focus to the next split window
Exemple:Ctrl+w w
Ctrl+w+h/j/k/l
Move focus to the window in the given direction
Exemple:Ctrl+w l
:close
Close the current window split
Exemple::close
:only
Close all windows except the current one
Exemple::only
:bn
Switch to the next buffer
Exemple::bn
:bp
Switch to the previous buffer
Exemple::bp
:bd
Delete (close) the current buffer
Exemple::bd
:ls
List all open buffers
Exemple::ls
:b N
Switch to buffer number N
Exemple::b 2
:tabnew
Open a new tab
Exemple::tabnew file.txt
:tabn
Switch to the next tab
Exemple::tabn
:tabp
Switch to the previous tab
Exemple::tabp
:tabclose
Close the current tab
Exemple::tabclose
gt
Go to the next tab
Exemple:gt
gT
Go to the previous tab
Exemple:gT
q{a-z}
Start recording a macro into register {a-z}
Exemple:qq
q (stop)
Stop recording the current macro
Exemple:q
@{a-z}
Execute the macro stored in register {a-z}
Exemple:@q
@@
Repeat the last executed macro
Exemple:@@
N@{a-z}
Execute macro N times
Exemple:5@q
:reg
Show the contents of all registers
Exemple::reg
v then d
Select text in Visual mode then delete it
Exemple:vwd
v then y
Select text in Visual mode then yank (copy) it
Exemple:vwy
v then c
Select text in Visual mode then change it
Exemple:vwc
v then >
Indent selected text to the right
Exemple:vip>
vip
Select the current paragraph in Visual mode
Exemple:vip
viw
Select the current word in Visual mode
Exemple:viw
vis
Select the current sentence in Visual mode
Exemple:vis
V then J
Select lines in Visual Line mode then join them
Exemple:VjJ
:set number
Show line numbers
Exemple::set number
:set nonumber
Hide line numbers
Exemple::set nonumber
:syntax on
Enable syntax highlighting
Exemple::syntax on
:colorscheme
Change the color scheme
Exemple::colorscheme desert
:help {topic}
Open Vim help for a topic
Exemple::help :w
m{a-z}
Set a mark at the current cursor position
Exemple:ma
'{a-z}
Jump to the line of a mark
Exemple:'a
`{a-z}
Jump to the exact position of a mark
Exemple:`a
:set paste
Enable paste mode to avoid auto-indent issues
Exemple::set paste
:set ignorecase
Make searches case-insensitive
Exemple::set ignorecase
:set hlsearch
Highlight all search matches
Exemple::set hlsearch
ga
Show the ASCII value of the character under the cursor
Exemple:ga
zz
Center the current line on the screen
Exemple:zz
Ctrl+g
Show the current file name and cursor position
Exemple:Ctrl+g

Sobre aquesta eina

Una guia completa de referència ràpida per a les ordres vim. Exploreu les ordres, la sintaxi i els exemples d'ús habitual organitzats per categories. Cerca i adaptable per a mòbils: afegiu aquesta pàgina a les adreces d'interès per accedir-hi instantàniament quan necessiteu un recordatori ràpid.

Com utilitzar-la

  1. Navega per les seccions de referència categoritzades.
  2. Utilitzeu la barra de cerca per trobar ordres o sintaxis específiques.
  3. Feu clic a qualsevol entrada per veure exemples d'ús i explicacions.
  4. Copieu les ordres directament per utilitzar-les al vostre terminal o editor.

Preguntes freqüents

Aquesta referència està actualitzada?
La referència cobreix ordres i sintaxis àmpliament utilitzades que són estables en totes les versions. Per obtenir les últimes incorporacions o funcions específiques de la versió, consulteu la documentació oficial.
Puc utilitzar això fora de línia?
Un cop carregada, la pàgina funciona sense connexió a Internet. Afegiu-lo a les adreces d'interès per accedir-hi ràpidament: tot el contingut es mostra al navegador sense més sol·licituds de xarxa.
Això és complet o només és bàsic?
Cobreix les ordres i els patrons més utilitzats que gestionen el 90% de les tasques quotidianes. Per a funcions de nínxol o avançades, consulteu la documentació oficial.
Puc suggerir addicions?
Actualitzem regularment les nostres referències. Si observeu que falten ordres o teniu suggeriments, feu-nos-ho saber a través de la nostra pàgina de contacte.