• Login
Community
  • Login

How to select word under cursor?

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
10 Posts 3 Posters 9.0k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S
    SanderBouwhuis
    last edited by Apr 29, 2017, 11:23 AM

    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++.

    1 Reply Last reply Reply Quote 0
    • G
      guy038
      last edited by guy038 Apr 29, 2017, 1:32 PM Apr 29, 2017, 1:31 PM

      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 word

      Ctrl + Shift + Right arrow, to select this word

      Any other hit, on Ctrl + Shift + Right arrow, increases the current selection and any other hit, on Ctrl + 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

      1 Reply Last reply Reply Quote 0
      • S
        SanderBouwhuis
        last edited by Apr 29, 2017, 2:21 PM

        That’s incredibly inconvenient for such a simple function. Can I put this in a macro and bind the <CTRL+W> key to it?

        1 Reply Last reply Reply Quote 0
        • S
          SanderBouwhuis
          last edited by Apr 29, 2017, 4:28 PM

          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?!??

          1 Reply Last reply Reply Quote 0
          • G
            guy038
            last edited by guy038 Apr 29, 2017, 5:06 PM Apr 29, 2017, 5:03 PM

            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

            1 Reply Last reply Reply Quote 0
            • S
              SanderBouwhuis
              last edited by Apr 29, 2017, 6:22 PM

              Thanks for the explanation. I already did all those steps.
              Except, I did not do the <CTRL+RIGHT_ARROW>. Why is that necessary?

              1 Reply Last reply Reply Quote 0
              • S
                SanderBouwhuis
                last edited by Apr 29, 2017, 6:43 PM

                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.

                S 1 Reply Last reply Apr 29, 2017, 9:05 PM Reply Quote 0
                • G
                  guy038
                  last edited by Apr 29, 2017, 8:32 PM

                  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

                  1 Reply Last reply Reply Quote 0
                  • S
                    Scott Sumner @SanderBouwhuis
                    last edited by Apr 29, 2017, 9:05 PM

                    @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.

                    1 Reply Last reply Reply Quote 0
                    • S
                      SanderBouwhuis
                      last edited by Apr 30, 2017, 8:56 PM

                      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.

                      1 Reply Last reply Reply Quote -1
                      6 out of 10
                      • First post
                        6/10
                        Last post
                      The Community of users of the Notepad++ text editor.
                      Powered by NodeBB | Contributors