I pity the fool who messes with CTRL-SHIFT-T.

Tags: .NET, Visual Studio

The Visual Studio IDE, among its myriad options and combinations and features and so forth, has a trio of rather odd key combinations:

CTRL-T - Interchanges the current letter and the one after it.
CTRL-SHIFT-T - Same thing, only for the current word.
ALT-SHIFT-T - Same thing, only for the current line.

These keybindings have been there at the very least since Visual Studio 4, where I first came across them.

And I wonder - what are they good for? Is there anyone that uses them regularly, or at all? What are they good for?

14 Comments

  • Frans Bouma said

    Perhaps to quickly correct 'teh' to 'the' etc. ? Otherwise it will require more keystrokes. (not that I use it, I sometimes accidently pressed those and wondered, 'what happened? and why!?' :D

  • Jason said

    I actually use ALT-SHIFT-T all the time. It doesn't offer hours of time savings or anything but it's just a slightly better way to do something small which you can't argue is a bad thing.

    Say you have a line of text:

    > This is a test.

    And then you realize you want to put a DIV around it... you start by adding the DIV to the IDE where it automatically closes the DIV for you:

    > <div></div>
    > This is a test.

    Break the opening and closing DIV apart:

    > <div>
    > </div>
    > This is a test.

    Put the cursor on the "</div>" line and press ALT-SHIFT-T:

    > <div>
    > This is a test.
    > </div>

  • Tobin Titus said

    I'm a keyboard shortcut junkie. With each new release of a dev tool, I always learn the new ones. I loved this combination, particularly when I want to move something down a few lines.

    Lets say, for instance, that I've assigned a variable on one line, but after testing I decide I should do the assignment after a few other operations. I ALT+SHIFT+T the line all the way down to where I want it. Very useful. Sure, you could accomplish the same thing with a cut and paste, but why would you when you can do it with one hand! ;)

  • Frederic said

    The same feature was available under Emacs and shell on Unix (don't know for vi, but would not be a surprise).
    I suppose that it was very useful when typing from a unix console without proper arrow keys/backspace support !
    Funny to see features 10+'s years old to still be around !

  • tickko said

    Tobin Titus...interesting use for Ctrl+Shift+T. Another great way to cut a whole line with a return after it in VS, Shift+Delete (cuts the line with a return, it doesn't matter where you are in the line) and Shift Insert or Ctrl V (paste).

  • pelesl said

    I would love it if there were a "transpose" command for = signs. So if you say x = y a magic key press would switch it to y = x I can't imagine the guy who put it in these functions in Visual Studio couldn't come up with a use for the one I want---so anyone know if that's already in there?

  • Byars said

    It’s nearly impossible to uncover knowledgeable individuals within this topic, then again you sound along the lines of you recognize what you have been speaking about! Thanks

  • Santos said

    Youre so cool! I dont suppose Ive read anything such because this prior to. So nice to discover somebody by original applying for grants this subject. realy we appreciate you beginning this up. this website is one thing which is needed over that the internet, an individual after some originality. helpful project for bringing new stuff for the web!

  • Carvalho said

    When I originally commented I clicked that the “Notify me when new comments have been added” checkbox and now each time a comment is added I find out a couple of e-mails with the same comment. Is there any other method you'll remove me out of that service? Appreciate it!

Comments have been disabled for this content.