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

Cursor Editor Ctrl+N の衝突問題

Last updated at Posted at 2025-01-26

問題

Chat欄でEmacsキーバインドの下方向カーソル移動Ctrl+nを押すと、チャットが新規作成されてしまうという問題があります。Command+zでUndoすれば元には戻るのですが、非常にストレスフルです。

以下のようにフォーラムで議論されているようですが、今日(2025年1月26日)時点では解決していないようです。

応急処置的解決策:Karabiner-Elementsで上書き

テンポラリーな解決策: Karabiner-Elementsを使ってCursorエディタ内でCtrl+nを下矢印キーに変更する方法

私自身もこの問題に困っていたので、Cursorが正式に対応するまでの応急処置として、Karabiner-Elementsを使った方法を共有したいと思います。この解決策では、Ctrl+nをCursorエディタ内でのみ下矢印キーとして動作させ、それ以外のアプリでは元の機能をそのまま維持することができます。

以下が私の設定です:

{
    "description": "Ctrl+n to Down Arrow in Cursor Editor",
    "manipulators": [
        {
            "conditions": [
                {
                    "bundle_identifiers": [
                        "^com.todesktop.<your bundle id>$"
                    ],
                    "type": "frontmost_application_if"
                }
            ],
            "from": {
                "key_code": "n",
                "modifiers": {
                    "mandatory": [
                        "control"
                    ],
                    "optional": [
                        "any"
                    ]
                }
            },
            "to": [
                {
                    "key_code": "down_arrow"
                }
            ],
            "type": "basic"
        }
    ]
}

Ctrl+n以外も修正したバージョン:

  • Ctrl+n → 下矢印
  • Ctrl+p → 上矢印
  • Ctrl+f → 右矢印
  • Ctrl+b → 左矢印
  • Ctrl+a → Home
  • Ctrl+e → End
{
    "description": "Emacs-style Cursor Movement in Cursor Editor",
    "manipulators": [
        {
            "conditions": [
                {
                    "bundle_identifiers": [
                        "^com.todesktop.<your bundle id>$"
                    ],
                    "type": "frontmost_application_if"
                }
            ],
            "from": {
                "key_code": "n",
                "modifiers": {
                    "mandatory": [
                        "control"
                    ],
                    "optional": [
                        "any"
                    ]
                }
            },
            "to": [
                {
                    "key_code": "down_arrow"
                }
            ],
            "type": "basic"
        },
        {
            "conditions": [
                {
                    "bundle_identifiers": [
                        "^com.todesktop.<your bundle id>$"
                    ],
                    "type": "frontmost_application_if"
                }
            ],
            "from": {
                "key_code": "p",
                "modifiers": {
                    "mandatory": [
                        "control"
                    ],
                    "optional": [
                        "any"
                    ]
                }
            },
            "to": [
                {
                    "key_code": "up_arrow"
                }
            ],
            "type": "basic"
        },
        {
            "conditions": [
                {
                    "bundle_identifiers": [
                        "^com.todesktop.<your bundle id>$"
                    ],
                    "type": "frontmost_application_if"
                }
            ],
            "from": {
                "key_code": "f",
                "modifiers": {
                    "mandatory": [
                        "control"
                    ],
                    "optional": [
                        "any"
                    ]
                }
            },
            "to": [
                {
                    "key_code": "right_arrow"
                }
            ],
            "type": "basic"
        },
        {
            "conditions": [
                {
                    "bundle_identifiers": [
                        "^com.todesktop.<your bundle id>$"
                    ],
                    "type": "frontmost_application_if"
                }
            ],
            "from": {
                "key_code": "b",
                "modifiers": {
                    "mandatory": [
                        "control"
                    ],
                    "optional": [
                        "any"
                    ]
                }
            },
            "to": [
                {
                    "key_code": "left_arrow"
                }
            ],
            "type": "basic"
        },
        {
            "conditions": [
                {
                    "bundle_identifiers": [
                        "^com.todesktop.<your bundle id>$"
                    ],
                    "type": "frontmost_application_if"
                }
            ],
            "from": {
                "key_code": "a",
                "modifiers": {
                    "mandatory": [
                        "control"
                    ],
                    "optional": [
                        "any"
                    ]
                }
            },
            "to": [
                {
                    "key_code": "home"
                }
            ],
            "type": "basic"
        }
    ]
}

これができること:

  • Cursorエディタ内: Ctrl+nが下矢印キーとして動作します(Emacsの下方向カーソル移動に相当)。
  • それ以外のアプリ: Ctrl+nは新規タブや新規ファイル作成など、元の動作をそのまま維持します。

使用手順:

  1. このJSONコードをKarabiner-Elementsの設定に保存します(保存場所やファイル名はお任せします)。
  2. Karabiner-Elementsを開き、Complex Modificationsタブで「Add Rule」をクリックしてルールを有効化します。

注意点:

  1. これはテンポラリーな解決策です。
    あくまで応急処置であり、正式なアップデートが提供されるまでの一時的な対応です。

  2. アプリのバンドルIDについて:
    この設定ではcom.todesktop.<your bundle id>というバンドルIDを使ってCursorエディタを特定しています。これは環境ごとに異なります。
    自分の環境で正しいバンドルIDを確認するには:

    • Cursorをアクティブにした状態でKarabinerのEvent Viewerを開きます。
    • frontmost_applicationの項目に表示されるバンドルIDを確認してください。
  3. 完全な解決ではありません。
    根本的な問題に対処するわけではありませんが、私が行き詰まったときに助けになった方法です。同じように困っている方の一助になれば幸いです。


最後に:

この投稿は、私が試した解決策を共有するためのものです。質問にはお答えできませんが、同じ問題で困っている方のお役に立てば嬉しいです 🙏
早く正式な修正が行われることを願っています!

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