keyboard-shortcutstoad

In TOAD, is there a way to comment out arbitrary blocks of code (i.e not whole lines)?


The shortcut to comment out code in TOAD (11.6.16) is CTRL+B

However, the problem is that it does not let you comment out an exact selection within a block of code. So, when I press CTRL+B it simply comments out all the lines of the code , so I can't comment out a specific column with /* .. */ via keystroke.

Is there a way to run the arbitrary /* .. */ commenting ?


Solution

  • Not exactly, but you can get there by a lesser known feature. The Search and Replace macro. In the Editor hit Ctrl+R to get to the replace dialog. On the toolbar click the right-most button to get to the macro editor. Copy the entire contents, below, and paste into that dialog within the left side tree. It'll create a macro for you that I made. Hit close, etc. to get out of that dialog. Now, in the editor whenever you make your selection you can invoke this by using the little dropdown next to the replace button on the Editor toolbar. It's not exactly as easy as using keyboard shortcut, but it works and Search/Replace macros are super powerful for more complex work. Here's the dropdown I'm referring to.

    enter image description here

    Here's the code to copy/paste. Grab everything from (and including) "object" through to (and including) the "end"

    object TComponentCollection
      Items = {
        545046300F5474645265706C6163654D6163726F000B446973706C61794E616D
        65060D436F6D6D656E7420426C6F636B0D49676E6F72654661696C757265080A
        4D6163726F47726F7570080C5365617263684F726967696E070D736F456E7469
        726553636F70650C577261705365617263686573080F50726F6D70744F6E5265
        706C616365080A5465787446696E6465720A9C000000545046300F5474645465
        78745265706C61636572000D4361736553656E7369746976650811526567756C
        617245787072657373696F6E090A5365617263685465726D0606283F73292E2A
        0F536561726368446972656374696F6E07097364466F72776172640A57686F6C
        65576F726473080B5265706C6163655465787406062F2A24302A2F135265706C
        6163655769746854656D706C617465080000054974656D730A32000000545046
        301F547464437573746F6D5365617263685265706C6163654D6163726F4C6973
        7400054974656D730A0000000000000000}
    end