When using paredit how do you wrap braces around text? I've used paredit several times however I get frustrated because it stops me from doing what I want.
Example:
(foo
(bar 1 2 3)
baz 1 2 3)
Opps, baz 1 2 3
should be wrapped like so:
(foo
(bar 1 2 3)
(baz 1 2 3))
But, no... :
(foo
(bar 1 2 3)
() baz 1 2 3)
You didn't mention what editor you're working in. In any case if you just enter an opening paren then its closing pair is immediately added as well. In order to wrap an expression in parentheses you need to use a 'wrap' function.
In emacs this can be paredit-wrap-round
or M-(
, please find an emacs paredit cheatsheet here.
In vim using slimv this is ,W
(if you select an expression first then the whole expression will be wrapped).
If you happen to wrap the wrong number of elements then you can move them into/out of the s-expression (see 'slurp' and 'barf' for emacs), or you can move the parenthesis (,<
or ,>
for vim).