Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Is there a shortcut for "select next occurrance"?
Forum Updated to NodeBB v4.3 + New Features

Is there a shortcut for "select next occurrance"?

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
keybindingsqt creator
20 Posts 5 Posters 5.7k Views 1 Watching
  • 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.
  • B Beriol

    Lately I had to use a lot other IDEs (such as Visual Studio Code) and I've discovered a magic keybinding for selecting the next occurrence of the currently selected text, which is extremely useful to rapidly find and select the nearby occurrences of text and change them all at the same time without having to do a "find and replace".

    Now I've returned to my beloved QtCreator, but I cannot find this keybinding anywhere (I'm using the latest version, 4.13.2). Is it really missing? If so, is there a workaround, like a macro that could be written or a plugin that does something like this?

    Thanks a lot in advance!

    JonBJ Offline
    JonBJ Offline
    JonB
    wrote on last edited by JonB
    #3

    @Beriol
    Same as in VS, I think: select text, Ctrl+F3. (And Shift+Ctrl+F3 for backward search.)

    B 1 Reply Last reply
    2
    • B Offline
      B Offline
      Beriol
      wrote on last edited by
      #4

      Thank you for your anwser, but I'm looking for a "1 key to do it all" type of thing. The main problem with that approach though is that even if you cycle the occurrences, it doesn't select them for editing.

      Sample example of what I'm looking for: say I have this text "hello, hi, bye, hello, hello, bye, hello, hi".

      I select the 'hello' in bold, then press once the magic keybinding I'd like, and the 'hello' in italics gets selected. Then I press the keybinding again, and the 'hello' with the strikethrough is also selected. Then, if I start typing 'good morning', all the selected occurrences get modified "live".

      Ideally, I'm looking for something like this :)

      JonBJ 1 Reply Last reply
      0
      • B Beriol

        Thank you for your anwser, but I'm looking for a "1 key to do it all" type of thing. The main problem with that approach though is that even if you cycle the occurrences, it doesn't select them for editing.

        Sample example of what I'm looking for: say I have this text "hello, hi, bye, hello, hello, bye, hello, hi".

        I select the 'hello' in bold, then press once the magic keybinding I'd like, and the 'hello' in italics gets selected. Then I press the keybinding again, and the 'hello' with the strikethrough is also selected. Then, if I start typing 'good morning', all the selected occurrences get modified "live".

        Ideally, I'm looking for something like this :)

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by JonB
        #5

        @Beriol
        Which is exactly what Ctrl+F3 does?

        Then, if I start typing 'good morning', all the selected occurrences get modified "live".

        You need to use Refactor > Rename, which will work on code but not your example. And/or to accomplish what you want get used to selecting the desired area and pressing Ctrl+F. I don't know what editor you're talking about which changes all occurrences of a string without some kind of scoped or global "Replace".

        jsulmJ 1 Reply Last reply
        0
        • JonBJ JonB

          @Beriol
          Same as in VS, I think: select text, Ctrl+F3. (And Shift+Ctrl+F3 for backward search.)

          B Offline
          B Offline
          Beriol
          wrote on last edited by
          #6

          @JonB (I noticed your message when I finished writing the last one) sadly that wouldn't work too, because it doesn't actually select the occurrences, it just "highlights" them.

          In the example I mentioned above, if I use Ctrl+F3 as keybinding, when at the end of the example I start typing, it would only change the last occurence, not all of them.

          1 Reply Last reply
          0
          • JonBJ JonB

            @Beriol
            Which is exactly what Ctrl+F3 does?

            Then, if I start typing 'good morning', all the selected occurrences get modified "live".

            You need to use Refactor > Rename, which will work on code but not your example. And/or to accomplish what you want get used to selecting the desired area and pressing Ctrl+F. I don't know what editor you're talking about which changes all occurrences of a string without some kind of scoped or global "Replace".

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #7

            @JonB said in Is there a shortcut for "select next occurrance"?:

            Ctrl+F3

            But it is 2 key? :-)

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            JonBJ B 2 Replies Last reply
            1
            • jsulmJ jsulm

              @JonB said in Is there a shortcut for "select next occurrance"?:

              Ctrl+F3

              But it is 2 key? :-)

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by
              #8

              @jsulm
              No, it is 1.5 keys.

              1 Reply Last reply
              0
              • jsulmJ jsulm

                @JonB said in Is there a shortcut for "select next occurrance"?:

                Ctrl+F3

                But it is 2 key? :-)

                B Offline
                B Offline
                Beriol
                wrote on last edited by Beriol
                #9

                @JonB said in Is there a shortcut for "select next occurrance"?:

                @jsulm
                No, it is 1.5 keys.

                Haha, it counts as a key for what I need. But still, it wouldn't work.

                Here's an example of what I need (taken from Visual Studio Code)

                (testgif.gif

                Here's the same example in QtCreator (with CTRL+F3):
                testgif2.gif

                See what I mean?

                JonBJ 1 Reply Last reply
                0
                • sierdzioS Offline
                  sierdzioS Offline
                  sierdzio
                  Moderators
                  wrote on last edited by
                  #10

                  Ah, what you are looking for is Ctrl+Shift+R. No need to select whole word, just have cursor inside of it.

                  (Z(:^

                  B 1 Reply Last reply
                  3
                  • B Beriol

                    @JonB said in Is there a shortcut for "select next occurrance"?:

                    @jsulm
                    No, it is 1.5 keys.

                    Haha, it counts as a key for what I need. But still, it wouldn't work.

                    Here's an example of what I need (taken from Visual Studio Code)

                    (testgif.gif

                    Here's the same example in QtCreator (with CTRL+F3):
                    testgif2.gif

                    See what I mean?

                    JonBJ Offline
                    JonBJ Offline
                    JonB
                    wrote on last edited by JonB
                    #11

                    @Beriol
                    First, since you have picked to rename a variable in code, this tells me nothing about whether VS is doing a textual replacement or a symbol replacement. Your example is quite different from the earlier one of formatted text/sequence of words. Where does VS Code support formatted text?

                    Anyway. I've told you what your two choices are in Creator here:

                    • Refactor > Rename.

                    • Select an area and Ctrl+F.

                    [EDIT @sierdzio's Ctrl+Shift+R is just a shortcut for Refactor > Rename. Note that this may change multiple files.]

                    B 1 Reply Last reply
                    1
                    • sierdzioS sierdzio

                      Ah, what you are looking for is Ctrl+Shift+R. No need to select whole word, just have cursor inside of it.

                      B Offline
                      B Offline
                      Beriol
                      wrote on last edited by
                      #12

                      @sierdzio

                      That's not it either :(

                      That would change all occurrences in the file (and in the project actually), and it seems to work only for variables (but maybe I'm doing something wrong). What I'm looking for is for any string, not just variables. It should just select occurrences of the selected text, no matter what it is (just like the famous CTRL+F3, but that it actually selects the occurrences for editing).

                      sierdzioS 1 Reply Last reply
                      0
                      • JonBJ JonB

                        @Beriol
                        First, since you have picked to rename a variable in code, this tells me nothing about whether VS is doing a textual replacement or a symbol replacement. Your example is quite different from the earlier one of formatted text/sequence of words. Where does VS Code support formatted text?

                        Anyway. I've told you what your two choices are in Creator here:

                        • Refactor > Rename.

                        • Select an area and Ctrl+F.

                        [EDIT @sierdzio's Ctrl+Shift+R is just a shortcut for Refactor > Rename. Note that this may change multiple files.]

                        B Offline
                        B Offline
                        Beriol
                        wrote on last edited by Beriol
                        #13

                        @JonB My bad with the example, it's a textual replacement. Any text can do, doesn't have to be a variable.

                        Yeah, I know of Ctrl+F of course, same as rename. That doesn't solve it though :(

                        Isn't there a way to create a macro or is there a plugin that could help?

                        EDIT: so, Just to recap, I literally need a version of the CTRL+F3 that also selects the occurrences it's processing, that's it.

                        JonBJ 1 Reply Last reply
                        0
                        • B Beriol

                          @sierdzio

                          That's not it either :(

                          That would change all occurrences in the file (and in the project actually), and it seems to work only for variables (but maybe I'm doing something wrong). What I'm looking for is for any string, not just variables. It should just select occurrences of the selected text, no matter what it is (just like the famous CTRL+F3, but that it actually selects the occurrences for editing).

                          sierdzioS Offline
                          sierdzioS Offline
                          sierdzio
                          Moderators
                          wrote on last edited by
                          #14

                          @Beriol said in Is there a shortcut for "select next occurrance"?:

                          That would change all occurrences in the file (and in the project actually)

                          Depends on scope. If you select a local variable (like in the GIF you posted) it will only rename it inside of that function.

                          (Z(:^

                          1 Reply Last reply
                          0
                          • B Beriol

                            @JonB My bad with the example, it's a textual replacement. Any text can do, doesn't have to be a variable.

                            Yeah, I know of Ctrl+F of course, same as rename. That doesn't solve it though :(

                            Isn't there a way to create a macro or is there a plugin that could help?

                            EDIT: so, Just to recap, I literally need a version of the CTRL+F3 that also selects the occurrences it's processing, that's it.

                            JonBJ Offline
                            JonBJ Offline
                            JonB
                            wrote on last edited by JonB
                            #15

                            @Beriol said in Is there a shortcut for "select next occurrance"?:

                            Yeah, I know of Ctrl+F of course, same as rename.

                            If you mean going via Ctrl+F is same as Rename, it is not. For a start, Ctrl+F will do your "textual" replace, which Rename will not.

                            B 1 Reply Last reply
                            0
                            • JonBJ JonB

                              @Beriol said in Is there a shortcut for "select next occurrance"?:

                              Yeah, I know of Ctrl+F of course, same as rename.

                              If you mean going via Ctrl+F is same as Rename, it is not. For a start, Ctrl+F will do your "textual" replace, which Rename will not.

                              B Offline
                              B Offline
                              Beriol
                              wrote on last edited by Beriol
                              #16

                              @JonB I didn't mean that, I meant that it doesn't solve the problem. Come on, I know you're trying to help and I really appreciate it (I do), but it sohuld be clear what I need right now, isn't it? No point in marking these problems, it's not helpful...

                              EDIT: yes, it does the textual search, but it doesn't "easily" allow to replace the strings, unless you're replacing them one at the time or all of them at once.

                              So, Just to recap, I literally need a version of the CTRL+F3 that also selects the occurrences it's processing, that's it.

                              JonBJ 1 Reply Last reply
                              0
                              • B Beriol

                                @JonB I didn't mean that, I meant that it doesn't solve the problem. Come on, I know you're trying to help and I really appreciate it (I do), but it sohuld be clear what I need right now, isn't it? No point in marking these problems, it's not helpful...

                                EDIT: yes, it does the textual search, but it doesn't "easily" allow to replace the strings, unless you're replacing them one at the time or all of them at once.

                                So, Just to recap, I literally need a version of the CTRL+F3 that also selects the occurrences it's processing, that's it.

                                JonBJ Offline
                                JonBJ Offline
                                JonB
                                wrote on last edited by
                                #17

                                @Beriol
                                It lets you do them one at a time if you want.

                                Anyway, you don't find my answers helpful because Creator does not allow you to do what you show from VS. Best of luck.

                                B 1 Reply Last reply
                                0
                                • JonBJ JonB

                                  @Beriol
                                  It lets you do them one at a time if you want.

                                  Anyway, you don't find my answers helpful because Creator does not allow you to do what you show from VS. Best of luck.

                                  B Offline
                                  B Offline
                                  Beriol
                                  wrote on last edited by
                                  #18

                                  @JonB You misunderstood, I do find them helpful. We've established that there is no "standard" way to do it. So the next bit: is there a way to "extend" QtCreator to do it, such as with a macro or a plugin, that you know of?

                                  aha_1980A 1 Reply Last reply
                                  0
                                  • B Beriol

                                    @JonB You misunderstood, I do find them helpful. We've established that there is no "standard" way to do it. So the next bit: is there a way to "extend" QtCreator to do it, such as with a macro or a plugin, that you know of?

                                    aha_1980A Offline
                                    aha_1980A Offline
                                    aha_1980
                                    Lifetime Qt Champion
                                    wrote on last edited by
                                    #19

                                    Hi @Beriol,

                                    so it seems what you want to do is an extension or special mode of QTCREATORBUG-16013. You may comment and vote there.

                                    Regards

                                    Qt has to stay free or it will die.

                                    B 1 Reply Last reply
                                    2
                                    • aha_1980A aha_1980

                                      Hi @Beriol,

                                      so it seems what you want to do is an extension or special mode of QTCREATORBUG-16013. You may comment and vote there.

                                      Regards

                                      B Offline
                                      B Offline
                                      Beriol
                                      wrote on last edited by
                                      #20

                                      @aha_1980 Yes, I've just read the report and yes, that's exactly want I wanted to do! I'll definitely vote there, tank you! :)

                                      1 Reply Last reply
                                      1

                                      • Login

                                      • Login or register to search.
                                      • First post
                                        Last post
                                      0
                                      • Categories
                                      • Recent
                                      • Tags
                                      • Popular
                                      • Users
                                      • Groups
                                      • Search
                                      • Get Qt Extensions
                                      • Unsolved