Open cute-jumper opened 8 years ago
sp-rewrap-sexp
:)
Do you plan to add commands to change pairs?
Evil-surround
has a similarchange
function inherited fromsurround.vim
.Smartparens
are good at inserting/manipulating pairs, would it be better if pair changing commands are also supported?
You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/Fuco1/smartparens/issues/591
Best regards, Matúš Goljer
Thanks. I'm not aware of this before. But it is not possible to choose what to be replaced. For example, if the cursor is in the middle of foo
, it is impossible to use sp-rewrap-sexp
to achieve:
("foo") => ["foo"]
Maybe it be better to have a more general sp-rewrap-sexp
?
Could be. How would you imagine it should work? I don't know vim nor surround.
Just prompt the user for two inputs, one for the old surrounding pair, and the other for the new surrounding pair, and then find the nearest old surrounding pair and replace it with the new pair.
M-x our-rewrap-command
, then (
and [
, we could achieve(|
is the cursor location)
(("fo|o" bar) baz) => (["fo|o" bar] baz)
Maybe you can look at evil-surround.
EDIT: Fix missing link.
Perhaps while the prompt is active, the pair being changed could be highlighted, and the keybindings C-f
and C-b
could move between them.
FWIW, I implemented embrace (and evil-embrace) myself based on expand-region
to achieve something similar.
Do you plan to add commands to change pairs?
Evil-surround
has a similarchange
function inherited fromsurround.vim
.Smartparens
are good at inserting/manipulating pairs, would it be better if pair changing commands are also supported?