mirror of
https://github.com/davegallant/nix-config
synced 2025-08-09 10:32:27 +00:00
Add cd-fzf
This commit is contained in:
17
overlays/cd-fzf/cd-fzf
Executable file
17
overlays/cd-fzf/cd-fzf
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
readarray -t directories < ~/.config/cd-fzf
|
||||
|
||||
if [[ $# -eq 1 ]]; then
|
||||
selected=$1
|
||||
else
|
||||
selected=$(find "${directories[@]}" -mindepth 1 -maxdepth 1 -type d | fzf --exact)
|
||||
fi
|
||||
if [[ -z $selected ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
cd "$selected"
|
||||
$SHELL
|
Reference in New Issue
Block a user