Delphi Productivity Tips: Bookmarks and Navigator Plugins
Posted by david on Thursday, 26 August 2021A couple of years ago, I blogged about my Для просмотра ссылки Войди
If I had to choose only one of these plugins, it would be hard. They work very well together and are an example of the phrase, "the whole is greater than the sum of the parts." I'll start with Bookmarks.
Bookmarks
Delphi has had multiple bookmarks in its code editor for a long time. Simply hit Ctrl+Shift+[number] to set one and then Ctrl+[number] to jump to it. They are specific to the file within they were set (in other words, you can't jump to one from a different file) but you can use numbers 1-9 and use the same numbers for different bookmarked places in different files.If you're like me, you can only remember a few bookmarks at a time. Sometimes, in a long unit, with several similar sections of code, I'll set up to 5 or 6 bookmarks and if I use them in a consistent or logical manner, can actually remember where each of them go--it's useful to bounce between them. But I seldom remember, much less use, that many bookmarks.
The idea of bookmarks is great. The most useful aspect, though--jumping back to where you were editing--is often overshadowed by the fact you often have to jump to a different unit; standard bookmarks only work within the current file. So, before you can use the bookmark to return to your editing, you have to first get back to the unit where the bookmark was created. If you have several files open and you were browsing through other parts of the project, you may not remember the unit name--at least I find that to be the case.
The Bookmarks plugin adds a most useful feature to the standard bookmarks that addresses all these issues: stack bookmarks! The idea is you place a single bookmark, go browse somewhere else in the same or different unit, then hit Escape and pop right back to where you were. This means you don't have to remember what number you assigned and you don't have to remember which file you were in because stack-based bookmarks work across files! Additionally, you can place additional stack-based bookmarks and they add up, popping back off as you use them.

After installing the Parnassus Bookmarks plugin from GetIt, open Tools | Options and expand Third Party | Parnassus and select Bookmarks. There are several options for configuring how they work and how the Bookmarks pane in the IDE looks--which is nicely enhanced with this plugin. You can also configure some shortcuts.
There are a couple of hotkeys I use most often:
- Ctrl+Shift+B: Add or remove a caret bookmark. This is the stack-based bookmark I have described above. The default is pretty easy to remember.
- Esc: Jump to previous caret. This "picks up" or "collects" the stack-based bookmark and removes it. The default is what I would expect to back out of something or return.
Speaking of navigating, let's talk about the partner plugin, also originally from Parnassus, that aids in getting around in the code: Navigator.
Navigator

The Navigator plugin has two main features: Для просмотра ссылки Войди
The default shortcut key is Ctrl+G which activates a pop-up "Go To" window with incremental searching for a list of the current file's contents. But it's not general text search, it knows about the sections of your Delphi unit, about classes, methods, properties and more. And as you type, it filters the list and then you can use the arrow keys to select the item you need, hit Enter and two wonderful things happen: 1) a stack-based bookmark is dropped where you currently are in the code, and 2) you're immediately taken to the selected line in the file. When you're done, just hit Escape (or your configured Bookmarks shortcut for picking up the last caret bookmark to resume editing where you left off.
What I use this for most is to add units to the uses clause as I need them. For example, I start to use a method from the TPath class for the first time in a unit; all I do is hit Ctrl+G, type "impl" (the first few letters of the word "implementation"), hit DownArrow once to select "uses" (or just go to the implementation section if there's no uses clause in that unit yet), add System.IOUtils to the unit list, and hit Escape to continue coding right where I left off!
This is a big time saver--so much more convenient than dropping a numbered bookmark, searching for the implementation section, adding the unit, then trying to remember the numbered book mark I had just set!

There are options to set the size of the mini map and change the default colors.
Together, these two plugins add amazing convenience and time-saving capabilities to Delphi's code editor. Both are free and install quickly from GetIt (Для просмотра ссылки Войди