Apparix

bookmarks for file systems, done right

Apparix is a system to use bookmarks for file system locations in bash and zsh. You can jump to tagged directories and their subdirectories, have easier copy commands, use distant listing and distant editing and anything else where a file system location tag is handy. This all works transparently with tab completion on subdirectories of the bookmark. I love it already - where do I get it? This file.

use bookmarks to tag a location

bm foo # bookmark current directory as foo # later ... to foo # cd to the directory tagged by foo

use tab completion on subdirectories of the mark target, e.g.

to foo <TAB> to foo s<TAB> to foo sub/d<TAB>

use apparix to make copying more convenient

cp file.txt $(apparish foo) cp file.txt $(a foo) # convenient to have a short alias for apparix

use apparix to quickly edit something

ae foo file.txt # tab completion works here too

check target listings

als foo # list foo contents, tab completion compliant ald foo # list foo subdirectories, idem als foo s<TAB> # et cetera

Tab completion with apparix works best, IMHO, with cyclic tab completion. This is activated by the line TAB: menu-complete in the file $HOME/.inputrc, or the line bind '"\t":menu-complete' in $HOME/.bashrc.

Apparix the interface has two implementations: The oldest is called apparix, and the newest is called apparish (thanks Izaak). They are drop-in replcacements, use the same resource files, and you can switch from one to the other if you wish.

The bookmarking system consists of a utiltiy that manages the bookmarks and several shell functions such as to, bm, ae, and a few more. For a long time the utility was a program written in C, itself also called apparix. It requires compilation and installation.

In July 2018, I rewrote the boomark managing utility in pure shell code. I always knew that the C code was a bit heavy-handed, but it took a bout of unrelated activity (apparix for zsh) and some more experience with shell scripting to finally push me to do this. The C program has more options, but none that I use. It may be the case that using the older version leads to fewer greenhouse emissions. Remarkably, the shell code implementation, spaciously written, is only 170 LoC. It is a bit of a slight on the (author of the) C code, really.

The second system of utility+functions is now called apparish, which is the name of the shell function replacing the C program apparix. The advantage of apparish is that you only need to source a single file (works for both bash and zsh) and that's it.

If you want shell apparix, download the bash/zsh file and source it from your .bashrc, .bash_login, or .zshrc if you use the zsh. Issue apparix-init and you're good to go. If you want C apparix, go to this web page. It's very verbose. Alternatively, download the C source code, compile and install it, and use the corresponding bash/zsh code. Happy bm'ing.

Thanks to Sitaram Chamarty for the original idea of sub-directory completion and the first bash implementation thereof, and to Izaak van Dongen for the zsh completion code and integration with the bash completion code. For more history and pointers to other software (in particular Sitaram's highly useful goto locate/cd chimera), visit the first apparix page.