Quick IDE navigation with a single key to search for a single character (vi-like)

I recently started using Ctrl-LeftArrow and Ctrl-RightArrow in the IDE to move around a line of source code (or, for that matter, on any Windows input screen). (And of course, Ctrl-Shift-LeftArrow selects the text. Also very useful.)

I am delighted with how often this saves me, because I do not need to get to the mouse.

It takes a bit of practice (as well as exploring where your CTRLs and arrow keys can hit them without looking down), but if you don't use this method to move Windows documents, I would recommend that you try!

Now, as an additional acceleration, I would like to move on to the next instance of one particular character.

Many years ago, I briefly used the “vi” editor, for which, as I recall, I typed lowercase g, and then one character jumped to that character. And uppercase G performed a “search again” (eg ^ L) on the previous single character. Of course, vi is modified, so this command was available. In the IDE, it must be a control.

I think this will really speed up my move of my source code in the IDE.

I have never done much with the tools available to improve the IDE (here Delphi 10). What tools can I use and how difficult would it be to add this to the IDE?

Does any of the third-party IDE add-ons support this functionality?

TIA

+4
source share
3 answers

You can use the CnPack IDE wizards. These wizards provide a pascal script mechanism that you can enhance your IDE with Pascal scripts, and they also provide a number of source code samples. With this script engine, you can search and modify code in IDE editors as you need.

CnPack Wizards is Open Source and you can use it for free.

website: http://www.cnpack.org/index.php?lang=en for example, the code below comes with CnPack, this code will comment on the selected code in the IDE editor

{*******************************************************} { } { Pascal Script Source File } { Run by RemObjects Pascal Script in CnWizards } { } { Generated by CnPack IDE Wizards } { } {*******************************************************} program CommentCode; uses Windows, SysUtils, Classes, CnWizIdeUtils; var Lines: TStringList; i: Integer; begin Lines := TStringList.Create; try if IdeGetEditorSelectedLines(Lines) then begin for i := 0 to Lines.Count - 1 do begin Lines[i] := '//' + Lines[i]; end; IdeSetEditorSelectedLines(Lines); end; finally Lines.Free; end; end. 
+4
source

Incremental search (Ctrl + E) will do what you want. Enter one or more characters and you will be taken to the next occurrence. F3 and Shift + F3 move you back and forth between occurrences.

This has been available since Delphi 1. In recent versions, this feature has been updated to visibly highlight all other entries in the editing window.

+12
source

GExperts (http://www.gexperts.org/) and CNPack (http://www.cnpack.org/index.php?lang=en) are one of the best IDE third-party adjutants available, but I don’t remember that you ready to perform, but using the mentioned add-ons as a starter, you can write your own specific addon. CNPack also provides a built-in pascal interpreter that can help you write your own “snippets” that do “something.”

+2
source

All Articles