New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
surrounding lines region with empty lines #67
Comments
Any thoughts? I keep wishing I could do this 😄 |
Try using an empty string for your surround pairs? |
That takes care of the problem of it "inserting" two lines on each side. The problems that remain are:
Before (intention is to surround the (use-package evil-surround
:config
(setq-default
evil-surround-pairs-alist
(cons '(?
. ("" . "")) evil-surround-pairs-alist))
(global-evil-surround-mode 1)) After: (use-package evil-surround
:config
(setq-default
evil-surround-pairs-alist
;; whitespace up to this point
(cons '(?
. ("" . "")) evil-surround-pairs-alist))
(global-evil-surround-mode 1)) In other words, the result is as if the point were placed in between the indentation and the first non-whitespace character of the line under the surrounded text, i.e. where the (use-package evil-surround
:config
(setq-default
evil-surround-pairs-alist
|(cons '(?
. ("" . "")) evil-surround-pairs-alist))
(global-evil-surround-mode 1)) Then it's as if one were to press Perhaps this ability requires special casing? |
I would take a shot at implementing it myself as its own separate function, but I'd love to be able to do it on the evil-surround map, so that I can do e.g. |
Yeah it seems to me like it's due to indentation logic, which is the correct thing to do in most cases, but perhaps not in this case. |
Fixed by #73 |
I would absolutely love to be able to do something like
V-S-RET
, that is, select some lines, press the surround operator and then give it an argument of RET so that it surrounds the lines with empty lines. I find myself doing this sometimes to space logically-grouped chunks of code. Doing this via the surround bindings feels the most natural way to do this, so I'm wondering if there's a way.I tried doing it out of the box but it instead added little
^M
markers, which I guess is essentially two lines, or something.Before:
After:
Expected:
So next I tried to add my own surround pair (btw
^M
is the effect ofC-v RET
):But then I end up getting two lines instead of one, and the second one that appears on the bottom is indented, and the previously-following non-whitespace line is unindented.
Before:
After
V-S-RET
:Perhaps this is outside of the scope of evil-surround. I would love it if I could use these bindings though. If this isn't possible via evil-surround, could I perhaps hook on my own function that does this to some evil-surround map so that I can trigger it when I press
S
andRET
?The text was updated successfully, but these errors were encountered: