querypath is a path matcher, forked from https://github.com/ajeetdsouza/zoxide.
It remembers which paths you use most frequently, so you can match
them in just a few keystrokes.
Getting started • Installation • Configuration • Integrations
cat $(q ~/.config/nvim/init.lua) # `cat` `init.lua` while adding a new entry into the database
ls $(q foo.txt) # `ls` the highest ranked file matching foo
vim $(q foo bar) # edit the highest ranked file with a path matching foo and bar
cd $(q foo /) # cd into a subdirectory starting with foo
ls -l $(q -) # view metadata of the previous matched path
vim $(qi foo) # choose file with interactive selection (using fzf) before editing
q foo<SPACE><TAB> # show interactive completions (querypath v0.8.0+, bash 4.4+/fish/zsh only)querypath can be installed in 4 easy steps:
-
Install binary
querypath runs on most major platforms.
Linux / WSL
The recommended way to install querypath is via the install script:
curl -sSfL https://raw.githubusercontent.com/dimarogiv/querypath/main/install.sh | shmacOS
To install querypath, run this command in your terminal:
curl -sSfL https://raw.githubusercontent.com/dimarogiv/querypath/main/install.sh | sh -
Setup querypath on your shell
To start using querypath, add it to your shell.
Bash
Add this to the end of your config file (usually
~/.bashrc):eval "$(querypath init --cmd q bash)"
Zsh
Add this to the end of your config file (usually
~/.zshrc):eval "$(querypath init --cmd q zsh)"
For completions to work, the above line must be added after
compinitis called. You may have to rebuild your completions cache by runningrm ~/.zcompdump*; compinit.Any POSIX shell
Add this to the end of your config file:
eval "$(querypath init --cmd q posix)"
-
Install fzf (optional)
[fzf] is a command-line fuzzy finder, used by querypath for completions / interactive selection. It can be installed from [here][fzf-installation].
Note The minimum supported fzf version is v0.51.0.
-
Import your data (optional)
If you currently use any of these plugins, you may want to import your data into querypath:
autojump
Run this command in your terminal:
querypath import --from=autojump "/path/to/autojump/db"The path usually varies according to your system:
OS Path Example Linux $XDG_DATA_HOME/autojump/autojump.txtor$HOME/.local/share/autojump/autojump.txt/home/alice/.local/share/autojump/autojump.txtmacOS $HOME/Library/autojump/autojump.txt/Users/Alice/Library/autojump/autojump.txtfasd, z, z.lua, zsh-z
Run this command in your terminal:
querypath import --from=z "path/to/z/db"The path usually varies according to your system:
Plugin Path fasd $_FASD_DATAor$HOME/.fasdz (bash/zsh) $_Z_DATAor$HOME/.zz (fish) $Z_DATAor$XDG_DATA_HOME/z/dataor$HOME/.local/share/z/dataz.lua (bash/zsh) $_ZL_DATAor$HOME/.zluaz.lua (fish) $XDG_DATA_HOME/zlua/zlua.txtor$HOME/.local/share/zlua/zlua.txtor$_ZL_DATAzsh-z $ZSHZ_DATAor$_Z_DATAor$HOME/.z
When calling querypath init --cmd q, the following flags are available:
--cmd- Changes the prefix of the
qandqicommands. --cmd jwould change the commands to (j,ji).--cmd cdwould replace thecdcommand.
- Changes the prefix of the
Environment variables[^2] can be used for configuration. They must be set before
querypath init is called.
-
_QP_DATA_DIR-
Specifies the directory in which the database is stored.
-
The default value varies across OSes:
OS Path Example Linux / BSD $XDG_DATA_HOMEor$HOME/.local/share/home/alice/.local/sharemacOS $HOME/Library/Application Support/Users/Alice/Library/Application Support
-
-
_QP_ECHO- When set to 1,
qwill print the matched path before outputting it.
- When set to 1,
-
_QP_EXCLUDE_DIRS-
Excludes the specified paths from the database.
-
This is provided as a list of [globs][glob], separated by OS-specific characters:
OS Separator Example Linux / macOS / BSD :$HOME:$HOME/private/* -
By default, this is set to
"$HOME".
-
-
_QP_FZF_OPTS- Custom options to pass to [fzf] during interactive selection. See
[
man fzf][fzf-man] for the list of options.
- Custom options to pass to [fzf] during interactive selection. See
[
-
_QP_MAXAGE- Configures the [aging algorithm][algorithm-aging], which limits the maximum number of entries in the database.
- By default, this is set to 10000.
-
_QP_RESOLVE_SYMLINKS-
When set to 1,
qwill resolve symlinks before adding paths to the database.Forked from https://github.com/ajeetdsouza/zoxide. @ajeetdsouza thank you for such a great project! Just decided to make it more universal, not only for navigation.
-