Skip to content

Instantly share code, notes, and snippets.

@txus txus/init.el
Created Apr 19, 2013

Embed
What would you like to do?
(setq evil-want-C-u-scroll t) ; Ctrl-u to scroll up
;; evil
(live-load-config-file "evil-conf.el")
;; evil-leader
(live-load-config-file "evil-leader-conf.el")
;; evil-surround
(live-load-config-file "evil-surround-conf.el")
;; evil-nerd-commenter
(live-load-config-file "evil-nerd-commenter-conf.el")
; map jk to ESC
(define-key evil-insert-state-map "j" #'cofi/maybe-exit)
(evil-define-command cofi/maybe-exit ()
:repeat change
(interactive)
(let ((modified (buffer-modified-p)))
(insert "j")
(let ((evt (read-event (format "Insert %c to exit insert state" ?k)
nil 0.5)))
(cond
((null evt) (message ""))
((and (integerp evt) (char-equal evt ?k))
(delete-char -1)
(set-buffer-modified-p modified)
(push 'escape unread-command-events))
(t (setq unread-command-events (append unread-command-events
(list evt))))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.