|
|
|
|
|
by pneto
1885 days ago
|
|
I've been playing around with the tool FZF recently. It's speeding up my command line workflow quite a lot.
I made a small script that allows me to open a fuzzy search for any command, so I can write the command f followed by something like vim, evince, cd, mpv... I can optionally give a starting directory and a first query but I rarely do it.
I have it in my .bashrc, but should work in any posix compliant shell. It needs fzf and fd: # fuzzy search any command
f(){
ROOT_DIR="."
[ -n "$2" ] && ROOT_DIR="$2"
FZF_OUT=`fd . -H --color=always "$ROOT_DIR" --exclude "Software/"| fzf --query="$3"`
[ -n "$FZF_OUT" ] && "$1" "$FZF_OUT"
}
in my case Software/ is a directory with lots of files I don't need so I exclude it from my searches. I also like using ranger, it has very nice bookmarking and launcher features. |
|