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.

  • 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? ](emacs.stackexchange.com/questions/11061/…). – Juancho Jun 23 '20 at 18:03
  • 1
    And here is a nice function for transposing arguments. – Juancho Jun 23 '20 at 18:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.