How do I remap escape when in Sublime Text vintage mode?

倖福魔咒の 提交于 2019-12-31 08:56:24

问题


I am a vim user who is moving to Sublime text and using Vintage mode. In my .vimrc I have the following line:

imap jk <Esc>

In vim, this allows me to escape out of insert mode without having to lunge for the escape key and keep my fingers on the home row. How do I do the same thing with Sublime Text Vintage mode?


回答1:


"Vintage mode is implemented entirely via key bindings and the plugin API - feel free to browse through the Vintage package and see how it's put together. As an example, if you'd like to bind "jj" to exit insert mode, you can add this key binding:"

{ "keys": ["j", "j"], "command": "exit_insert_mode",
    "context":
    [
        { "key": "setting.command_mode", "operand": false },
        { "key": "setting.is_widget", "operand": false }
    ]
}

Just modify first line to jk if you prefer that.
Source




回答2:


If you are using the Vintageous plugin, use the following key binding:

{
    "keys": ["j", "k"],
    "command": "_enter_normal_mode",
    "args": {"mode": "mode_insert"},
    "context": [{"key": "vi_insert_mode_aware"}]
}



回答3:


Also, Ctrl+[ works and is much easier to reach for than the esc key. This is in OSX at least.



来源:https://stackoverflow.com/questions/9620812/how-do-i-remap-escape-when-in-sublime-text-vintage-mode

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!