infoMore than 3 years have passed since last update.
Vim覚書
Last updated at Posted at 2020-12-23
Vim覚書
モード
モード |
状態 |
コマンド |
ノーマルモード |
カーソル移動やテキストの削除、コピー、ペーストなどの簡単な指示を行う。 |
Esc |
ビジュアルモード |
テキストを選択するだけのモード。 |
Esc-v |
インサートモード |
実際にテキストを入力するモード。 |
Esc-i |
コマンドラインモード |
ファイルを開いたり、検索・置換などの様々な指示を行う。 |
Esc : |
ターミナルモード |
エディタ上でターミナルが開ける |
Esc :terminal |
置換モード |
文字置換 |
Esc-R |
バイナリモード |
バイナリエディタ |
Esc :set binary :%!xxd ファイル名 |
カーソル移動
キー |
移動 |
h |
左一文字 |
l |
右一文字 |
j |
折り返しを考慮して下一行 |
k |
折り返しを考慮して上一行 |
gj |
折り返しを考慮せず下一行 |
gk |
折り返しを考慮せず上一行 |
[n]h |
左n文字 |
[n]l |
右n文字 |
[n]j |
折り返しを考慮して下n行 |
[n]k |
折り返しを考慮して上n行 |
[n]gj |
折り返しを考慮せず下n行 |
[n]gk |
折り返しを考慮せず上n行 |
gg |
先頭行に移動 |
[n]gg |
n行目に移動 |
w |
次の単語 |
b |
前の単語 |
[n]w |
n個先の単語 |
[n]b |
n個前の単語 |
置換
コマンド |
操作 |
:%s/置換前/置換後/ |
一つずつ置換 |
:%s/置換前/置換後/g |
全部置換 |
バイナリモード
起動方法
-
vim -b file_name
:%!xxd
-
:set binary
:%!xxd
保存方法
:%!xxd -r
:w
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme
What you can do with signing up