完全無料

Vim コマンド チートシート

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% を処理する最も一般的に使用されるコマンドとパターンをカバーしています。ニッチな機能または高度な機能については、公式ドキュメントを参照してください。
追加を提案できますか?
リファレンスは定期的に更新されます。不足しているコマンドに気付いた場合、または提案がある場合は、お問い合わせページからお知らせください。