Is there a way to make a key for "select word" on Win without getting the space in there?

So I want a key that selects whatever word the cursor is on.

I tried to make a macro, but the best I could do is the following sequence:

RightArrow, Ctrl-LeftArrow, Shift-Ctrl-RightArrow, Shift-LeftArrow

The last left arrow is because otherwise Windows selects the space after the word, and I don’t want that space. This works great, except when the word is at the end of the line, and then I lose the last letter. Is there a way to correct this?

If I could just double-click on the word, that would be perfect, but there isn’t a way to do that with a key.

There is a way to double-click with a key, but it’ll do it where the mouse cursor is, which is not what you want. I don’t have a Windows machine, but have you tried this sequence?

  1. ctrl +
  2. ctrl + shift +

Good thought to go backwards, but it’s the same problem - it still includes the space after the word, if there is one.

It looks like I may have to choose between including the space at the end of the word, or missing the last letter if the word ends the line and having to press the key twice.

Unless anyone has a better idea…

If your program only recognizes the start of a word as a boundary, I think you’re stuck.

I don’t think there’s any robust way of doing this because Shift+Ctrl+→ will select a following space, but not punctuation. If you remove an assumed space you won’t select a whole word followed by punctuation.

At least, that’s how it works in LibreOffice which probably mirrors Word behaviour.

This edit box does exactly the opposite—includes punctuation but not spaces.

I checked three text editors (on Linux), Sublime Text, Visual Studio Code and xed. They all only select the word.