Bezmaksas pārveidotājs

Vim komandas Apkrāptu lapa

Visaptveroša Vim komandu apkrāpšanas lapa. Meklējiet 80+ būtiskās Vim komandas ar piemēriem, aprakstiem un viena klikšķa kopiju.

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

Par šo rīku

Visaptveroša ātrās uzziņas rokasgrāmata par vim komandām. Pārlūkojiet biežāk lietotās komandas, sintaksi un piemērus, kas sakārtoti pēc kategorijas. Meklējama un mobilajām ierīcēm draudzīga — atzīmējiet šo lapu ar grāmatzīmi, lai nekavējoties piekļūtu, kad nepieciešams ātrs atgādinājums.

Kā lietot

  1. Pārlūkojiet kategorizētās atsauces sadaļas.
  2. Izmantojiet meklēšanas joslu, lai atrastu noteiktas komandas vai sintaksi.
  3. Noklikšķiniet uz jebkura ieraksta, lai skatītu lietošanas piemērus un skaidrojumus.
  4. Kopējiet komandas tieši izmantošanai terminālī vai redaktorā.

Bieži uzdotie jautājumi

Vai šī atsauce ir atjaunināta?
Atsauce aptver plaši izmantotās komandas un sintaksi, kas ir stabilas dažādās versijās. Lai iegūtu jaunākos papildinājumus vai versijai specifiskus līdzekļus, skatiet oficiālo dokumentāciju.
Vai es varu to izmantot bezsaistē?
Pēc ielādes lapa darbojas bez interneta savienojuma. Atzīmējiet to ar grāmatzīmi ātrai piekļuvei — viss saturs tiek atveidots pārlūkprogrammā bez turpmākiem tīkla pieprasījumiem.
Vai tas ir visaptverošs vai tikai pamats?
Tas aptver visbiežāk izmantotās komandas un modeļus, kas apstrādā 90% ikdienas uzdevumu. Lai uzzinātu par nišas vai papildu funkcijām, skatiet oficiālo dokumentāciju.
Vai varu ieteikt papildinājumus?
Mēs regulāri atjauninām savas atsauces. Ja pamanāt, ka trūkst komandu vai jums ir ieteikumi, informējiet mūs, izmantojot mūsu kontaktu lapu.