0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

vi 基本動作(備忘録)

0
Last updated at Posted at 2026-06-14

はじめに

viを久々使った際に基本動作を忘れていたので、備忘録として残します。

viの基本動作

├─ コマンドモード(移動・削除・保存)
└─ インサートモード(文字入力)

コマンドモード

インサートモード中でもESCを押せば戻れる

カーソル移動

キー 内容
h
j
k
l
0 行頭へ
$ 行末へ
gg ファイル先頭へ
G ファイル末尾へ

編集

キー 内容
x 1文字削除
dd 1行削除
3dd 3行削除
yy 1行コピー
p 貼り付け
u 元に戻す
Ctrl+r やり直し

検索

キー 内容
/文字列 前方検索
?文字列 後方検索
n 次を検索
N 前を検索

保存・終了

キー 内容
:w 保存
:q 終了
:wq 保存して終了
:x 保存して終了
:q! 保存せず終了

行番号

キー 内容
:set number 行番号表示
:set nonumber 行番号非表示

インサートモード

コマンドモードから入る

キー 内容
i 現在位置から入力
a 現在位置の後ろから入力
I 行頭から入力
A 行末から入力
o 下に新規行作成
O 上に新規行作成

インサートモード中

普通のエディタと同じ

キー 内容
Backspace 1文字削除
Enter 改行
Tab タブ入力
矢印キー 移動(環境による)

インサートモード終了

キー 内容
ESC コマンドモードへ戻る
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?