Modify repeat keys?
Michael Markert
markert.michael at googlemail.com
Thu Aug 11 01:56:05 CEST 2011
Sorry I f*cked the mime types up.
here is my message again:
Hi,
I'm using this function to exit insert state with jk
(use `(define-key evil-insert-state-map (cofi/maybe-exit ?j ?k))')
#+begin_src emacs-lisp
(defun cofi/maybe-exit (entry-char exit-char)
"Return a a function that maybe inserts or calls `evil-normal-state'.
Insert `ENTRY-CHAR', if it is followed by a `EXIT-CHAR' in the next half second,
delete `ENTRY-CHAR' and call `evil-normal-state''."
`(lambda ()
(interactive)
(let ((modified (buffer-modified-p)))
(insert ,entry-char)
(let ((evt (read-event (format "Insert %c to exit insert state" ,exit-char)
nil 0.5)))
(cond
((null evt) (message ""))
((and (integerp evt) (char-equal evt ,exit-char))
(delete-char -1)
(set-buffer-modified-p modified)
(evil-normal-state))
(t (setq unread-command-events (append unread-command-events
(list evt)))))))))
#+end_src emacs-lisp
It works fine except for repeating insertions. I tried to modify
`evil-repeat-keys' before calling `evil-normal-state' — something
along the lines of
(setq evil-repeat-keys (append (butlast evil-repeat-keys) [escape]))
— but it didn't work and was greeted a `characterp' error.
I also tried to access the `evil-repeat-ring' after the call to
`evil-normal-state' but it was still empty.
So please help me out here: How can I modify the repeat keys
correctly?
Thanks,
Michael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
Url : https://lists.ourproject.org/pipermail/implementations-list/attachments/20110811/43174fcb/attachment.pgp
More information about the implementations-list
mailing list