LoginSignup
2
0

More than 1 year has passed since last update.

[Mac版]VSCodeでEmacsキーバインドを使う

Posted at

はじめに

Web開発の基礎を学ぶことを思い立ってMacを使い始めたのですが、「control」キーと組み合わせたショートカットを使うと、キーボードから手を離さずテキスト編集ができて便利ですね。(^^)
Emacsのキーバインドと似てるようなので、VSCodeにEmacsキーバインドを入れることで、学習コストを節約したいと思います。
あと、よく使うショートカットを備忘録としてまとめておきました。

Awesome Emacs Keymapをインストールする

VSCodeでEmacsキーバインド用のエクステンションを検索するとたくさん出てきます。どれがいいか分からなかったので、「VSCodeのEmacsキーバインド拡張まとめ」を参考にさせていただき、Awesome Emacs Keymapをインストールすることにしました。

注意事項

  • Emacsでテキストをコピペするには、選択範囲の開始点を指定する必要があるのですが、そのキーバインドが「Ctrl+Space」になっています。これは、MacのSpotlightを呼び出すとても便利なショートカットでもあります。Emacsのキーバインドを優先される場合は、システム環境設定 > Spotlight で[キーボードショートカット]を開き、[Spotlight検索を表示]のチェックを外してください。
  • Emacsでコピペするときに使うのは、クリップボードではなく「kill ring」というものらしいのですが、以下の備忘録ではそのあたりは区別できていません。VSCodeでEmacsキーバインドを使っていく中で支障が出てきたら、見直したいと思います。

ショートカット

カーソル移動(行単位)
やりたいこと キーバインド 英語の説明
1文字右 Ctrl+F Move one character forward
1文字左 Ctrl+B Move one character backward
1行上 Ctrl+P Move up one line
行の先頭 Ctrl+A Move to the beginning of the line or paragraph
行の末尾 Ctrl+E Move to the end of a line or paragraph
カーソル移動(画面単位)
やりたいこと キーバインド 英語の説明
1ページ上 Option+V Scroll up by one screen unit
1ページ下 Ctrl+V Scroll down by one screen unit
水平方向に画面中央へ Ctrl+L Center the cursor or selection in the visible area
削除
やりたいこと キーバインド 英語の説明
左の文字 Ctrl+H Delete the character to the left of the insertion point
右の文字 Ctrl+D Delete the character to the right of the insertion point
行末まで Ctrl+K Delete the text between the insertion point and the end of the line or paragraph, and copy it to the Clipboard
範囲選択
やりたいこと キーバインド 英語の説明
開始点の設定 Ctrl+Space Set the beginning point
終了点の設定(切取り) Ctrl+W Cut the selected item and copy it to the Clipboard
終了点の設定(コピー) Option+W Copy the selected item to the Clipboard
貼り付け
やりたいこと キーバインド 英語の説明
貼り付け Ctrl+Y Paste the contents of the Clipboard into the insertion point
UNDO
やりたいこと キーバインド 英語の説明
UNDO Ctrl+X, U Undo the previous command
2
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
2
0