komsit37 / sublime-q

Sublime Text Plugin for q/kdb
MIT License
24 stars 9 forks source link

In vim mode,couldn't switch from insert mode to command mode with ESC #16

Closed trackless closed 5 years ago

komsit37 commented 7 years ago

Can you elaborate more about the issue? sublime-q doesn't have anything to do with vim.

if you need to change ESC key bind of sublime-q to some other keys, you can go to Preferences/Key bindings and add below entry to user key binding (on the right panel). For example:

{ "keys": ["shift+escape"],           "command": "q_chain", "args": {"chain": ["q_hide_out_panel", "q_out_popup_close", "hide_auto_complete"]}, "context":[{ "key": "selector", "operator": "equal", "operand": "source.q" }] }
ntr-808 commented 6 years ago

I believe the issue is that the sublime-q ESC bind is clobbering the default behaviour of ST and prevents you from leaving insert mode (investigating if there's a way to change it atm)

ntr-808 commented 6 years ago

I'm not sure if there's a proper fix for this to have the insert mode binding apply first, but in the end I managed to fix this by checking out this repository in my sublime-text-3/Packages/ instead of using the prebuilt binary from package control and changing the Default (Linux).sublime-keymap to have the close panel binding commented. everything still seems to close correctly.

komsit37 commented 6 years ago

@margh thanks for clarifying

  1. You shouldn't need to mess with plugin source to rebind keymap

You can remap key binding by defining override in Default (your platform).sublime-keymap -- User.

You can access this from Preferences/Key bindings. This will open two keymap files (1) default one on the left pane (2) user overrides on the right pane.

You may need to redefine additional escape keymap for your vim plugin (I'm not sure which plugin you use)

for example Default (your platform).sublime-keymap -- User

[
 { "keys": ["shift+escape"],           "command": "q_chain", "args": {"chain": ["q_hide_out_panel", "q_out_popup_close", "hide_auto_complete"]},  "context":[{ "key": "selector", "operator": "equal", "operand": "source.q" }]},
{ your vim keymap here}
]
  1. i'll try to add additional context to the default [escape] keymap in sublime-q so that it only binds when panel is open or something