dbalatero / VimMode.spoon

Adds vim keybindings to all OS X inputs
693 stars 33 forks source link

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

Open chancez opened 2 years ago

chancez commented 2 years ago

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:

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 commented 2 years ago

I'd also very much love this.

raymond8825 commented 2 years ago

thx