Vim: moving visual highlight, not text, lines up and down

If I have this visually selected line

Alpha <-- selected Bravo Charlie 

is there a vim command to move the selected area down without adding to the original selection?

 Alpha Bravo Charlie <-- selected 
Key

hjkl will add lines only to your choice. And I did not see anything in the visual reference document that indicated that this could be done.

+4
source share
3 answers

This will definitely do this:

j j V V

But this is actually no different from overriding the original selection:

esc j j V

Or:

V j j V

+2
source

In select mode, you can use o (lower case) to exchange between moving the upper and lower bounds. Thus, you can do this without leaving selection mode using j j o j j .

+6
source

As far as I understand your question, you want to select Alpha and move it. Say move Alpha under Charlie. You need to select Alpha in visual mode, and then type: (colon) and type m 3. Thus, your input format should look like : m 3 . This means moving the selected text to line 3. I hope this is your question. Excellent day.

0
source

All Articles