Navigator Plugin

Authors:

Version: 2.7

Build Date: June 22 2016

Introduction:

The Navigator Plugin provides a set of "Back" and "Forward" actions similar to a web browser. This is surprisingly handy. It also provides a "go to line" dialog that can be used to replace jEdit's built in "go to line" dialog.

In addition, Navigator also provides an independent "user stack", where the current position is only pushed in response to "Push Current Position". With this, it is possible to navigate to positions on the user stack via actions "Go To Top" or "Swap Caret with Top", and "Pop Position".

Configuration:

The Navigator configuration has these options:

Moving Around with Navigator

The Navigator works in a "visible" or an "invisible" way. I find it is handy to assign shortcut keys for the actions "back" and "forward" so movement can be done with the keyboard only.

Tip: Bind the actions to Alt+RIGHT and Alt+LEFT and get used to them, because those shortcuts work in IE/Firefox/Konqueror/Chrome/Opera/most browsers too.

Navigator keeps track of the caret positions within the files you have visited. Going back takes you to those previous positions, then it is possible to go forward. The default settings record by caret position, which provides the most granularity for the history. If you want to go back or forward to a different file, you can use the Back file or Forward file actions. I've assigned Alt+PageDown and Alt+PageUp for these, which makes it very convenient to move quickly between locations in two files while still maintaining the granular navigation history within a file.

With 'group by line' selected, movements within a line are not recorded, so some granularity is lost. Each 'back' or 'forward' will move to the next line, not any position within a line.

With 'group by file' selected, only the last location visited within a file is recorded, so a lot of granularity is lost. Each 'back' or 'forward' will move to the next file, not any position within a file. Using the 'back by file' or 'forward by file' actions is probably more useful than using 'group by file'.

The Navigator buttons can become visible in many ways. Adding buttons directly via Global Options - Toolbar is not recommended. Instead use one of these methods below.

  1. Go to Plugins - Plugin Options - Navigator and check "Show Navigator on toolbar". This was broken for about 7 years, is finally fixed in the 2.0 release and is probably the best choice if you generally use the jEdit tool bar.
  2. Go to Global Options - Docking and add a dockable for the Navigator to one of the docking areas. These buttons will grey out if the corresponding stacks are empty and will give you easy control of the Navigator settings.

It is possible to access the previously visited locations directly. From the main menu to Plugins - Navigator, then choose either "Back List" or "Forward List" or "Combined List", then you can pick a specific location from the list popup. You can also assign a shortcut to these lists (Alt+1, Alt+2, and Alt+3, perhaps) by going to the main menu, Utilities, Global Options, Shortcuts, choose Plugin: Navigator, and set the shortcut keys.

Other ways to access the previously visited locations:

Using the "Go to line" dialog

Navigator provided a "Go to line" dialog that can be used as a replacement for jEdit's built in "Go to line dialog. The Navigator dialog has a few features that the jEdit dialog lacks: To use the Navigator "Go to line" dialog rather than the jEdit "Go to line" dialog, just check the box in the Navigator options. The keyboard shortcut that previously activated the jEdit "Go to line" dialog will now show the Navigator "Go to line" dialog.

How Navigator works

Navigator tracks PositionChanging EditBus messages. Going back moves the caret to the previous position. If that previous position happened to be in a different file, then that file will be opened.

PositionChanging messages can be sent by the core or plugins, to notify Navigator that the current position should be saved. Each mouse click will cause one to be sent. When core or a plugin jumps the caret to another position in the same buffer, it should send a PositionChanging message for that editpane.

Some jEdit terminology: A View is a main jEdit window. You can open more Views by using the View menu and selecting "New View". Within a View, an EditPane is the part of the View that contains the text area. You can open more EditPanes by using the View menu and selecting one of the "Splitting" options. Each split is an EditPane.

View Scope:
In View scope, Navigator remembers edit panes. So if you have a split pane, and are scrolling and clicking back and forth between the panes, going back (or forward) will also set focus on the appropriate edit pane, even if you have the same file open in both panes. This works for as many splits as you have.

If you close an edit pane, the history for those files is NOT lost. Quite often, you'll have just one edit pane in your View, you'll split the view to compare a file or to see different parts of the same file, then you'll close the view. The history will be retained for any PositionChanging events that were tracked during the split. The splits won't be restored as you go back or forward, though.

Each View has its own Navigator and history. This means that if you regularly work with two Views open, going back in one View will not take you the other View, rather, the caret will move to the previous location in the current view. If you close a View, the history for that View is lost.

History is not persisted between jEdit sessions, so if you close jEdit, the history is lost.

EditPane Scope:
In EditPane scope, Navigator keeps a separate history for each EditPane. Going back or forward will cause the caret to move only within the current EditPane. To go back and forward in a different EditPane, you'll have to switch to that EditPane.

If you close an EditPane, the history for files within that EditPane is lost.

If you change scope, no history is lost. This means that you can be using View scope, change to EditPane scope to limit back and forward browsing to the current EditPane, then switch back to View scope to browse the entire history. Keep in mind that while in EditPane scope, if you close an EditPane then the history for that EditPane will be lost.

Changelog