-
Notifications
You must be signed in to change notification settings - Fork 0
Apparix
Apparix allows fast command-line file system navigation by bookmarking directories and jumping to a bookmark directly,
supported by tab completion. In its most powerful form it is used like this:
to mcl e<TAB>
The apparix command for jumping to a bookmark is called to. In this example the bookmark mcl is specified. It is possible to change directory to the path associated with this bookmark directly. However, in the above invocation a further subdirectory of the bookmark is specified using tab-completion, for example expanding to to mcl example. Once selected (by pressing ) the result is a change of directory to /path/associated/with/bookmark/mcl/example.
A common way of organising files is to have projects and sub-projects associated with certain locations in the file system.
Such a location might then have subdirectories such as bin, data, archive, doc, examples, et cetera. Apparix works particularly well in such a layout in conjunction with cyclic tab completion, in bash achieved by bind '"\t":menu-complete'. Bookmarks can be used as entry points into other parts of the filesystem, with tab completion working completely transparently. It is possible to navigate to sibling directories of a bookmark. The following completes on directories that are at the same level as the one bookmarked by mcl and have a name starting with z.
to mcl ../z<TAB>
By default to can use both bookmarks and regular directory names and path names as targets.
All three modes, bookmarks, regular directories, and subdirectories of bookmarks,
allow tab completion on the query string. Additionally,
apparix supplies commands ae (apparix edit) and als (apparix ls) that can be used to invoke distant edit or listing commands on files and subdirectories in bookmarked locations. Most importantly, is is easy to create small custom shell scripts such as ae and als yourself, using the principle of embrace and extend. Examples:
to mcl
Change directory to the location bookmarked by mcl, say /nfs/cvs/mic/mcl/.
to mcl doc
Change directory to a subdirectory of that, /nfs/cvs/mic/mcl/doc.
to mcl doc/test
Change directory to a further subdirectory, /nfs/cvs/mic/mcl/doc/test.
to mcl <TAB> to mcl d<TAB> to mcl doc/te<TAB>
The first will generate directory completions for /nfs/cvs/mic/mcl/, the second for /nfs/cvs/mic/mcl/d, the third for /nfs/cvs/mic/mcl/doc/te.
als mcl als mcl doc
List the contents of /nfs/cvs/mic/mcl, /nfs/cvs/mic/mcl/doc, respectively. Tab completion acts as for to.
ae mcl TODO
Edit /nfs/cvs/mic/mcl/TODO. Tab completion generates all files in the target directory matching the query pattern.
ae mcl doc/TODO
Edit /nfs/cvs/mic/mcl/doc/TODO.
todo mcl todo mcl doc clog mcl
Edit /nfs/cvs/mic/mcl/TODO
, /nfs/cvs/mic/mcl/TODO
, /nfs/cvs/mic/mcl/ChangeLog
, respectively. It depends on the user appreciation and needs whether such custom edit commands are useful or not.