Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I select multiple lines that are not in a continuous chunk?

Tags:

I am trying to select multiple lines that are not in a continuous chunk. E.g., I want to select line 1 and 3 simultaneously without selecting line 2:

 1. this is line 1   2. this is line 2   3. this is line 3 

Initially I thought this would be a trivia task, but after spending quite some time googling around to no avail, I realized this might not be a simple/common task.

Many thanks in advance for your help.


Edit: Thanks for the responses. I will provide a little more details on how I came up with the question.

I was trying to align a chunk code like the following, using Tabularize:

1. name1="Woof" 2. lucky_dog = lucky( "dog_one"= name1,  3.                    "dog_two"= name1 ) 4. name2="Howl" 

I wanted it to align like this:

1. name1     = "Woof" 2. lucky_dog = lucky( "dog_one"= name1,  3.                    "dog_two"= name1 ) 4. name2     = "Howl" 

But I cannot do so because Tabularize will take third line into consideration, and align everything into:

1.name1                        = "Woof" 2.lucky_dog                    = lucky( "dog_one"= name1, 3.                   "dog_two" = name1 ) 4.name2                        = "Howl" 

I believe I could think of some regex trick to archive the desired results, it just occurred to me at first that maybe I could simply select line 1,2,4 and make those align.

Then I realized this is not a easy task.

Hence the question.

Thanks for the responses!

like image 821
K Z Avatar asked Sep 03 '11 22:09

K Z


People also ask

How do you select multiple non contiguous text lines in browsers?

- When selecting separate words throughout a web page, you can double-click while holding ctrl instead of dragging to select. - When making overlapping selections, ctrl+z will remove the combined selection.


1 Answers

There is now a brilliant plug-in that enables multi-select in Vim: Vim-multiple-cursors:

enter image description here

like image 90
K Z Avatar answered Oct 29 '22 13:10

K Z