anchored-transpose may be another option.
Bind anchored-transpose
to C-x t
, then you can mark the first statement, press C-x t
, mark the second statement, press C-x t
, and these two statements are swapped. It seems NOT very convenient at the first sight, so it's better if you use it with other packages which can quickly mark the statements.
EDIT: I've just realized that anchored-transpose
may not be a good solution to this special case. If you quickly mark the region, you can just do a C-w
to kill the region then paste it. anchored-transpose
should fit some more general cases where there are no something like sexp
or statement
, just random texts.
C-M-t
(transpose-sexps
) help? It's supposed to, but maybe it doesn't in C. – Drew Feb 27 '16 at 20:55transpose-*
commands (transpose-paragraph
?) help at all here. Anyway, probably there are 3rd-party libraries that offer what you request, and hopefully someone will let you know here. – Drew Feb 28 '16 at 02:08sp-transpose-hybrid-sexp
docs fromsmartparens
will do it, at least it you put parenthesis around the pair of strings. – Omar Feb 29 '16 at 17:31