3

Say I have a function

int calc(int that, int this);

I want to mark int that and then move it right across words by hitting modifier arrow key (or similar) twice to get

int calc(int this, int that);

This is left and right, but I'm also interested in moving lines or selected blocks up and down.

young_souvlaki
  • 526
  • 2
  • 13
  • 1
    I used to know a command that did that... – Drew Jun 22 '20 at 22:20
  • 1
    Do you really mean to move whole lines, e.g. the lines touched by the region? If not, what does it mean to move a region forward - does it mean move it forward the same number of chars that it has? – Drew Jun 22 '20 at 22:21
  • 1
    FWIW: If your regions are paragraphs then `transpose-paragraphs` will do the job. Bind it to a key. You can use `M--` to move it backward. – Drew Jun 22 '20 at 22:23
  • 1
    There is a similar discussion here: [How to transpose two arguments of a function in Python? ](https://emacs.stackexchange.com/questions/11061/how-to-transpose-two-arguments-of-a-function-in-python). – Juancho Jun 23 '20 at 18:03
  • 1
    And [here](https://emacs.stackexchange.com/a/47930/53) is a nice function for transposing arguments. – Juancho Jun 23 '20 at 18:05
  • So it seems the short answer is "not built in". Thank you for the links. – young_souvlaki Jul 03 '20 at 13:13
  • @Drew by move forward I mean once `int this` is marked, I can move the region forward one char at a time with arrow keys or `C-f` or one word at a time with `M-f`, putting whatever it hits behind it. – young_souvlaki Jul 03 '20 at 13:14

0 Answers0