Kigeuzi cha Bure

Vim Amri Karatasi ya Kudanganya

Karatasi kamili ya kudanganya ya amri ya Vim. Tafuta 80+ amri muhimu za Vim na mifano, maelezo, na nakala ya kubofya mara moja.

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

Kuhusu zana hii

Mwongozo wa kina wa marejeleo ya haraka kwa amri za vim. Vinjari amri, sintaksia na mifano inayotumika sana iliyopangwa kulingana na kategoria. Inaweza kutafutwa na rahisi kutumia simu - alamisha ukurasa huu kwa ufikiaji wa papo hapo unapohitaji kikumbusho cha haraka.

Jinsi ya kutumia

  1. Vinjari sehemu za marejeleo zilizoainishwa.
  2. Tumia upau wa kutafutia ili kupata amri au sintaksia mahususi.
  3. Bofya ingizo lolote ili kuona mifano ya matumizi na maelezo.
  4. Nakili amri moja kwa moja kwa matumizi katika terminal au kihariri chako.

Maswali yanayoulizwa mara kwa mara

Je, rejeleo hili limesasishwa?
Rejea inashughulikia amri na sintaksia zinazotumiwa sana ambazo ni thabiti katika matoleo yote. Kwa nyongeza za hivi punde au vipengele mahususi vya toleo, angalia hati rasmi.
Je, ninaweza kutumia hii nje ya mtandao?
Mara baada ya kupakiwa, ukurasa hufanya kazi bila muunganisho wa mtandao. Alamisha kwa ufikiaji wa haraka - yaliyomo yote hutolewa kwenye kivinjari bila maombi zaidi ya mtandao.
Je, hii ni pana au ni ya msingi tu?
Inashughulikia amri na mifumo inayotumika sana ambayo hushughulikia 90% ya kazi za kila siku. Kwa niche au vipengele vya juu, wasiliana na nyaraka rasmi.
Je, ninaweza kupendekeza nyongeza?
Tunasasisha marejeleo yetu mara kwa mara. Ukiona amri zinazokosekana au una mapendekezo, tujulishe kupitia ukurasa wetu wa mawasiliano.