Is there any subword navigation support?
-
It seems not to be found from shortcut or main menu. I tried search “subword” in the forum and returned no result. Is there no subword navigation support in notepad++ yet?
-
What is a “subword”, and what kind of support should Notepad++ give you while navigating it?
-
@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.
-
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. -
@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. -
@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
\\[|{|\(|<
-
It is not about searching certain symbol.
Here is a gif to show how it works:
-
@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.
-
@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. -
@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??
-
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, … -
- Ignore what @alan-kilborn said!
- 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.
-
@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.
-
@alan-kilborn said in Is there any subword navigation support?:
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.
-
@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.
They are:
Cheers.
-
@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.
-
@michael-vincent
Thanks