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... 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? 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. 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/…). Commented Jun 23, 2020 at 18:03
  • 1
    And here is a nice function for transposing arguments. Commented Jun 23, 2020 at 18:05

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.