From 471fb9168d97622a531b48c669049342c948caaf Mon Sep 17 00:00:00 2001 From: Ade Attwood Date: Sat, 26 Jun 2021 21:00:10 +0100 Subject: [PATCH] feat(emacs): binding to CTRL-; to add semi colon at the end of the line Now in insert mode when editing you can add a semi colon at the end of the current line my pressing CTRL-;. This will then put the cursor after that ready to continue the line or press enter to start a new line. This is inspired by some old vim key bindings I had and a vscode plugin called coloniser. --- site-modules/core/files/emacs/src/evil.el | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/site-modules/core/files/emacs/src/evil.el b/site-modules/core/files/emacs/src/evil.el index b2e2e0f..e94a34a 100644 --- a/site-modules/core/files/emacs/src/evil.el +++ b/site-modules/core/files/emacs/src/evil.el @@ -6,6 +6,11 @@ ;; licence that can be found in the LICENCE file or at ;; https://www.practically.io/copyright/ +(defun aa/semicolon-at-end-of-line () + (interactive) + (end-of-line) + (insert ";")) + (use-package evil :init (setq evil-want-integration t) @@ -21,7 +26,9 @@ (global-set-key (kbd "C-k") 'evil-window-up) (evil-set-initial-state 'messages-buffer-mode 'normal) - (evil-set-initial-state 'dashboard-mode 'normal)) + (evil-set-initial-state 'dashboard-mode 'normal) + + (define-key evil-insert-state-map (kbd "C-;") 'aa/semicolon-at-end-of-line)) (use-package evil-collection :after evil