NotePad++ shortcut for selecting whole word
I know in notepad++ i can use mouse doubleclick to select whole word, but i want to use some keybord shortcut. For example in visual studio it's ctrl+w by default and it's very useful. Can i specify shortcut for that action in notepad++ or does it exists?
Might be a better way (and there may be unintended side-effects of this), but from poking around a bit:
Settings, Shortcut Mapper, Plugin Commands, 49 Q:Mark Word or Find Reverse, Modify, then Choose your Shortcut Combination.
Note that Ctrl-W is close by default in Notepad++, so unmap that first (Shortcut mapper, Main Menu) if you want to use that.
Edit: After ten more seconds of poking around, the crippling unintended side-effect of this solution is somewhat obvious. Namely, try this is a test test and then try select test. ;) Sorry.
I couldn't find a built-in command to do this, but I found a way to replicate this functionality.
- Open or create any text file with more than one word in it.
- From the Macro menu, select Start Recording.
- Press Ctrl+← Left. The caret (insertion point/I-beam) will move to the beginning of the word.
- Press Ctrl+Shift+Right →. The word will be highlighted.
- From the Macro menu, select Stop Recording.
- Again from the Macro menu, select Save Current Recorded Macro.
- In the box that appears, assign any name you would like, and select a keyboard shortcut for it. Then click OK.
Your assigned shortcut will now highlight the word the caret is currently inside, except for when the caret is immediately to the left of the first letter of the word, in which case it will select the previous word.
If you need to be able to select a word when the caret is immediately to the left of the word, perform the above steps but alternate the left and right keys, so the caret moves to the right of the word and highlights to the left. In that case it would select the following word if the caret is immediately to the right of the word. You can create shortcuts for both if you desire.
I would hope there's a better way, but I couldn't find one. If someone else knows of one, feel free to provide it and downvote this answer.
I use autohotkey to achieve the same goal. The combination was Ctrl+F+Esc
Ctrl+F select the current word for you, Esc dismiss the Find window.
And it did the trick.
(In SourceInsight there was a default action for this, very useful :)