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!
There is now a brilliant plug-in that enables multi-select in Vim: Vim-multiple-cursors:
It's not possible to select different chunks of text in vim.
What you can do instead is identify a common, unique pattern that is shared by the lines you want to act on and use the 'global' ex-command or 'g' to do it like so:
:g/shared unique pattern/ex or normal command here
For example to copy the lines to a register, say the 'a' register:
:g/shared unique pattern/normal "Ayy
To paste them hit "ap
The capital A that comes before yy tells vim that you want to copy and append the lines to the a register.
Like sydill said if you can tell us what exactly you want to do with the lines then we can better help you.
精彩评论