We help IT Professionals succeed at work.
Get Started

Select vertical column, uneven word endings

Last Modified: 2017-11-11
private int custid = -1;
private string partnumber = "";
private string description = "";

When editing source code, Is it possible to do a sort of SHIFT + ALT + LEFT CLICK, such that the vertical selection happens across all second spaces in a series of lines?  I don't think VS 2017 Community supports macro recording?  Or Visual Studio, period ... not for many years now, right?

For example, for the first line of code above, imagine the text cursor is blinking **just** after the " t " in "int".  This is the end of the second word on that line, or said another way, it is just before the second space.

To select the same spot for the second and third lines would select just after the " g " in the word "string" on those lines.

Then a few tabs would result in the following:

private int                               custid = -1;
private string                          partnumber = "";
private string                          description = "";

Then I could go back to the beginning of that THIRD column, do a normal SHIFT + ALT + LEFT CLICK from the " c " in custid down to the " d " in description, and add a character (say, an underscore) at the beginning of all of those variable names, like so:

private int                               _custid = -1;
private string                          _partnumber = "";
private string                          _description = "";


Open to a RegEx solution for my search and replace, but preference is some sort of keyboard command.

NOTE:  I found "Tabify" under the Edit - Advanced menu ----- it does not seem to work at all?  It seems to be what I want, but not available in C# text editor?
Watch Question
Senior Consultant
Awarded 2017
Distinguished Expert 2019
This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE