Ilmainen muunnin

Vim komennot Huijauslehti

Kattava Vim-komentohuijauslehti. Hae yli 80 tärkeästä Vim-komennosta esimerkeillä, kuvauksilla ja yhdellä napsautuksella.

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

Tietoa tästä työkalusta

Kattava pikaopas vim-komentoille. Selaa yleisesti käytettyjä komentoja, syntaksia ja esimerkkejä luokittain järjestettyinä. Hakukelpoinen ja mobiiliystävällinen – merkitse tämä sivu kirjanmerkkeihin, jotta pääset heti, kun tarvitset nopean muistutuksen.

Käyttöohjeet

  1. Selaa luokiteltuja viiteosioita.
  2. Käytä hakupalkkia löytääksesi tiettyjä komentoja tai syntaksia.
  3. Napsauta mitä tahansa kohtaa nähdäksesi käyttöesimerkkejä ja selityksiä.
  4. Kopioi komennot suoraan käytettäväksi päätteessäsi tai editorissasi.

Usein kysytyt kysymykset

Onko tämä viittaus ajan tasalla?
Viite kattaa laajalti käytetyt komennot ja syntaksin, jotka ovat vakaat eri versioissa. Katso uusimmat lisäykset tai versiokohtaiset ominaisuudet virallisesta dokumentaatiosta.
Voinko käyttää tätä offline-tilassa?
Kun sivu on ladattu, se toimii ilman Internet-yhteyttä. Lisää se kirjanmerkkeihin nopeaa käyttöä varten – kaikki sisältö hahmonnetaan selaimessa ilman muita verkkopyyntöjä.
Onko tämä kattava vai vain perusasiat?
Se kattaa yleisimmin käytetyt komennot ja mallit, jotka käsittelevät 90 % jokapäiväisistä tehtävistä. Katso niche- tai lisäominaisuudet virallisesta dokumentaatiosta.
Voinko ehdottaa lisäyksiä?
Päivitämme referenssejämme säännöllisesti. Jos huomaat puuttuvia komentoja tai sinulla on ehdotuksia, kerro siitä meille yhteystietosivumme kautta.