Exit insert on timer #598
-
Has anyone tried to setup so that you exit insert mode after some timeout. For example if I dont type a new char for 4 seconds I go back to the previous mode? If I would like to try this setup what would the elisp code have to be for this to work nice? The reasoning is that I much rather do a few exta i instead of ESC. And often I do small edit and think for a while before I do the next edit. I think this type of feature would save me from a ton ESC presses while having minimal impact on my typing. Not sure however how to set this up for testing the idea. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I'm not sure if i'd really like this on my setup because I prefer to be intentional about stuff like this even if it costs me an extra keypress. With that said, this isn't hard to implement: (add-hook
'meow-insert-enter-hook
(lambda ()
(setq meow-insert-timer
(run-with-idle-timer
4 nil
(lambda ()
(when (eq meow--current-state 'insert)
(meow--switch-state 'normal)))))))
(add-hook
'meow-insert-exit-hook
(lambda ()
(when (and (bound-and-true-p meow-insert-timer)
(timerp meow-insert-timer))
(cancel-timer meow-insert-timer)
(setq meow-insert-timer nil)))) |
Beta Was this translation helpful? Give feedback.
I'm not sure if i'd really like this on my setup because I prefer to be intentional about stuff like this even if it costs me an extra keypress.
With that said, this isn't hard to implement: