Community
    • Login

    Is there any subword navigation support?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    17 Posts 6 Posters 680 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.
    • PeterJonesP
      PeterJones @Earth Invader
      last edited by

      @earth-invader ,

      What is a “subword”, and what kind of support should Notepad++ give you while navigating it?

      Earth InvaderE 1 Reply Last reply Reply Quote 0
      • Earth InvaderE
        Earth Invader @PeterJones
        last edited by Earth Invader

        @peterjones Subword navigation is a shortcut that help move the cursor between CamelCase words.

        For example, when holding down Alt key and press L/R, the text cursor will jump like these:

        MetaCard<|>SpecialBonus // <|> is the cursor position
        MetaCardSpecial<|>Bonus // Alt + Right
        Meta<|>CardSpecialBonus // Alt + Left + Left
        MetaCardSpecialBonus<|> // Alt + End
        MetaCardSpecial<|> // Alt + Del

        • there is no space in “MetaCardSpecialBonus”, its usually a function or variable name.

        Many text editors that support code editing has some degree of subword navigation support already. e.g. Atom, sublime.

        Alan KilbornA 1 Reply Last reply Reply Quote 1
        • Alan KilbornA
          Alan Kilborn @Earth Invader
          last edited by

          @earth-invader

          IMO that behavior isn’t all that useful.
          But…there is no native support for it in N++, AFAIK.
          However, it would be easy to script such a thing.

          Earth InvaderE dailD 2 Replies Last reply Reply Quote 0
          • Earth InvaderE
            Earth Invader @Alan Kilborn
            last edited by

            @alan-kilborn
            It really depends on the behaviour of the user. I too think the same as you before I get used to it. Now I feel weird when its not there. It increase productivity even if its just a little bit. Everything adds up.

            Neil SchipperN 1 Reply Last reply Reply Quote 0
            • Neil SchipperN
              Neil Schipper @Earth Invader
              last edited by

              @earth-invader A macro (with a shortcut assigned) that does a regex find for any of these [ { ( < gets you 87% - 94% of the way there, no?

              If you want to try it, expression is \\[|{|\(|<

              Earth InvaderE 1 Reply Last reply Reply Quote 0
              • Earth InvaderE
                Earth Invader @Neil Schipper
                last edited by Earth Invader

                @neil-schipper

                It is not about searching certain symbol.

                Here is a gif to show how it works:

                GIF link

                Neil SchipperN 1 Reply Last reply Reply Quote 0
                • Neil SchipperN
                  Neil Schipper @Earth Invader
                  last edited by

                  @earth-invader Ah, I see. A format like

                  <one upper case char><a run of lower case chars>

                  is needed. Expression: (?-i)\u\l+

                  This has some limitations which can be overcome, but first want to know if you’re interested.

                  Earth InvaderE 1 Reply Last reply Reply Quote 1
                  • Earth InvaderE
                    Earth Invader @Neil Schipper
                    last edited by

                    @neil-schipper
                    Thanks for the workaround but it could probably be more troublesome for me to remember another shortcut so I will just press my keyboard harder for now. Hope Notepad++ could support it in the future.

                    Alan KilbornA 1 Reply Last reply Reply Quote 0
                    • Alan KilbornA
                      Alan Kilborn @Earth Invader
                      last edited by

                      @earth-invader said in Is there any subword navigation support?:

                      Thanks for the workaround but it could probably be more troublesome for me to remember another shortcut

                      Make a macro of what @Neil-Schipper said, then assign the running of the macro to whatever keycombo you want using the ShortcutMapper. If you map it to what you’re used to with other editors, then what’s to remember??

                      Earth InvaderE 1 Reply Last reply Reply Quote 0
                      • Earth InvaderE
                        Earth Invader @Alan Kilborn
                        last edited by

                        @alan-kilborn

                        It is not that simple.

                        I just tried recorded a macro Atl+L that simulate pressing Ctrl+L a few times. (jump to left across a few words)

                        When I hold Shift + Alt + L, it doesn’t not select the characters that it jump over.
                        The behaviour is just different from what a native subword navigation would do.
                        If I need to record all the combinations, that would also be a lot of work .
                        e.g. Shift to select, Backspace, Delete, Home, End, …

                        Neil SchipperN Alan KilbornA 2 Replies Last reply Reply Quote 0
                        • Neil SchipperN
                          Neil Schipper @Earth Invader
                          last edited by Neil Schipper

                          @earth-invader:

                          1. Ignore what @alan-kilborn said!
                          2. Pay attention to what @alan-kilborn said!

                          Expanding:

                          Make a macro of what @Neil-Schipper said…

                          I can see that inability to search left/up as being something of a dealbreaker in this context (which reminds that a regex that searched backwards, even if dumbed down somewhat {when used in that direction, and with limitations well documented}, would find good use).

                          … script such a thing.

                          This is the way to go.

                          1 Reply Last reply Reply Quote 3
                          • Alan KilbornA
                            Alan Kilborn @Earth Invader
                            last edited by

                            @earth-invader said in Is there any subword navigation support?:

                            It is not that simple.

                            Well, it is…on a demo basis…to try some basic functionality out…

                            But yes, really what is needed here is a “script” that can build in all the “smarts” that are needed.

                            1 Reply Last reply Reply Quote 1
                            • dailD
                              dail @Alan Kilborn
                              last edited by

                              @alan-kilborn said in Is there any subword navigation support?:

                              @earth-invader

                              IMO that behavior isn’t all that useful.
                              But…there is no native support for it in N++, AFAIK.
                              However, it would be easy to script such a thing.

                              Scintilla has commands associated with word part navigation. However I’m not sure if Notepad++ exposes these to be mapped to shortcuts or not.

                              Michael VincentM 1 Reply Last reply Reply Quote 3
                              • Michael VincentM
                                Michael Vincent @dail
                                last edited by

                                @dail said in Is there any subword navigation support?:

                                Scintilla has commands associated with word part navigation. However I’m not sure if Notepad++ exposes these to be mapped to shortcuts or not.

                                @Earth-Invader

                                They are:

                                fdd69a28-8698-43cb-814d-2f8c8c32b65c-image.png

                                Cheers.

                                Neil SchipperN Earth InvaderE 2 Replies Last reply Reply Quote 7
                                • Neil SchipperN
                                  Neil Schipper @Michael Vincent
                                  last edited by

                                  @michael-vincent Funny, I just started playing around with those like in the last 24 hrs (and gave them a mention in a post in a different thread). I’d been wondering, “why do these even exist? they’re just annoying or crippled versions of Ctl-<arrow>”, which they are… in the absence of CamelCase.

                                  Your post clued me in.

                                  1 Reply Last reply Reply Quote 2
                                  • Earth InvaderE
                                    Earth Invader @Michael Vincent
                                    last edited by

                                    @michael-vincent
                                    Thanks

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