Search code examples
intellij-ideaeditorphpstorm

How to select to end of word in intellij-idea / phpstorm


Is there a way to expand a selection to the end of the current word in intellij idea / phpstorm?

For example (ASCII art ahead...)

Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
      <----------------------->|

I have an existing selection from the start of "ipsum" to part-way through "consectetuer". How do I select to the end of that word. Pressing CTRL+SHIFT+Right takes me to the beginning of adipiscing. This is not a big deal when the spacing is small but sometimes it looks more like this:

Lorem ipsum dolor sit amet, consectetuer          adipiscing elit.
      <----------------------->|

And I have two choices... either Right to the end of the current word, or CTRL+SHIFT+Right to the beginning of adipiscing and then Left back to where I want to be.

Most other text editors/IDEs I've used select to the end of the current word. Hopefully there's a settings I cannot find to do the same in PHP Storm!

In the settings there's just the existing CTRL+SHIFT+Right mapped to "Move Caret to Next Word with Selection" and I cannot find any settings anywhere to change this.


Solution

  • There is no separate action that would just extend selection to the "word end", only to the "next word". There is one that would "delete" to the end of the word but nothing for "selection".

    This ticket seems to be asking what you need -- star/vote/comment to get notified on any progress. Since it is in backlog section and has no votes at the moment, I doubt that it is in dev's TODO shortlist.

    If that ticket is not what you need, feel free to submit new Feature Request ticket.

    P.S. Have you tried ideaVim or emacsIDEAs plugins? AFAIK they may (should) support such action.


    UPDATE 2022-12-30:
    The aforementioned IDEA-211369 ticket has been implemented in the 2019.2 version. The behaviour should be controlled by the Caret Movement | When moving by words option in Settings/Preferences | Editor | General:

    enter image description here