Selection multiple variables or types with different lengths in vscode

So imagine I have mutiple lines of variable and their definitions in multiple lines like this (for example in flutter) :

 TypeA a;
 TypeABCD abcd;
 Typ abcdefghijklmnopqrstuwxyz;

now I want to select all of the types together or all of the variables together; I know how to select multiple line together in vscode but the problem is in this case it does not cover the specific selection of them or it selects them partly because they have different lengths. how can I select multiple variables or types or whatever in this case?

imagine what I want to select is:


how can I do that?

or this:


>Solution :

You can press "option" on Mac or "ctrl" on other OS to navigate cursor by word and not character.

So the trick is to do multi-cursor on each line then use word navigation to select what you want – press Ctrl + Shift + -> for example to select first word in each line even if words are of different length.

Its pretty hand and I use even more complex tricks to be productive, hope this helps.

Below is video showing the same.

Sample image
enter image description here

Leave a Reply