Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to select a jagged block in Vim?

Tags:

vim

For example, there are some text like this:

001 aaaaa
002 bbbbbbbb
003 ccc

I want to select

aaaaa
bbbbbbbb
ccc

and yank it. What should I do?

like image 582
user805627 Avatar asked Dec 27 '22 15:12

user805627


2 Answers

The following sequence should do the trick

ggw<C-v>G$

where

gg    -- Goes to top of file
w     -- skips one word
<C-v> -- starts visual block select
G     -- selects until end of file
$     -- selects to end of each line
like image 146
Lieven Keersmaekers Avatar answered Jan 24 '23 20:01

Lieven Keersmaekers


Switch to Visual Mode in Vim by pressing v in prompt

place the cursor in the column to select

Use ctrl+v to select a block to copy

Then the column alone will be selected and copy needed text alone and can yank it:)

Please refer the link here

like image 23
gks Avatar answered Jan 24 '23 20:01

gks