.vimrc for Vim Mode

I like to escape insert mode using:

imap jj <Esc>

in my .vimrc file. Is there any way to do this on Xcode 13?

Post not yet marked as solved Up vote post of jgank Down vote post of jgank
2.7k views
  • Any updates on this with Xcode 14.2?

Add a Comment

Replies

For the time being you can use: https://bryce.co/xcode-vim-map/

But @apple please do it officially. Bring .vimrc.

Xcode doesn't support .vimrc, this is so frustrated.

try out Karabiner, you can download it from github.

add below to the json file under ~/.config/karabiner, then you can use jk to jump out of INSERT mode, or change it to your favorite combination.

{
                        "description": "jk to escape for xcode",
                        "manipulators": [
                            {
                                "conditions": [
                                    {
                                        "bundle_identifiers": [
					    "com.apple.dt.Xcode"
                                        ],
                                        "type": "frontmost_application_if"
                                    },
                                    {
                                        "name": "j_pressed",
                                        "type": "variable_unless",
                                        "value": 1
                                    }
                                ],
                                "from": {
                                    "key_code": "j"
                                },
                                "parameters": {
                                    "basic.to_delayed_action_delay_milliseconds": 500
                                },
                                "to": [
                                    {
                                        "set_variable": {
                                            "name": "j_pressed",
                                            "value": 1
                                        }
                                    }
                                ],
                                "to_delayed_action": {
                                    "to_if_invoked": [
                                        {
                                            "set_variable": {
                                                "name": "j_pressed",
                                                "value": 0
                                            }
                                        }
                                    ]
                                },
                                "type": "basic"
                            },
                            {
                                "conditions": [
                                    {
                                        "bundle_identifiers": [
					    "com.apple.dt.Xcode"
                                        ],
                                        "type": "frontmost_application_if"
                                    },
                                    {
                                        "name": "j_pressed",
                                        "type": "variable_if",
                                        "value": 1
                                    }
                                ],
                                "from": {
                                    "key_code": "k"
                                },
                                "to": [
                                    {
                                        "set_variable": {
                                            "name": "j_pressed",
                                            "value": 0
                                        }
                                    },
                                    {
                                        "key_code": "escape",
                                        "modifiers": [
                                        ]
                                    }
                                ],
                                "type": "basic"
                            }
                        ]
                    }
  • I tried this, but it's not working, nothing happens. I put this in ~/.config/karabiner/karabiner.json, and reloaded

    launchctl kickstart -k gui/id -u/org.pqrs.karabiner.karabiner_console_user_server

    But still nothing.

Add a Comment

I finally have 'jk' on Xcode. I had to put it here for it to work ~/.config/karabiner/assets/complex_modifications/jk_Xcode.json

I also needed to put this on the top:

{
"title": "Xcode jk vim",
    "rules": [
....