Skip to content

Exit insert on timer #598

Closed Answered by eshrh
favetelinguis asked this question in Q&A
May 24, 2024 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

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))))

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@favetelinguis
Comment options

Answer selected by favetelinguis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants