reddit / emacs

Lispy-mode : How do you get the matching bracket to be added on the other side of the sexp?

vfclists · 2022-05-30 11:44
I'm trying lispy-mode and any time I add an opening bracket before a sexp the closing bracket is added immediately after it although I usually need it to be on the other side of sexp. Is there some option to get this desired behaviour?
loskutak-the-ptak · 2022-05-30 11:59
Instead of typing ```(```, do ```C-u (``` - that should do exactly what you are looking for. Also have a look at the docstring of ```lispy-pair```: When this function is called: - with region active: Wrap region with LEFT RIGHT. - with region active and arg 1: Wrap region with LEFT RIGHT and put the point after LEFT followed by a space. - with arg nil: Insert LEFT RIGHT. - with arg negative: Wrap as many sexps as possible until the end of the line with LEFT RIGHT. - with arg 0: Wrap as many sexps as possible with LEFT RIGHT. - with the universal arg: Wrap one sexp with LEFT RIGHT. - with arg positive: Wrap that number of sexps with LEFT RIGHT or as many as possible. BTW I have found this using ```C-h k (``` (```describe-key (```) which leads to the ```lispy-parens``` command, with docstring ```lispy-pair with ().``` so I have just checked ```C-h f lispy-pair```.
whudwl · 2022-05-30 12:44
I didn't know this. Thanks!
github-alphapapa · 2022-05-30 18:02
When the region is active and you press `(`, Lispy wraps the region, So I just press `m` to mark the sexp at point, then `(` to wrap it.