Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to map double keypress of escape to normal-mode #92

Open
chancez opened this issue Mar 9, 2022 · 2 comments
Open

How to map double keypress of escape to normal-mode #92

chancez opened this issue Mar 9, 2022 · 2 comments

Comments

@chancez
Copy link

chancez commented Mar 9, 2022

Hey, I really like VimMode.spoon overall, and I have too much muscle memory to enter normal mode with anything other than escape (I tried jk and a few others). So far using escape hasn't been a big deal, except sometimes I need to use escape to exit from some prompt/modal in the application I'm using.

Here's my config:

local VimMode = hs.loadSpoon('VimMode')
local vim = VimMode:new()

vim
  :disableForApp('Code')
  :disableForApp('MacVim')
  :disableForApp('kitty')
  :disableForApp('iTerm2')
  :disableForApp('zoom.us')
  :enterWithSequence('jk')
  :bindHotKeys({ enter = { {'ctrl'}, ';'} })
  :bindHotKeys({ enter = { {}, 'escape'} })

What I'm wondering is if it's possible to do the following:

  • map escape to insert mode and double escape to leave "vim mode" (and maybe even send the escape keypress after). Ie: I want to use single escape while typing to go into insert mode, but use double escape to send the escape key to the application directly ("not get intercepted by vim mode").

If not, is it possible to adapt enterWithSequence to work of leaving vim-mode? And in general, how might I potentially programmatically send a key press in Hammerspoon (so I can send escape after going to insert mode).

@megalithic
Copy link

I'd also very much love this.

@raymond8825
Copy link

thx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants