[!TIP]
fuzzy_shell
combines thefd
andfzf
tools, making it more user-friendly.fuzzy_shell
offers fuzzy jumping, editing, and file searching capabilities.
# clone the repo
git clone https://github.com/Albert26193/fuzzy-shell.git
# install on Linux
cd fuzzy-shell && sudo bash install/install.sh
# install on Mac (no sudo)
cd fuzzy-shell && bash install/install.sh
~/.bashrc
or ~/.zshrc
, the installation is successful 🎉:# ~/.bashrc or ~/.zshrc
#------------------- fuzzy-shell -------------------
source "${HOME}/.fuzzy_shell/scripts/export.sh"
alias "fs"="fuzzy --search"
alias "fj"="fuzzy --jump"
alias "fe"="fuzzy --edit"
alias "fh"="fuzzy --history"
Run source ~/.bashrc
or source ~/.zshrc
to make the configuration effective.
Type fj
or fuzzy --jump
to use the fuzzy jump feature.
brew
needs to be pre-installed.zsh
is 5.2.0
, and for bash
is 4.2.0
fd
and fzf
using a package manager. If not pre-installed, you can use the fd
and fzf
binary files that come with fuzzy_shell
Your shell configuration file (~/.bashrc
or ~/.zshrc
) has already added aliases for fuzzy_shell
, which can be used directly.
Enter fuzzy --help
to view help information.
# fuzzy --help
Usage: fuzzy [option] [args]
Options:
-s, --search [keyword1] [keyword2] [keyword3], namely fuzzy search
-H, --history , namely fuzzy history search
-j, --jump [keyword1] [keyword2] [keyword3], namely fuzzy jump
-e, --edit [keyword1] [keyword2] [keyword3], namely fuzzy edit
[!NOTE]
- The following three features,
fuzzy jump
,fuzzy edit
, andfuzzy search
, will call thefd
andfzf
tools.fd
is used for file searching, andfzf
is used for interactive file selection.- The index range, ignore files, etc., can be configured in
~/.fuzzy_shell/config.env
.- Path parameters do not need to match precisely, only fuzzy matching is required.
fuzzy jump
is used for fuzzy jumping to a specified directory or the directory containing a specified file.# fuzzy jump to the directory which contains 'keyword1' and 'keyword2', 'keyword3'
fuzzy --jump keyword1 keyword2 keyword3
fuzzy edit
is used for fuzzy editing of specified files.vim
, which can be configured in ~/.fuzzy_shell/config.env
, such as nvim
, etc.# fuzzy edit the file which contains 'keyword1' and 'keyword2', 'keyword3'
fuzzy --edit keyword1 keyword2 keyword3
fuzzy search
is used for fuzzy searching of specified files.# fuzzy search the file which contains 'keyword1' and 'keyword2', 'keyword3'
fuzzy --search keyword1 keyword2 keyword3
some-file
file in the my-path
directory:rm $(fuzzy --search my-path some-file)
# If you have made an alias in shellrc (~/.zshrc or ~/.bashrc), it can be simplified to
rm $(fs my-path some-file)
[!NOTE]
fuzzy history
will callfzf
andhistory
.history
is used to retrieve historical records, andfzf
is used for interactive file selection.
fuzzy history
is used for fuzzy searching of current shell history records.# fuzzy search the history
fuzzy --history
The configuration file for fuzzy_shell
is located at ~/.fuzzy_shell/config.env
, where you can configure the search range of fd
, ignore files, etc.
Four parameters can be configured:
fs_search_dir
: Search range, i.e., the search path for fd
.fs_search_ignore_dirs
: Ignore files, i.e., the ignore files for fd
.fs_preview
: Whether to enable the preview feature, generally recommended to be enabled unless there's severe lag.fs_editor
: Editor, i.e., the editor for fuzzy edit
.The default configuration is as follows:
# ~/.fuzzy_shell/config.env
#!/bin/bash
# in which dir to search
fs_search_dirs=(
"${HOME}"
#"CodeSpace"
)
# within search range, which dir to ignore
fs_search_ignore_dirs=(
"Downloads"
"Desktop"
"Documents"
".git"
".local"
".m2"
".gradle"
".wns"
".nvm"
".npm"
".nrm"
".red-hat"
".oh-my-zsh"
".github"
".cache"
".cargo"
".rustup"
".vscode"
".vscode-insiders"
".vscode-server-insiders"
".vscode-server"
".vscode-oss"
".vscode-oss-insiders"
"lib"
"node_modules"
"pkg"
"bin"
"dist"
"pkgs"
"from-github"
"assets"
"image"
"images"
"static"
"data"
"raycast"
"zlt-*"
"anaconda3"
"miniconda3"
"Applications"
"Library"
"Movies"
"Music"
"Pictures"
"Public"
"Remote"
"Zotero"
"EVPlayer2_download"
)
# search preview or not, true: preview | false: not preview
# if your machine is not powerful enough(RAM <= 1GiB), set it to false
# otherwise, set it to true(Recommend)
fs_search_preview=true
#fs_search_preview=false
fs_editor="vim"
# fs_editor="nvim"
fuzzy_shell
, you can uninstall it with the following command:cd fuzzy_shell && sudo bash install/uninstall.sh
~/.bashrc
or ~/.zshrc
needs to be manually cleaned up.x86_64
architecture Linux
systems.x86_64/arm64
architecture MacOS
systems.Ubuntu 18.04/22.04
CentOS 7/8
Debian 10/11/12
bash
and zsh
bash
is 4.2.0
, and for zsh
is 5.2.0
fish
, and there are no plans to support fish
in the futuregit
, such as fuzzy searching for reflog/branch/commit
, etc.docker
, such as fuzzy searching for docker containers, images, etc.