Skip to content
/ fj Public

Alias directories for faster access. There are more general solutions for this, but this is mine (mainly for learning C).

License

Notifications You must be signed in to change notification settings

pders01/fj

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fj

Fast directory jumper. Resolves aliases from ~/.aliasrc and ~/.aliasrc.d/ and prints paths. A shell function wraps it with cd.

Zero dependencies. No runtime tools required.

Usage

fj <ALIAS>              # resolve alias, print path
fj <ALIAS>/subpath      # resolve alias + append subpath
fj -c <ALIAS>           # interactive subdirectory chooser (built-in TUI)
fj -l                   # list all defined aliases
fj -f <FILE> <ALIAS>    # use custom alias file
fj -h                   # help

With the shell function sourced, fj will cd into the resolved path instead of printing it. The -l flag always prints without cd.

Interactive chooser (-c)

Opens a built-in TUI picker listing subdirectories of the resolved alias path. Navigate with arrow keys or j/k, select with Enter, cancel with Esc or Ctrl+C.

The TUI renders to the terminal (via /dev/tty), so path=$(fj -c myalias) works — the UI appears on screen while the selected path is captured in $path.

Exit codes

Code Meaning
0 Success
1 Usage error
2 Alias not found
3 Path does not exist
4 Cancelled (TUI)
5 Internal error

Alias format

Aliases are defined in ~/.aliasrc or any file under ~/.aliasrc.d/:

alias projects=$HOME/Projects
alias dotfiles=~/dotfiles
alias work="${HOME}/Work"

Lines must start with alias . Quotes around values are stripped. ~ and $HOME/${HOME} are expanded.

Installation

git clone https://github.com/pders01/fj.git
cd fj
make
make install        # installs to /usr/local/bin (override with PREFIX=...)

Then add to your shell rc (.bashrc, .zshrc, etc.):

. /path/to/fj_function.sh

Zsh completion

Tab completion is installed automatically with make install. It supports:

  • fj <TAB> — complete alias names (with paths as descriptions)
  • fj p/<TAB> — complete subdirectories under the resolved alias path
  • fj -<TAB> — complete flags (-c, -l, -f, -h)

To install manually, copy _fj to a directory in your $FPATH:

cp _fj /usr/local/share/zsh/site-functions/_fj

Then reload completions:

rm -f ~/.zcompdump && exec zsh

Uninstall

make uninstall

Remove the . /path/to/fj_function.sh line from your shell rc.

About

Alias directories for faster access. There are more general solutions for this, but this is mine (mainly for learning C).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •