Rualdi (Rust Aliasing Directory)
TODO
- Fix/add tests now after adding colored output
- Bash completions
- Color the
%HASHmapping differently - Add
bg, andTrueColorsupport - Colors are getting erased in config
- Set colors for
radffunction - Using
%HASHinradffunction - Use
fzf:tokioandasync
Table of Contents
- Rualdi (Rust Aliasing Directory)
Introduction
Rualdi allows you to create aliases for directories and provides
an encapsulation of the builtin cd command for easy change of the working directory.
You can also add environment variable which points on an alias.
All variables sourced in your environment are prefixed by RAD_.
Inspired by zoxide code.
Examples
# and add environment variable named RAD_WORKDIR
# in current environment and in configuration file
# and add environment variable named RAD_WD
# in current environment and to the configuration file
# on alias workdir in current environment
# and to the configuration file
# which points on alias workdir in current environment
# and to the configuration file
# on alias workdir in current environment
# without adding it to the configuration file
# There are several more options with this function explained below
Getting started
Step 1: Installing rualdi
From Cargo registry
From source
Where <path> is the path where you store your binaries.
On Debian
From source
From .deb pre-built released
You can download a pre-compiled .deb package from the
releases page and add run:
Other (via pre-compiled binary) 
Alternatively, you can also download a pre-compiled binary from the
releases page and add it to
your PATH.
Step 2: Adding rualdi to your shell
Currently only bash and zsh are supported.
bash
Add the following line to your ~/.bashrc:
zsh
Add the following line to your ~/.zshrc:
Configuration
init flags
--cmd: change theradcommand (and corresponding aliases) to something else.
Environment variables
$_RAD_ALIASES_DIR: directory whererualdiwill store its aliases configuration file (default: platform-specific; see the [dirs-nextdocumentation] for more information)$_RAD_NO_ECHO: when set to1,radwill not print the matched directory before navigating to it$_RAD_RESOLVE_SYMLINKS: when set to1,radwill resolve symlinks before print the matched directory.
[colors] section
The default colors that are used are the following, and can be found in the $_RAD_ALIASES_DIR/rualdi.toml file.
[]
= "bright yellow"
= "bright cyan"
= "magenta"
The available colors are:
red,bright redyellow,bright yellowgreen,bright greenblue,bright bluecyan,bright cyanmagenta,bright magentawhite,bright whiteblack,bright black
[alias_map] section
Sometimes the paths can get fairly long, so it is possible to create a hash (really an IndexMap) that will map common paths to something like the following:
/Users/user/.config/zsh/zsh.d = %ZDOTDIR/zsh.d
It can be configured in rualdi.toml, and it is possible to use both a tilde (~) and environment variables.
The left-side is what will be prefixed with a % and displayed.
NOTE: It is wise to create the hash with the most specific variables at the beginning, and the least specific variables at the end.
[]
= "$ZDOTDIR"
= "/Users/user/.config"
= "~/.cache"
= "${HOME}/.local/share"
= "$HOME"
There are already several of these mappings that are ready to be implemented and can be turn on with any of the three:
[]
= "on"
= "1" # Must be a string
= "yes"
fzf integration
Requires:
fzf
The command radf (or <your_cmd>f) provides a way to use rualdi like formarks (a zsh plugin), which
allows one to display the directory aliases with fzf and then cd to the selection.
No arguments
# A query here is optional
pushd wrapper
# This can be any digit
Recently visited directories
# A query here is optional
rad wrapper
# Will also go back to most recently visited directory
# If query is an exact match with an alias, then it's the same behavior as `rad`
Completions
As of now, only zsh completions are available.
This works the best with fzf-tab, which completes your command with fzf when using <TAB>
Installation
This command prints the completions to stdout, so it can be redirected to file file and placed in your fpath.
These completions only work with the actual rualdi binary, and therefore will not work with the aliases that are set because they are all individual functions.
To get completions for the aliases, move the file completions/_rualdi_funcs into your fpath as well.
Extra
Subcommand Aliases
Another way to use rualdi is to set rualdi itself to an alias, and use each subcommands' own alias.
For example, in your .zshrc or .bashrc, place alias r="rualdi". Then use the following aliases: