SwitchBuffer |
Lee Turner lee@leeturner.org
|
Introduction
The SwitchBuffer plugin is a must for any programmer who hates to take his/her hands
off the keyboard, while wanting to switch buffers. This plugin is similar to the
iswitchb library in emacs. The underlying theme behind each, is that you can type
part of a buffer name and only those buffers whose names contain the string you have
typed, are shown in the buffer list. You can then hit enter to switch to the first buffer
in that list.
Usage
Nothing much to it. You open the SwitchBuffer dialog by selecting the 'Show Switch Buffer' menu item
from the SwitchBuffer menu. The dialog will list all the buffers that you have currently have open.
The textbox at the top of the dialog (which is given focus automatically) is there to type the name
of the buffer that you want to switch to. The list of buffers below is correspondingly updated to
feature only those buffers whose names contain what you have typed.
The first buffer in the list is always selected. Hit Enter or click on the buffer name with
the left mouse button to switch to that buffer. Use the up/down arrow keys or the
shortcuts alt+i / alt+k to select the previous and next buffers respectively. Buffers can
also be closed directly from within the SwitchBuffer dialog by pressing ctrl+w or by clicking
on the buffer name with the right mouse button.
SwitchBuffer also provides another way of switching buffers. This is called a 'File Suffix Switch'.
As the name suggests, this options allows you to switch buffers based on the suffix (the extension)
of the buffer name. If you select this option from the SwitchBuffer menu, SwitchBuffer with take the
name of the currently active buffer and attempt to find any other open buffers with the same first
part of the file name (the part before the dot '.') but with different extensions (e.g index.html
and index.js). If only one other buffer is found, SwitchBuffer will switch to that buffer automatically,
if more than one is found, the SwitchBuffer dialog is displayed to allow you to choose the buffer that you
want.
SwitchBuffer works really well if you assign either of the above options to a shortcut in the
jEdit 'Global Options' so that you can operate it from the keyboard.
If configured to do so (see below), SwitchBuffer also remembers your previous buffer and displays
that buffer name in the text field, so you can simply switch to the previous buffer that you were in
by hitting Enter. This is configurable to allow SwitchBuffer to only remember the previous buffer
if switched using SwitchBuffer, or to allow it to remember the previous buffer you were using no matter
how it was accessed (by using jEdit's buffer switcher for example). The SwitchBuffer dialog also
remembers the size and position that the user previously set for it.
Options
General options:
- On loss of focus, hide switchbuffer window: This option determines what the SwitchBuffer
dialog does when it looses focus. If ticked, the dialog will disappear if it looses focus, if not,
the dialog will remain visible. This option can come in useful if you use an environment where the
mouse cursor determines the window that gets the focus.
Filename matching options:
There are a number of filename matching options available. These are as follows:
- Beginning of filename: This will only match filenames from the beginning of the name. For example,
if I have four files open - 'Shape.java', 'Circle.java', 'TestCircle.java' and 'build.xml' and I type 'Circle'
into SwitchBuffer, only the file 'Circle.java' will be matched.
- Anywhere in filename: This will match filenames from anywhere in the name. For example,
if I have the same four files open - 'Shape.java', 'Circle.java', 'TestCircle.java' and 'build.xml' and I
type 'Circle' into SwitchBuffer, both 'Circle.java' and 'TestCircle.java' will be matched.
- Sub Sequence match: This option implements the subsequence algorithm : The empty string is a
subsequence match of any string. The string aX where a is a character and X is a string is a subsequence
match of Y if a occurs in Y, and the substring of Y after the first occurrence of a is a subsequence match of X.
- Ignore case: This is default behavior. The case of the string you enter is ignored.
File list options:
- Show buffer icons: This is default behavior. The state icons of the buffers are shown next
to their names. Uncheck this if you work on a slow computer and the dialog renders slowly.
- Show files in the colours defined by the file system browser: If you have defined any colours
in the jEdit file system browser, checking this setting will list the files in the SwitchBuffer dialog
using those colours.
- Show directories: This determines whether SwitchBuffer will display the directory of the buffers
in the file list.
- Crop common directory: If the above 'Show directories' option is checked, checking this option
will remove any common directories from the beginning of the directories displayed by SwitchBuffer and only
show the parts that differ. This is useful if the files being edited are in a deep directory tree and the
end of the path is more important than the beginning in determining which file to select in the file list.
If this option is checked, the cropped directory will be displayed in the title bar of the SwitchBuffer dialog.
- Remove currently active buffer from list: This option will stop the currently active buffer (the
buffer you are currently working on in the jEdit text area) from appearing in the list of files that appear
in the SwitchBuffer dialog.
Previously open buffers:
- Remember previous buffer: This option will make SwitchBuffer automatically remember the text that
you enter in the textbox at the top of the SwitchBuffer dialog.
- ...even if not switched by SwitchBuffer: The above option will remember the file name of previous
file only if switched using SwitchBuffer. This option will make SwitchBuffer listen for when the buffer is
changed using other means. This means that SwitchBuffer will always display the last accessed buffer in the
textbox no matter how it was switched.
- Remember any text entered: If SwitchBuffer isn't configured to remember the last accessed buffer
(using the above two options), this option will make SwitchBuffer remember any text entered in the textbox.
License
The source code is distributed under the GPL. Please have a look at:
http://www.fsf.org/copyleft/gpl.html
Feedback
The preferred way to send bug reports is to use the
Sourceforge Plugin Bug Tracker.
You can also write to:
- Lee Turner <lee@leeturner.org>, or
- jEdit Users List <jedit-users@lists.sourceforge.net>, or
- jEdit Devel List <jedit-devel@lists.sourceforge.net>