ממיר חינם

פקודות Vim Cheat Sheet

גיליון הונאה של פקודות Vim מקיף. חפש ב-80+ פקודות Vim חיוניות עם דוגמאות, תיאורים והעתקה בלחיצה אחת.

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

אודות כלי זה

מדריך מקיף לפקודות vim. עיין בפקודות נפוצות, תחביר ודוגמאות מאורגנות לפי קטגוריות. ניתן לחיפוש וידידותי לנייד - הוסף דף זה לסימניות לגישה מיידית כאשר אתה צריך תזכורת מהירה.

כיצד להשתמש

  1. עיין במדורי ההתייחסות המסווגים.
  2. השתמש בסרגל החיפוש כדי למצוא פקודות או תחביר ספציפיים.
  3. לחץ על כל ערך כדי לראות דוגמאות והסברים לשימוש.
  4. העתק פקודות ישירות לשימוש בטרמינל או בעורך.

שאלות נפוצות

האם הפניה זו מעודכנת?
ההפניה מכסה פקודות ותחביר בשימוש נרחב הינם יציבים בגרסאות. לקבלת התוספות האחרונות או תכונות ספציפיות לגרסה, עיין בתיעוד הרשמי.
האם אני יכול להשתמש בזה במצב לא מקוון?
לאחר הטעינה, הדף פועל ללא חיבור לאינטרנט. הוסף אותו לסימניות לגישה מהירה - כל התוכן מוצג בדפדפן ללא בקשות רשת נוספות.
האם זה מקיף או רק היסודות?
הוא מכסה את הפקודות והתבניות הנפוצות ביותר המטפלות ב-90% מהמשימות היומיומיות. לתכונות נישה או מתקדמות, עיין בתיעוד הרשמי.
אפשר להציע תוספות?
אנו מעדכנים באופן קבוע את ההפניות שלנו. אם אתה מבחין בפקודות חסרות או שיש לך הצעות, הודע לנו דרך דף יצירת הקשר שלנו.