Reputation: 7394
I've recently begun using Ctrl-LeftArrow and Ctrl-RightArrow in the IDE to move around on a line of source code (or, for that matter, in any Windows entry screen.) (And of course Ctrl-Shift-LeftArrow highlights the text. Also very helpful.)
I'm delighted at how often it saves me time because I don't have to reach for the mouse.
It takes a bit of practice (as well as learning where your CTRL and arrow keys are so can hit them without looking down), but if you're not using this method to move around Windows documents, I'd encourage you to try it!
Now, as a further speed-up, I would like to jump to the next instance of a single, specific character.
Many years ago I briefly used the "vi" editor, for which, as I recall, typing a lower case g and then a single character jumped to that character. And an upper case G did a "search again" (like ^L) on the previous single character searched for. Of course vi is moded, so this command was available. In the IDE, it would have to be a control character.
I think this would really speed up my moving around my source code in the IDE.
I've never done much with the tools available to enhance the IDE (Delphi 10 here). What tools might I use and how hard would it be to add this to the IDE?
Do any of the third-party IDE add-ins provide this kind of functionality?
TIA
Upvotes: 4
Views: 842
Reputation: 247
You can use CnPack IDE wizards, This wizards provide a pascal script engine that you can enhance the IDE by Pascal scripting, also they provide number of samples with source code. by this script engine you can search and modify the code in IDE editors as way you need.
CnPack Wizards are Open source, then you can use it Free of charge.
site : http://www.cnpack.org/index.php?lang=en for example the code below comes with CnPack this code will make comment the selected code in 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.
Upvotes: 4
Reputation: 15334
Incremental search (Ctrl+E) will do what you want. Type one or more characters, and you are taken to the next occurrence. F3 and Shift+F3 take you back and forth between occurrences.
This has been available since Delphi 1. In recent versions, the feature has been updated to visibly highlight all other occurrences in the edit window.
Upvotes: 12
Reputation:
GExperts(http://www.gexperts.org/) and CNPack(http://www.cnpack.org/index.php?lang=en) is one of the best third party IDE addons available, but I don't remember seeing what you're willing to accomplish, but using the mentioned addons as a starter, one could write his own specific addon. CNPack also provides a built in pascal interpreter which can help you write your own "snippets" that do "something".
Upvotes: 2