Nemokamas konverteris

Vim komandos Cheat Sheet

Išsamus Vim komandos apgaulės lapas. Ieškokite daugiau nei 80 pagrindinių Vim komandų su pavyzdžiais, aprašymais ir kopija vienu spustelėjimu.

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

Apie šį įrankį

Išsamus greitas vim komandų vadovas. Naršykite dažniausiai naudojamas komandas, sintaksę ir pavyzdžius, suskirstytus pagal kategorijas. Galima ieškoti ir pritaikyti mobiliesiems – pažymėkite šį puslapį, kad galėtumėte greitai pasiekti, kai jums reikia greito priminimo.

Kaip naudoti

  1. Naršykite į kategorijas suskirstytus nuorodų skyrius.
  2. Norėdami rasti konkrečias komandas arba sintaksę, naudokite paieškos juostą.
  3. Spustelėkite bet kurį įrašą, kad pamatytumėte naudojimo pavyzdžius ir paaiškinimus.
  4. Nukopijuokite komandas tiesiai, kad galėtumėte naudoti savo terminale arba redaktoriuje.

Dažnai užduodami klausimai

Ar ši nuoroda atnaujinta?
Nuoroda apima plačiai naudojamas komandas ir sintaksę, kurios yra stabilios įvairiose versijose. Naujausių priedų ar konkrečios versijos funkcijų ieškokite oficialioje dokumentacijoje.
Ar galiu tai naudoti neprisijungęs?
Įkėlus puslapis veikia be interneto ryšio. Pažymėkite jį, kad galėtumėte greitai pasiekti – visas turinys pateikiamas naršyklėje be papildomų tinklo užklausų.
Ar tai visapusiška, ar tik pagrindai?
Ji apima dažniausiai naudojamas komandas ir šablonus, kurie atlieka 90 % kasdienių užduočių. Dėl nišinių ar išplėstinių funkcijų ieškokite oficialių dokumentų.
Ar galiu pasiūlyti papildymus?
Reguliariai atnaujiname savo nuorodas. Jei pastebėjote trūkstamų komandų arba turite pasiūlymų, praneškite mums per mūsų kontaktų puslapį.