Fork me on GitHub
#spacemacs
<
2020-03-11
>
didibus00:03:06

How do you delete the surrounding sexp, but keep the inner ones?

didibus00:03:11

with smartparens ?

didibus00:03:33

Like say I have:

(do (foo)
    (bar)
    (baz))
and I want:
(foo)
(bar)
(baz)

didibus00:03:08

What I do now is sp-unwrap-sexp which gets rid of the outer parenthesis, and then I manually delete do. But is there a command that would also delete do ?

practicalli-johnny09:03:05

@didibus SPC k r on a child (nested) expressions will replace the parent expression with the child. Unfortunately this will kill any other child expressions, so not quite what you want 😞

Sam H11:03:59

(do |(foo)
    (bar)
    (baz))
with my cursor before (foo) if I do SPC k E it should give what you want

👍 12
zane15:03:47

Does anyone else find it awkward to insert an org-mode link at the end of a line? Since links get inserted before the point, and since you must be in normal mode to insert a link, the only way I've come up with to insert a link at the end of a line is: 1. a to enter insert mode after the current character

A link:
       ^
2. <SPC> to add a placeholder space
A link: 
        ^
3. <ESC> to enter normal mode, with the cursor on the placeholder space
A link: 
       ^
4. ,il to run org-insert-link
A link: 
                                ^
5. x to delete the placeholder space
A link: 
                               ^
Curious whether anyone else has a better way.

practicalli-johnny16:03:09

I usually type the text of the link first, then use v or SPC v to highlight that text. Then , i l after I enter the URL the link text is already populated, so I just press RET .

zane16:03:21

Got it. Do you have a similar workflow for when you want the text to be the title of the webpage?

zane16:03:02

i.e. org-cliplink-like behavior

practicalli-johnny14:03:58

I've never used that function, seems handy though. If its in the body of a text, I would just create an extra space before using it. Or if I forgot, insert the link without the space and use F [ to jump back to the start and i to insert a space.