Skip to content

Instantly share code, notes, and snippets.

@Affonso-Gui
Created May 1, 2022 07:58
Show Gist options
  • Save Affonso-Gui/7280b1b1ac02a39bf798bc97d3a341b6 to your computer and use it in GitHub Desktop.
Save Affonso-Gui/7280b1b1ac02a39bf798bc97d3a341b6 to your computer and use it in GitHub Desktop.
Prof. Inaba emacs cheatsheet

Emacsでよく使うコマンド

by: Prof. Inaba

Ctrl- はコントロールキーを押しながらの意味。 M- はメタキー(Alt, ESC など)を押しながらの意味。

<カーソル移動>

Key Action
Ctrl-b
Ctrl-f
Ctrl-n
Ctrl-p
Ctrl-a 行頭
Ctrl-e 行末
M-< ファイル先頭
M-> ファイル末端
Ctrl-x l 現在のカーソルの位置を調べる

<挿入,消去>

Key Action
Ctrl-d カーソルの文字を消す
Ctrl-o 新しい行をカーソルの次の行へ挿入
Ctrl-k カーソルから行末を消す
Ctrl-y 消したものをカーソル位置へ挿入
Ctrl-[space] 現在のカーソルの場所をマークして覚える
Ctrl-w マークから現在のカーソルまでの領域を消す

<探索>

Key Action
Ctrl-s 文字列 順方向
Ctrl-r 文字列 逆方向
Ctrl-g 順に行う探索・置換を辞める

<置換>

Key Action
M-x replace-string ret 旧文字列 新文字列 全置換
M-x query-replace ret 旧文字列 新文字列 毎確認置換

<バッファ操作>

Key Action
Ctrl-x o バッファ間移動
Ctrl-x 1 他バッファ閉じ
Ctrl-x 2 バッファ上下分割
Ctrl-x 3 バッファ横分割

<ファイル操作>

Key Action
Ctrl-x Ctrl-f ファイルオープン
Ctrl-x Ctrl-s ファイル保存

<コマンドの繰り返し>

Key Action
Ctrl-u N コマンド N回コマンドを繰り返す
Ctrl-u 20 Ctrl-f 20文字進む
Ctrl-u 50 Ctrl-n 50行目へ飛ぶ

<コマンドをまとめて登録する:マクロという>

Key Action
Ctrl-x ( 登録コマンド保存開始
Ctrl-x ) 登録コマンド保存修了
Ctrl-x e 登録コマンドの実行
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment