Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to move a block or column of text

Tags:

vim

I have the following text as a simple case:

... abc xxx 123 456 wer xxx 345 678676 ... 

what I need to move a block of text xxx to another location:

... abc 123 xxx 456 wer 345 xxx 678676 ... 

I think I use visual mode to block a column of text, what are the other commands to move the block to another location?

like image 634
David.Chu.ca Avatar asked Mar 06 '09 20:03

David.Chu.ca


People also ask

How do I move a block of text in Vim?

In normal mode or in insert mode, press Alt-j to move the current line down, or press Alt-k to move the current line up. After visually selecting a block of lines (for example, by pressing V then moving the cursor down), press Alt-j to move the whole block down, or press Alt-k to move the block up.

How do I move a column from one place to another?

Drag the rows or columns to another location. Hold down OPTION and drag the rows or columns to another location. Hold down SHIFT and drag your row or column between existing rows or columns. Excel makes space for the new row or column.


1 Answers

You should use blockwise visual mode (Ctrl+v). Then d to delete block, p or P to paste block.

like image 80
Paul Avatar answered Sep 18 '22 02:09

Paul