Fuzzy incremental search on the terminal.
-
Search for an item fuzzily and use item as an argument for COMMAND
fuzzyterm -c COMMAND
CTRL-j
: move selection downCTRL-k
: move selection upCTRL-h
: go to previous directoryCTRL-l
: go to selected directoryCTRL-r
: select currently selected itemCTRL-t
: select current directoryCTRL-u
: clear prompt<Esc>
: exit fuzzyterm
-h, --help
- show this help message and exit
-c COMMAND, --command COMMAND
- command to run
- defaults to:
echo
-l LENGTH, --length LENGTH
- maximum number of items displayed in list
-o OUTPUT, --output OUTPUT
- redirect COMMAND stdout to OUTPUT
-p PATH, --path PATH
- starting path
- defaults to current directory
-b, --background
- run COMMAND in background (
&
)
- run COMMAND in background (
-
Note that the command run by fuzzyterm is run as a subprocess. As such, it cannot directly affect the environment of the parent process. Passing a command like
cd
, for example, will not change the directory. However, something like the following bash shell function could be used along with fuzzyterm as a workaround to such a limitation.# example function to use fuzzyterm to change directories function fcd { fcdpipe=/tmp/fcdfifo # create a named pipe if [[ ! -p $fcdpipe ]]; then mkfifo $fcdpipe fi # echo selection to named pipe # (process must be backgrounded or it will block) fuzzyterm.py --background --output $fcdpipe # check fuzzyterm exit code if [[ $? -ne 0 ]]; then rm $fcdpipe else # cd using the selection piped into the named pipe read directory <$fcdpipe cd "$directory" fi }