Allow :align to accept vim-style regexps

This commit is contained in:
Henrik Lissner 2016-02-27 13:47:33 -05:00
parent b157370da9
commit 6851951aaf

View file

@ -232,13 +232,14 @@
(when (evil-ex-p) (evil-ex-parse-global evil-ex-argument))) (when (evil-ex-p) (evil-ex-parse-global evil-ex-argument)))
(evil-define-operator narf:align (&optional beg end bang pattern) (evil-define-operator narf:align (&optional beg end bang pattern)
"Ex interface to `align-regexp'. Accepts vim-style regexps."
(interactive "<r><!><//>") (interactive "<r><!><//>")
(align-regexp (align-regexp
beg end beg end
(concat "\\(\\s-*\\)" (concat "\\(\\s-*\\)"
(if bang (if bang
(regexp-quote pattern) (regexp-quote pattern)
(rxt-pcre-to-elisp pattern))) (evil-transform-vim-style-regexp pattern)))
1 1)) 1 1))
(evil-define-operator narf:evil-ex-global (beg end pattern command &optional invert) (evil-define-operator narf:evil-ex-global (beg end pattern command &optional invert)
:motion mark-whole-buffer :motion mark-whole-buffer