From 7574e13677e5a4301ce006b4a11e7c6a5fa2bb42 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 20 Mar 2018 23:55:33 -0400 Subject: [PATCH] feature/evil: new +evil:align-right command Bound to :ral[ign] --- modules/config/default/+evil-commands.el | 1 + modules/feature/evil/autoload/evil.el | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/modules/config/default/+evil-commands.el b/modules/config/default/+evil-commands.el index 9290fcbc2..6105989a8 100644 --- a/modules/config/default/+evil-commands.el +++ b/modules/config/default/+evil-commands.el @@ -36,6 +36,7 @@ ;; Editing (ex! "@" #'+evil:macro-on-all-lines) ; TODO Test me (ex! "al[ign]" #'+evil:align) +(ex! "ral[ign]" #'+evil:align-right) (ex! "enhtml" #'+web:encode-html-entities) (ex! "dehtml" #'+web:decode-html-entities) (ex! "mc" #'+evil:mc) diff --git a/modules/feature/evil/autoload/evil.el b/modules/feature/evil/autoload/evil.el index 1458997ec..ae08a0091 100644 --- a/modules/feature/evil/autoload/evil.el +++ b/modules/feature/evil/autoload/evil.el @@ -176,6 +176,17 @@ line)." (concat "\\(\\s-*\\)" (evil-transform-vim-style-regexp pattern)) 1 1 bang)) +;;;###autoload (autoload '+evil:align-right "feature/evil/autoload/evil" nil t) +(evil-define-operator +evil:align-right (beg end pattern &optional bang) + "Like `+evil:align', except alignments are right-justified. PATTERN is a +vim-style regexp. If BANG, repeat the alignment for all matches (otherwise just +the first match on each line)." + (interactive "") + (align-regexp + beg end + (concat "\\(" (evil-transform-vim-style-regexp pattern) "\\)") + -1 1 bang)) + ;; --- wgrep ------------------------------