Community
    • Login

    Highlighting range between brackets in a .php file with html code as well

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    phpbracketshtml
    32 Posts 6 Posters 14.8k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Claudia FrankC
      Claudia Frank @Marco Czen
      last edited by

      @Marco-Czen

      close npp, open shortcuts.xml with a different editor and put the following into it.

          <Macro name="Mark_between_brackets" Ctrl="no" Alt="no" Shift="no" Key="0">
              <Action type="2" message="0" wParam="43023" lParam="0" sParam="" />
              <Action type="2" message="0" wParam="42020" lParam="0" sParam="" />
              <Action type="2" message="0" wParam="43009" lParam="0" sParam="" />
              <Action type="2" message="0" wParam="42020" lParam="0" sParam="" />
              <Action type="2" message="0" wParam="43022" lParam="0" sParam="" />
          </Macro>
      

      Save it, close it and start npp. You should now have a menu entry Mark_between_brackets
      under Macro menu.

      What it does is
      43023 - clear any marking using style 1
      42020 - start Begin/end select operation
      43009 - go to matching brace end
      42020 - end Begin/end select operation
      43022 - mark active selection using style 1

      Of course your cursor should be next to the brace to make this work.

      Cheers
      Claudia

      Marco CzenM 1 Reply Last reply Reply Quote 0
      • guy038G
        guy038
        last edited by guy038

        Hi, @marco-czen, @claudia-frank and All,

        Marco,

        • Close any instance of N++

        • Open your active shortcuts.xml file, with an other text editor than N++ ( IMPORTANT )

        • Add, in the Macro section, these lines :

                <Macro name="Test" Ctrl="no" Alt="no" Shift="no" Key="0">
                    <Action type="2" message="0" wParam="43023" lParam="0" sParam="" />
                    <Action type="2" message="0" wParam="43053" lParam="0" sParam="" />
                    <Action type="2" message="0" wParam="43022" lParam="0" sParam="" />
                </Macro>
        
        • Save the modifications

        • Open N++

        Done !

        Notes :

        • 43023 = Search > Unmark All > Clear 1st Style

        • 43053 = Search > Select All Between Matching Braces

        • 43022 = Search > Mark All > Using 1st Style

        • I named this macro Test. Of course, just change this name as you like !


        Claudia, am I missing something ? Your macro or mine give identical results !?

        Cheers,

        guy038

        Claudia FrankC Marco CzenM 2 Replies Last reply Reply Quote 1
        • Claudia FrankC
          Claudia Frank @guy038
          last edited by

          @guy038 said:

          Claudia, am I missing something ?

          No, definitively not :-) - I didn’t see it - need more coffee.
          Your macro, which is basically what Scott suggested, is the preferred one - good job.

          Cheers
          Claudia

          1 Reply Last reply Reply Quote 0
          • Scott SumnerS
            Scott Sumner
            last edited by

            @Claudia-Frank said:

            open shortcuts.xml with a different editor

            @guy038 said:

            Open your active shortcuts.xml file, with an other text editor than N++ ( IMPORTANT )

            I find, with a relatively recent version of N++ (e.g.s: 7.2.2, 7.5.3), that you don’t have to use a “different text editor” (blasphemy anyway!), as long as you haven’t changed via the N++ GUI any other settings that shortcuts.xml holds. Thus, when you quit N++ after editing shortcuts.xml file with it, N++ won’t feel the need to write out that file–and wipe out your manual edits.

            So if you change via the user interface any of these things you definitely don’t want to pull shortcuts.xml into an editing tab and start hacking on it:

            • shortcuts via the Shortcut Mapper (or by using the last menu item on the Macro or Run menus)
            • saved macros by using the macro recorder
            • saved Run menu items created via the Run -> Run… dialog box

            Of course, if you’re a noob or at all tentative about this, maybe the “different editor” approach IS best… :-)

            1 Reply Last reply Reply Quote 2
            • guy038G
              guy038
              last edited by

              Hi, @scott-sumner,

              Thanks for sharing this useful info ! So, seemingly, if you simply do these operations, below, the execution of a added macro should be OK :-))

              • Start Notepad++

              • Open your active Shortcuts.xml file

              • Copy, for instance, the Claudia’s macro, above, named Mark_between_brackets, on the black background ( Ctrl + C )

              • Add a new line at the end of the Macro section, before the ending tag </Macros>

              • Paste the macro contents ( Ctrl + V )

              • Save the new contents of Shortcuts.xml ( Ctrl + S )

              • Close then re-start N++… and enjoy !


              BTW, Scott, you said :

              you don’t have to use a “different text editor” (blasphemy anyway!)

              Yes, it’s a true nonsense, as Notepad++ IS THE text editor ;-))

              Best Regards,

              guy038

              Marco CzenM 1 Reply Last reply Reply Quote 3
              • Marco CzenM
                Marco Czen @Claudia Frank
                last edited by

                @Claudia-Frank - Niceeee

                1 Reply Last reply Reply Quote 2
                • Marco CzenM
                  Marco Czen @guy038
                  last edited by

                  @guy038 - Niceee

                  1 Reply Last reply Reply Quote 1
                  • Marco CzenM
                    Marco Czen @guy038
                    last edited by Marco Czen

                    @guy038 @scott-sumner

                    Hi,

                    I tried both edit methods - using Notepad++ and later Sublime to edit shortcuts.xml but the changes dont seem to be in effect. There is no new entry under the Macro menu. The “Trim Trailing and save” is the only macro there.

                    Am i editing the correct file ? location ( C:\Program Files (x86)\Notepad++\shortcuts.xml ) ?

                    Also ->@scott -> the Autocomplete doesnt offer Scott Sumner’s name ?

                    Scott SumnerS 1 Reply Last reply Reply Quote 1
                    • Scott SumnerS
                      Scott Sumner @Marco Czen
                      last edited by

                      @Marco-Czen

                      Am i editing the correct file ? location ( C:\Program Files (x86)\Notepad++\shortcuts.xml ) ?

                      Could be the issue…that path is only good if you are running a local install. You can tell if this is the case if in your ? (menu) -> Debug Info you see: Local Conf mode : ON. For the other type (which I don’t run so can’t give you exact location) check somewhere in the area of C:\Users\xxxxxx\AppData\Roaming\Notepad++\. Or if you use the Cloud, it is even somewhere else…check Preferences then Cloud…

                      the Autocomplete doesnt offer Scott Sumner’s name ?

                      Yea, too many "Scott"s…the NodeBB software seems to have a problem in this area…can’t scroll down to the one you want if the one you want isn’t already on the screen. :-(

                      BTW, where’s MY “Niceeee” ? :-D

                      Marco CzenM 2 Replies Last reply Reply Quote 2
                      • Claudia FrankC
                        Claudia Frank
                        last edited by

                        Hey, this is a public request, let’s get some NICCEEE for Scott. :-D lol

                        This is mine

                        NNIIIICCCCEEEEEEEEEEEe

                        Cheers
                        Claudia

                        1 Reply Last reply Reply Quote 2
                        • Marco CzenM
                          Marco Czen @Scott Sumner
                          last edited by

                          @Scott-Sumner - NICEEEEEEEEEEEEEEEEEEEEEEEEEEE
                          MERRY CHRISTMAS AND HAPPY HOLIDAYS !!!

                          1 Reply Last reply Reply Quote 2
                          • Marco CzenM
                            Marco Czen @Scott Sumner
                            last edited by

                            @Scott-Sumner - Looks like the actual path is;

                            C:\Users<username>\AppData\Roaming\Notepad++

                            Added the below code block with Notepad++ itself

                            <Macro name=“Highlight Brace2Brace” Ctrl=“no” Alt=“no” Shift=“no” Key=“0”>
                            <Action type=“2” message=“0” wParam=“43023” lParam=“0” sParam=“” />
                            <Action type=“2” message=“0” wParam=“43053” lParam=“0” sParam=“” />
                            <Action type=“2” message=“0” wParam=“43022” lParam=“0” sParam=“” />
                            </Macro>

                            ShutDown and Restarted Notepad and Macros Shows “Highlight Brace2Brace”.

                            The Macro works fine !

                            THANKS GUYS !!!

                            Scott SumnerS 1 Reply Last reply Reply Quote 1
                            • Marco CzenM
                              Marco Czen
                              last edited by

                              Oops spoke too soon …
                              If you run the Macro - The braces get highlighted … and … remains highlighted even when u click outside or ESC .
                              The highlight only disappears when u close the file.

                              Hmmmm…

                              Scott SumnerS 1 Reply Last reply Reply Quote 0
                              • Scott SumnerS
                                Scott Sumner @Marco Czen
                                last edited by

                                @Marco-Czen said:

                                The highlight only disappears when u close the file.

                                Yes, that is correct behavior.

                                You can turn OFF the highlight (without closing the file) by executing the command: Search (menu) -> Unmark All -> Clear 1st Style. As that has no default keycombo I strongly suggest you assign it one using Settings (menu) -> Shortcut Mapper…

                                I also noticed in your macro listing above that you don’t have a keycombo assigned to the macro–for turning the highlighting ON. I suggest you assign one there as well.

                                Marco CzenM 1 Reply Last reply Reply Quote 0
                                • Scott SumnerS
                                  Scott Sumner @Marco Czen
                                  last edited by

                                  @Marco-Czen

                                  Looks like the actual path is C:\Users\<username>\AppData\Roaming\Notepad++

                                  Yes, that is what I meant when I said: C:\Users\xxxxxx\AppData\Roaming\Notepad++\ but I should have been more explicit for those maybe not familiar with the way applications store stuff in ...\AppData\.......

                                  Marco CzenM 1 Reply Last reply Reply Quote 0
                                  • chcgC
                                    chcg
                                    last edited by

                                    Never tried the plugin https://github.com/StanDog/npp-phpautocompletion on my own. Installation via PluginManager or manually, see http://docs.notepad-plus-plus.org/index.php?title=Plugin_Development#How_to_install_a_plugin. Latest release: https://github.com/StanDog/npp-phpautocompletion/raw/master/RELEASES/ccc_1.4.1.zip

                                    1 Reply Last reply Reply Quote 0
                                    • Marco CzenM
                                      Marco Czen @Scott Sumner
                                      last edited by

                                      @Scott-Sumner - Noted. Thanks. You are an asset to this community. Thanks x 1000

                                      1 Reply Last reply Reply Quote 1
                                      • Marco CzenM
                                        Marco Czen @Scott Sumner
                                        last edited by

                                        @Scott-Sumner - Noted. Thanks.

                                        1 Reply Last reply Reply Quote 1
                                        • First post
                                          Last post
                                        The Community of users of the Notepad++ text editor.
                                        Powered by NodeBB | Contributors