added function for electric punctuation in text-mode
This commit is contained in:
parent
943d8e2c36
commit
3942c0d169
11
my-funcs.el
11
my-funcs.el
|
@ -157,4 +157,15 @@ argument makes the windows rotate backwards."
|
|||
(if dedicated "no longer " "")
|
||||
(buffer-name))))
|
||||
|
||||
;; from http://blog.everythingtastesbetterwithchilli.com/2013/02/18/electric-punctuation-in-emacs/
|
||||
(defun electric-punctuation ()
|
||||
"Tidy up whitespace around punctuation: delete any preceding
|
||||
whitespace and insert one space afterwards. Idea stolen from
|
||||
the SwiftKey android keyboard."
|
||||
(interactive)
|
||||
(when (looking-back "\s+" nil t)
|
||||
(delete-region (match-beginning 0) (match-end 0)))
|
||||
(call-interactively 'self-insert-command)
|
||||
(just-one-space))
|
||||
|
||||
(provide 'my-funcs)
|
||||
|
|
|
@ -12,6 +12,9 @@
|
|||
; (define-key ac-complete-mode-map (kbd "RET") 'ac-complete)
|
||||
;; mu4e -----------------------------------------------------------------------
|
||||
(define-key mu4e-main-mode-map (kbd "q") 'mu4e-quit-session)
|
||||
;; text-mode ------------------------------------------------------------------
|
||||
(dolist (punc '(?, ?\; ?.))
|
||||
(define-key text-mode-map `[,punc] 'electric-punctuation))
|
||||
|
||||
;; evil-leader shortcuts ======================================================
|
||||
|
||||
|
|
Loading…
Reference in a new issue