1
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?

【Zed】コメント段落間をキーボードで移動する方法

1
Posted at

Zed Preview 1.12.0では、コード内のコメント段落へカーソルを移動するアクションが追加されました。

コメントの多いファイルを確認するときや、複数のコメントを順番に整形するときに便利です。

追加されたアクション

追加されたアクションは次の2つです。

アクション 動作
editor: move to next comment paragraph 次のコメント段落へ移動する
editor: move to previous comment paragraph 前のコメント段落へ移動する

移動先は、コメント段落の最初の空白以外の文字です。

コマンドパレットから実行する

コマンドパレットを開きます。

macOSでは、次のショートカットを使用します。

Command + Shift + P

コマンドパレットで、次のいずれかを検索して実行します。

editor: move to next comment paragraph
editor: move to previous comment paragraph

これらのアクションには、デフォルトのキーバインドが設定されていません。

頻繁に使用する場合は、独自のショートカットを設定すると便利です。

キーバインドを設定する

コマンドパレットから次のコマンドを実行し、keymap.jsonを開きます。

zed: open keymap file

例として、次のキーバインドを追加します。

[
  {
    "context": "Editor",
    "bindings": {
      "ctrl-alt-j": "editor::MoveToNextCommentParagraph",
      "ctrl-alt-k": "editor::MoveToPreviousCommentParagraph"
    }
  }
]

この設定では、次の操作ができます。

キー 動作
Control + Option + J 次のコメント段落へ移動する
Control + Option + K 前のコメント段落へ移動する

既存のキーバインドと競合する場合は、任意のキーへ変更してください。

参考

1
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
1
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?