From 45de6548f42ae9ab2d66e1908c86ac5f86830f5b Mon Sep 17 00:00:00 2001 From: Riyyi Date: Sat, 30 Jan 2021 16:53:35 +0100 Subject: [PATCH] Add paragraph sort function --- .config/emacs/config.org | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.config/emacs/config.org b/.config/emacs/config.org index 3a27cb9..69c9ed7 100644 --- a/.config/emacs/config.org +++ b/.config/emacs/config.org @@ -1240,6 +1240,17 @@ Vim equivalence: y$" (interactive) (evil-yank (point) (line-end-position))) +(defun dot/evil-normal-sort-paragraph () + "Sort paragraph cursor is under. + +Vim equivalence: vip:sort" + (interactive) + (let ((p (point))) + (evil-visual-char) + (call-interactively 'evil-inner-paragraph) + (evil-ex-sort (region-beginning) (region-end)) + (goto-char p))) + (defun dot/evil-insert-shift-left () "Shift line left, retains cursor position. @@ -1727,7 +1738,8 @@ General.el ~leader key binds. "i f" '(fill-region :which-key "Reflow region") "i F" '(fill-paragraph :which-key "Reflow paragraph") "i r" '(indent-region :which-key "Indent region") - "i s" '(dot/insert-spaces-until-column :which-key "Insert spaces") + "i s" '(dot/evil-normal-sort-paragraph :which-key "Sort paragraph") + "i S" '(dot/insert-spaces-until-column :which-key "Insert spaces") "i y" '(yas-insert-snippet :which-key "Insert yasnippet") ;; Notes