Advertisement

Qt Creator

Started by March 29, 2014 11:16 PM
4 comments, last by Bregma 10 years, 8 months ago

I've recently decided to try out Qt Creator, and while I'm impressed with its features, I'm very frustrated by its Find and Replace functionality. First, I'm bothered by the fact that the replacement buttons don't have mnemonics, so pressing Alt+A, for example, doesn't replace all, but opens a menu. Many other text editors allow you to find and replace without using the mouse; I've tried Tabbing to the buttons, but it only will give focus to the replace all button and the text fields, ignoring the other two replacement buttons and both finding buttons. I tried setting Replace Next to Alt+R in the shortcuts dialog, but pressing Alt+R doesn't seem to do anything; Alt+Shift+R does Replace Previous, but it is hard for that alone to be useful. I bound Replace to Ctrl+R, but I have yet to find out what that actually does, if anything.

In short, find and replace feels weak in Qt Creator, compared to some free text editors out there, and it is heavily affecting my workflow (I use find and replace a lot). Additionally, I can't seem to get it to replace within a single-line selection; every time I make a single-line selection and open the find dialog, it clears the selection if it is shorter than two lines! Are there any plugins for this to augment its behavior? I haven't found any. Has anyone here that uses Qt Creator managed to use keyboard shortcuts for this functionality? Ideally, I'd like it to function like Kate, or at least Notepad++ (not crazy about how MSVS does it, especially regex syntax).

QTCreator has a built in Vim mode , if you enable it you can use:

http://vim.wikia.com/wiki/Search_and_replace

(it even supports regular expressions which is quite nice)

[size="1"]I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!
Advertisement

Does it replace within selections? I can't picture vi supporting it, but I haven't really used it.

Does it replace within selections? I can't picture vi supporting it, but I haven't really used it.

yes, you can limit the search&replace to a selection by adding \%V at the start of the searchString. (you can also restrict it to a line range and a bunch of other things).

with vim (or fakeVim in QTCreator) you can also quickly select text using the keyboard by pressing v (to enter visual/select mode) and then follow it up with the normal commands for block or line manipulation. (viB selects the current { ... } block for example)

Also, if you don't like using fakevim you can just go into tools->options->enviroment->keyboard and add/change the normal keyboard shortcuts. (there are quite a few functions there that don't have a keybinding in the default configuration)

[size="1"]I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!


yes, you can limit the search&replace to a selection by adding \%V at the start of the searchString. (you can also restrict it to a line range and a bunch of other things).



with vim (or fakeVim in QTCreator) you can also quickly select text using the keyboard by pressing v (to enter visual/select mode) and then follow it up with the normal commands for block or line manipulation. (viB selects the current { ... } block for example)

It's certainly a possibility, but that's a steep learning curve to learn the control scheme of an entirely different text editor to work around an inadequate find and replace dialog panel.


Also, if you don't like using fakevim you can just go into tools->options->enviroment->keyboard and add/change the normal keyboard shortcuts. (there are quite a few functions there that don't have a keybinding in the default configuration)

As I said in the original post, I have already tried changing the keybindings there, with mixed success. Not everything I needed could be configured, and while some worked, some did nothing whatsoever, no matter which elements had focus when I pressed the key combination.

If making it behave like Kate isn't possible, I understand.


that's a steep learning curve to learn the control scheme of an entirely different text editor to work around an inadequate find and replace dialog panel

Once you've learned vim, all other editors are inadequate1. Take the plunge now, the only regret you will have is that you didn't learn it sooner.

1 Some say there's an equally good editor buried in emacs, but I have yet to find out how to access it.

Stephen M. Webb
Professional Free Software Developer

This topic is closed to new replies.

Advertisement