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.

7
  • 1
    I used to know a command that did that...
    – Drew
    Commented Jun 22, 2020 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
    Commented Jun 22, 2020 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
    Commented Jun 22, 2020 at 22:23
  • 1
    There is a similar discussion here: [How to transpose two arguments of a function in Python? ](emacs.stackexchange.com/questions/11061/…).
    – Juancho
    Commented Jun 23, 2020 at 18:03
  • 1
    And here is a nice function for transposing arguments.
    – Juancho
    Commented Jun 23, 2020 at 18:05

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.