Sunday, April 22, 2007

Ctrl-Shift-Up and Ctrl-Shift-Down

... there may just be a little more to them, than what initially meets the eye. Now it might be common knowledge to you guys -but- I was doing a little research on an article [learning actually] on using the keyboard and forgetting about the mouse when I came across one of those “Wow, that is seriously cool!” features that I just love to find. Ctrl-Shift-Up is a powerful [and pretty clever] little bugger –but- then so is its partner Ctrl-Shift-Down … maybe even more than you would initially think. Now, it may just be because I'm new to even looking at keyboard short-cuts [yea, I know ... I know] but this just makes things so much faster to get to. Using either of these keyboard short-cuts on a run of the mill method is a handy bit of knowledge to have when you need to toggle the cursor between the method and it’s declaration. Have you tried it on a Property declaration or method? From a Property declaration it will toggle the cursor to the first “etter” declaration it finds, from then on you can toggle between the “etter” declarations by continuing to key in Ctrl-Shift-Up. I suppose it’s waiting for you to decide on which of them you want to Ctrl-Shift-Down to. If it only finds one “etter” then it will go there and keying in Ctrl-Shift-Up again toggles back to the Property declaration … probably in case you want to add the missing sibling. If you’ve toggled down [Ctrl-Shift-Down] to either of the “etter” methods Ctrl-Shift-Down again ... you end up in the other “etter” method. How cool is that, eh? Thanks for stopping by, -- Dave

11 comments:

  1. If that is a) cool and b) a surprise then I imagine you will be blown away by Ctrl+E

    Type Ctrl+E and the editor enters "incremental search" mode - whatever you type now, the editor will find the first/next occurence of. F3 will then find the next, etc etc

    It never ceases to amaze me that so many long-standing Delphians remain blissfuly aware of this feature that has been there since 1.0!

    Or maybe you knew of that one already?

    ;)

    ReplyDelete
  2. Hi Jolyon,

    No, I have yet to look into Ctrl-E and play with it in the IDE to see what it can do. As I mentioned this all came about looking into the keyboard short-cuts.

    Thanks for the tip, and for stopping by, it's appreciated.

    --
    Dave

    ReplyDelete
  3. Another couple of navigation keystrokes:

    Ctrl+Alt+Down or Up jumps to the next/previous method.

    Ctrl+Alt+Home or End jumps to the first/last method in the current unit.

    I hope you blog about more of your findings.

    ReplyDelete
  4. While on the subject, here are some favourites of mine:

    CTRL+SHIFT+I indent a block of code
    CTRL+SHIFT+U unindent a block of code
    CTRL+/ toggle comment on a block of code

    ReplyDelete
  5. Make the last one:
    CTRL+' to toggle comment on/off on international keyboards.

    ReplyDelete
  6. @Bruce
    There is definitely more coming. I was actually in the middle of a [rather large] post on what can be done in the code editor but broke out when I saw what was happening during my testing of Ctrl-Shift-Up/Down.
    @Robert
    Thanks, knowing the ones that get used most often helps for placement and emphasis in an article.
    @PeterS
    Guess I should really consider the international perspective - thanks, I will do my best.


    Thanks for the tips.

    ReplyDelete
  7. Install GExperts and you'll have access to even more amazing ones:
    CTRL+ALT+<UP>/<DOWN> to go to the next instance of the word you're currently on with your cursor.

    CTRL+ALT+./CTRL+ALT+, to (Un)Comment a block of code out

    ReplyDelete
  8. Hi Walter, by all accounts GExperts is indeed an excellent addition to the IDE. Although I've used GExperts before with both D7 and BDS2006 ... I can't say I ever made it "work for a living". What I did use in it, was excellent. I've since [sort of] switched to CnPack and although I've yet to become a CnPack power user ... I think I'll stick with just that for now. If I find that there's something missing that GExperts provides I'll certainly have another look at it. One step at a time for me now. I used to shove everything I could get my hands on into the IDE -but- not any more. For me, if I don't plan on taking the time to become proficient with it ... I'm not going to install it. It just gets too cluttered with things that I either just don't know or have sufficient time to learn how to [properly] use.
    If you're interested, you can have a squint at CnPack here:
    http://cnpack.org/

    Thanks for the comment, it's most appreciated.
    --
    Dave

    ReplyDelete
  9. you might want to check out the following page http://delphi.wikia.com/wiki/Default_IDE_Shortcut_Keys.

    maybe even help out and edit the page for missing or incorrect shortcuts.

    ReplyDelete
  10. xsintill, I've been using the page as a reference, one of many, but ... excellent point.

    ReplyDelete
  11. This comment has been removed by a blog administrator.

    ReplyDelete