17

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?

5 Answers 5

7

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.

6
  • That works fine for me
    – x2.
    Mar 25, 2011 at 5:25
  • I've read about test test(think it's regex problem ot something) and now don't know what better macro or that decision :(
    – x2.
    Mar 25, 2011 at 5:38
  • 1
    Mark Word or find Reverse not anymore available there... Jul 27, 2016 at 12:57
  • @florian.isopp I think the command might be found in the "Scintilla" tab of the Shortcut Mapper. Here is a page that presents those commands: docs.notepad-plus-plus.org/index.php/…
    – wip
    Jun 16, 2017 at 3:44
  • I think @Patches answer should be marked as the accepted answer, anyone else agree? Feb 14, 2020 at 21:31
23

I couldn't find a built-in command to do this, but I found a way to replicate this functionality.

  1. Open or create any text file with more than one word in it.
  2. From the Macro menu, select Start Recording.
  3. Press Ctrl+← Left. The caret (insertion point/I-beam) will move to the beginning of the word.
  4. Press Ctrl+Shift+Right →. The word will be highlighted.
  5. From the Macro menu, select Stop Recording.
  6. Again from the Macro menu, select Save Current Recorded Macro.
  7. 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.

2
  • 1
    ctrl + [shift +] left|right work in many applications, it's a good idiom to use through-out your computer. Its awesome in addressbars that support it. Additionally, ctrl+del or ctrl+backspace do something similar.
    – Ape-inago
    Mar 25, 2011 at 7:26
  • This is really good! thank you so much, would you have any idea as to how to mark the next block after marking the word? similar to how many ide's do? Feb 14, 2020 at 21:32
5

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 :)

4

My autohotkey solution, mapping Ctrl-click to select word:

; Allow Ctrl-Click to select current word in notepad++
#IfWinActive ahk_class Notepad++
; Note from Help: The hotkeys Shift::, Alt::, and Control:: fire upon release of the key unless they have the tilde prefix such as ~Alt::. By contrast, a specific left or right hotkey such as LAlt:: fires when it is pressed down.
~Control::
KeyWait, LButton, D T0
if ErrorLevel = 0
{
    Click 2
}
return
#IfWinActive
1
  • I ran into some issues with this. Has it been updated since Sept of 2012? Thanks. Jul 2, 2015 at 20:27
1

This can be done using Scintilla's SCI_MULTIPLESELECTADDNEXT

I've tried to hack PowerEditor\src\Parameters.cpp by adding a line to scintKeyDefs[] as follow (I prefer Ctrl-W):

static const ScintillaKeyDefinition scintKeyDefs[] = {
{TEXT("SCI_MULTIPLESELECTADDNEXT"),SCI_MULTIPLESELECTADDNEXT,true,false,false, VK_W, 0},
    /* ... */
}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .