How to select word under cursor?
-
When I press <CTRL+F3> the word surrounding my cursor is selected and the next occurrence is found.
How can I do just the selection? I’m used to <CTRL+W> in Visual Studio to select the word surrounding the cursor but couldn’t find it in Notepad++. -
Hello, @Sanderbouwhuis,
Of course, the N++ action is bit longer that the Ctrl + W one, in Visual Studio, but I would say :
Ctrl + Left arrow
, first, to reach the beginning of the previous or current wordCtrl + Shift + Right arrow
, to select this wordAny other hit, on
Ctrl + Shift + Right arrow
, increases the current selection and any other hit, onCtrl + Shift + Left arrow
, decreases the current selection
In addition, you probably know that any double-click, on a word, or just at its beginning or its end, does select this word !
Best regards
guy038
-
That’s incredibly inconvenient for such a simple function. Can I put this in a macro and bind the <CTRL+W> key to it?
-
Yesssssssssssssssssss, it works. I created and saved a macro.
Still, strange this isn’t a default thing.PS
I had to create a new post because I can’t edit my previous post!PPS
DAMNIT!! Couldn’t post this message because you can only post once per 1200 seconds. What kind of stupid forum system is this?!?? -
Hi, @Sanderbouwhuis,
Ah ! I just noticed that you already created your macro :-D
Nevertheless, have a look to my own macro. It could be of some interest, especially, when the caret is at beginning of a word
Just follow the few steps, below :
-
Select the menu option Settings > Shortcut Mapper…
-
Click on the Close command ( Line 12 )
-
Click on che Clear button, to remove the default
Ctrl + W
shortcut -
Click on the Close button
-
Then, place the caret ( cursor ), in the middle of any word of the current file
-
Select the menu option Macro > Start Recording
-
Hit the
Ctrl + Right Arrow
shortcut -
Hit the
Ctrl + Left Arrow
shortcut -
Hit the
Ctrl + Shift + Right Arrow
shortcut -
Select the menu option Macro > Stop Recording
-
Select the menu option Macro > Save Current Recorded Macro…
-
In the Name field, type in Select Current word
-
Check the CTRL box
-
In the drop-down list, choose the
W
letter -
Click on the OK button, to valid these changes
Et voilà ! Enjoy it :-))
If you prefer, you may add, directly, in your active file shortcuts.xml, with an other editor than N++, the text, below, in the <Macros> section :
<Macro name="Select Current Word" Ctrl="yes" Alt="no" Shift="no" Key="87"> <Action type="0" message="2310" wParam="0" lParam="0" sParam="" /> <Action type="0" message="2308" wParam="0" lParam="0" sParam="" /> <Action type="0" message="2442" wParam="0" lParam="0" sParam="" /> </Macro>
I had to add a first Ctrl + Right action, to be OK, when the caret is located, exactly, at beginning of the word !
Cheers,
guy038
-
-
Thanks for the explanation. I already did all those steps.
Except, I did not do the <CTRL+RIGHT_ARROW>. Why is that necessary? -
Ok, I see your method works better. With your method it doesn’t matter where the cursor is, it will always select the current word.
Thank you very much!
PS
Sorry for the late reply but AGAIN with the stupid 1200 seconds time per post is REALLY annoying. -
Hello, @Sanderbouwhuis,
Yes, The first action
Ctrtl + Right arrow
is necessary, for the unique case, where caret is located just before the first letter of a word ! And, luckily, it does not disturb the selection, if caret is located inside this word or just after its last letter :-))Cheers,
guy038
-
@SanderBouwhuis said:
the stupid 1200 seconds time per post is REALLY annoying
The 1200 seconds thing was put into place some months ago when the community forum had trouble with spammers (talk about really annoying!). The cure for it is making a “really smart” post (or 2) in order to get a couple of upvotes. Then the 1200 second limit won’t apply to you.
Also, I believe you have 180 seconds to edit something you post before it becomes permanent.
-
Dear Scott,
Make a ‘really smart’ post? Every post in this topic has a 0 next to it. This is not about smart posts, it’s about somebody simply removing the limitation by clicking someone’s post regardless of usefulness.
Thanks for the explanation, but to me it is limiting enough that I’ll not be returning to this forum until I can have a normal conversation and edit posts with new insights. Most forums allow you to edit you post as long as no one has added a post after yours. Forums have existed for almost 20 years now and this is one of the worst ways to limit spam.