selection - What is the shortcut to select everything between curly braces in Notepad++?

07
2014-07
  • Jenson M John

    Is there any shortcut in Notepad++ to select all (highlight) codes between the curly braces (start & end)?

    E.g. Code between if-else, nethod definition, while, for loop etc.

  • Answers
  • mrt

    I don't know of any shortcut in Notepad++ that could do what you are trying to achieve but you could record a macro and assign a keyboard shortcut to it:

    1. in the 'Macro' menu click 'Start Recording'
    2. press CTRL + F
    3. in 'Find what' give the following Regular Expression: (?<=\{)[^}]+(?=\})
      (this will find and select all text between 2 matching curly brackets)
    4. make sure that you tick 'Regular Expression' under 'Search Mode'
    5. click 'Find Next'
    6. in the 'Macro' menu click 'Stop Recording', then 'Save Current Recorded Macro...'

    During the last step there is the option to assign a keyboard shortcut for this macro.


  • Related Question

    windows 7 - Why is notepad++ blocking my autohotkey shortcuts?
  • Bruce Connor

    I have a series of keyboard shortcuts defined in my autohotkey script. Currently, none of them work whenever notepad++ has focus.

    The script is loaded as usual. The keyboard shortcuts (mostly stuff for moving windows around) work perfectly with any other window, they just don't do anything if the notepad++ window has focus. At the same time, all regular windows shortcuts work fine, even while notepad++ has focus. So it is a specific issue between notepad++ and autohotkey.

    The shortcuts I've defined in my script don't conflict with any of notepad's standard keyboard shortcuts. Does anyone know what's happening?

    Using Windows 7, notepad++ v5.8.1, autohotkey v1.0.48.03


  • Related Answers
  • RJFalconer

    I think autohotkey will fail to load the keyboard hook unless you run it as admin. If this is the case your keys won't work when another app (notepad++ or otherwise) has focus.

    (I've experienced this behaviour (albeit intermittently) on autohotkey and winamp)

  • Bruce Connor

    Embarrassingly enough, I restarted my PC and now it's back to normal. I have to learn to do that before asking here...

  • Godsmith

    For me, it was enough to restart Notepad++, so try that first.