Where to set word boundaries for Ctrl+Arrow
Hi,
with the default configuration when I walk through $a_multi_word_identifier with Ctrl + Arrow Keys PhpStorm stops before and after the whole identifier. I want it to stop before the identifier, after the $, after each word and after each underscore, just like any other editor (except notepad) does.
(This is because I often take $identifier_for_some_case and make $identifier_for_other_case from it.)
I found some option regarding CamelCase (probably coming from the Java world) but not exacly the configuration for word boundaries. So where is it? In UltraEdit one has to edit the wordfile. Is there such a thing in PhpStorm?
Regards,
André
Please sign in to leave a comment.
Settings|Editor|Smart keys|Use "CamelHumps" words
works both for CamelCase and snake_case
Alexey, no, CamelHumps does NOT work for snake_case as you said. André, I am still looking for that feature. If you have found a way, please share it here. Thank you!
>Alexey, no, CamelHumps does NOT work for snake_case as you said.
Still works perfectly in PhpStorm 2017.2.4 on Windows 10 -- just tested (using Ctrl+Right/Left navigation)
I posted the question in SoF[1] since here it does not work. Maybe cause I use Linux? It should not be the issue.
[1] https://stackoverflow.com/questions/46756884/any-way-to-navigate-in-a-snake-case-name-string-or-variable-in-phpstorm
It works for me.
Note that there are two settings:
Editor -> General -> Smart Keys -> Use "CamelHumps" words
This is for CTRL+left/right. When it's on, the cursor stops at underscores, when it's off, the cursor jumps whole words only.
Editor -> General -> Honor "CamelHumps" words when selecting on double click
This is for double click. When both this setting and the other one are on, double click selects parts of words, when either setting is off, double click selects whole words only.
Both settings work for camel-case and snake-case, but it can not be configured separately. Kebab-case identifiers are always treated as multiple words.
André, you are completely right! There are TWO CamelHumps configs. Just the first one was active here but i activated the second right now and it WORKS now. Thank you so much!
(Would you like to post your answer in SoF? I will accept it if you do.)
I meant that only the second was active but i activated the first right now.
>I meant that only the second was active but i activated the first right now.
So .. you have enabled the wrong option in first place .. and still were saying that "it does not work" .. even though the full path to the option was mentioned twice: here (old (comment is from year 2010), but very close to current one) and on StackOverflow (actual current path)?
User error, right?
> User error, right?
What do you think after all? Sure it was an user error. My bad! I was *very* envolved in a hard project so that I gave not the appropriated attention to the real path. I just gone in Settings > Editor > General and, in the right panel, as soon as I saw the "CamelHumps" config I deduced it was that.
It is slightly confusing that one option is "stop at camel humps/underscores if the other setting says so" instead of just being "stop at camel humps/underscores". :)
User error? Yes. Why did it happen? Non-descriptive wording. I had to Google how to enable this setting. I don't know what CamelHump would pertain to - it looks like something for CamelCase, not applicable for snake_case.That should not be the case. Self-explanatory wording would be useful. For example:
- Treat underscores and camel humps in symbol names as word separators when moving between words using Ctrl+Arrow Left/Right.
- Treat underscores and camel humps in symbol names as word separators when selecting words using double click.
I have created a suggestion (for Pycharm since I had to select one and that is what I use). Hopefully with enough upvotes this will be improved.
https://intellij-support.jetbrains.com/hc/en-us/community/posts/12175601863186-CamelHump-option-wording-is-not-descriptive-