Gratis omvandlare

Vim-kommandon Fuskblad

Omfattande Vim-kommandofuskblad. Sök i 80+ väsentliga Vim-kommandon med exempel, beskrivningar och kopiera med ett klick.

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

Om detta verktyg

En omfattande snabbreferensguide för vim-kommandon. Bläddra bland vanliga kommandon, syntax och exempel ordnade efter kategori. Sökbar och mobilvänlig – bokmärk den här sidan för omedelbar åtkomst när du behöver en snabb påminnelse.

Så här använder du det

  1. Bläddra i de kategoriserade referenssektionerna.
  2. Använd sökfältet för att hitta specifika kommandon eller syntax.
  3. Klicka på valfri post för att se användningsexempel och förklaringar.
  4. Kopiera kommandon direkt för användning i din terminal eller editor.

Vanliga frågor

Är denna referens aktuell?
Referensen täcker ofta använda kommandon och syntax som är stabila över versioner. Se den officiella dokumentationen för de senaste tilläggen eller versionsspecifika funktionerna.
Kan jag använda detta offline?
När den väl har laddats fungerar sidan utan internetanslutning. Bokmärk det för snabb åtkomst – allt innehåll renderas i webbläsaren utan ytterligare nätverksbegäranden.
Är detta heltäckande eller bara grunderna?
Den täcker de vanligaste kommandona och mönstren som hanterar 90 % av vardagliga uppgifter. För nischade eller avancerade funktioner, se den officiella dokumentationen.
Kan jag föreslå tillägg?
Vi uppdaterar regelbundet våra referenser. Om du märker att kommandon saknas eller har förslag, låt oss veta det via vår kontaktsida.