I learned from here http://kana.github.io/config/vim/surround.html that yss should operates on the current line, ignoring leading whitespace. But it always includes the leading whitespace on my machine, which looks bad. I am using emacs 24.3. Any ideas? Thank you!
Asked
Active
Viewed 372 times
1
-
Maybe you should report this to the author of evil-surround. For now, just remember it's a difference in behavior between vim-surround and evil-surround. – echristopherson Oct 17 '14 at 17:48
-
1OK, I have created the issue on git hub. – godblessfq Oct 17 '14 at 18:13
1 Answers
0
define your own evil-text-object, a line object with spaces trimmed
Here is the complete setup (tested with evil 1.0.9-):
(defmacro define-and-bind-text-object (key start-regex end-regex)
(let ((inner-name (make-symbol "inner-name"))
(outer-name (make-symbol "outer-name")))
`(progn
(evil-define-text-object ,inner-name (count &optional beg end type)
(evil-regexp-range count beg end type ,start-regex ,end-regex t))
(evil-define-text-object ,outer-name (count &optional beg end type)
(evil-regexp-range count beg end type ,start-regex ,end-regex nil))
(define-key evil-inner-text-objects-map ,key (quote ,inner-name))
(define-key evil-outer-text-objects-map ,key (quote ,outer-name)))))
;; trimmed line
(define-and-bind-text-object "l" "^ *" " *$")
Above code does not work on latest dev version, I already notified the developer. https://bitbucket.org/lyro/evil/issue/478/new-text-object-created-from-regex-hang
chen bin
- 439
- 4
- 8
-
Thank you sir. I find smartparens also quite handy when I want to quote some text. – godblessfq Feb 08 '15 at 01:50