From 57a5439bd7f05ae34d9cad56b1b1dbe8a65334ff Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Tue, 13 Dec 2022 14:12:29 -0600 Subject: [PATCH] fzf -> sk --- common/bin/cdp | 2 +- common/bin/dotfiles-link-environments | 6 +++--- common/bin/{fzfemoji => emoji} | 2 +- common/bin/fzf-history-weight | 4 ++-- common/bin/fzfy | 2 +- common/bin/kubfc | 2 +- common/bin/kubfn | 2 +- common/bin/launch | 2 +- common/bin/pass-chooser | 2 -- common/bin/tenv | 2 +- common/bin/tmuxswitcher | 4 ++-- common/fish/functions.fish | 2 ++ common/tmux/conf | 2 +- readme.md | 2 +- 14 files changed, 18 insertions(+), 18 deletions(-) rename common/bin/{fzfemoji => emoji} (69%) delete mode 100755 common/bin/pass-chooser diff --git a/common/bin/cdp b/common/bin/cdp index b621ffe..a6c001e 100755 --- a/common/bin/cdp +++ b/common/bin/cdp @@ -1,4 +1,4 @@ #!/usr/bin/env bash # TODO: needs fixing...? -cd "$(dirname "$(fzf)")" || exit 1 +cd "$(dirname "$(sk)")" || exit 1 diff --git a/common/bin/dotfiles-link-environments b/common/bin/dotfiles-link-environments index c21ea9f..3fe54d9 100755 --- a/common/bin/dotfiles-link-environments +++ b/common/bin/dotfiles-link-environments @@ -1,7 +1,7 @@ #!/usr/bin/env fish -has_command fzf || begin - echo "fzf not installed" +has_command sk || begin + echo "sk not installed (skim fuzzy finder)" exit 1 end @@ -30,7 +30,7 @@ end cat $DOTFILES_PATH/common/envs | filter_existing_directory | - fzf --multi \ + sk --multi \ --prompt "Select applicable environments (multi-select w/ TAB): " \ --preview-window="up:50%:noborder" \ --preview="ls -la --color=always $DOTFILES_PATH/{}" | diff --git a/common/bin/fzfemoji b/common/bin/emoji similarity index 69% rename from common/bin/fzfemoji rename to common/bin/emoji index 9ba2241..7955e0a 100755 --- a/common/bin/fzfemoji +++ b/common/bin/emoji @@ -1,5 +1,5 @@ #!/usr/bin/env sh -r="$(< "$HOME/.emoji.txt" fzf --height 40%)" +r="$(< "$HOME/.emoji.txt" sk --height 40%)" echo "$r" | awk '$0=$1' | tr -d '\n' | clip echo "Copied $r emoji to your clipboard" diff --git a/common/bin/fzf-history-weight b/common/bin/fzf-history-weight index f5e3ff7..35e2f9a 100755 --- a/common/bin/fzf-history-weight +++ b/common/bin/fzf-history-weight @@ -3,13 +3,13 @@ rf="$1" # history count record file cf="$1" # all choices file -touch "$record" +touch "$LAUNCHER_HISTORY_FILE" app="$( < "$rf" awk 'NF{NF--};1' | cat - "$cf" | \ sort | uniq -c | sort -nr | \ sd '^\s+' '' | \ cut -d' ' -f2- | \ - fzf + sk )" echo "$app $(date +%s)" >> "$LAUNCHER_HISTORY_FILE" echo "$app" diff --git a/common/bin/fzfy b/common/bin/fzfy index 6d44fd6..fa76cb3 100755 --- a/common/bin/fzfy +++ b/common/bin/fzfy @@ -1,3 +1,3 @@ #!/usr/bin/env fish -fish -c (history | head -n 1 | grep -v history) | fzf +fish -c (history | head -n 1 | grep -v history) | sk diff --git a/common/bin/kubfc b/common/bin/kubfc index 96608c8..b925485 100755 --- a/common/bin/kubfc +++ b/common/bin/kubfc @@ -5,5 +5,5 @@ kubectl config get-contexts --no-headers | \ tr -s ' ' | \ sed -E 's/^\*?[[:space:]]*//g' | \ cut -d ' ' -f1 | \ - fzf | \ + sk | \ xargs -I{} kubectl config use-context '{}' diff --git a/common/bin/kubfn b/common/bin/kubfn index dd7eb94..5221a16 100755 --- a/common/bin/kubfn +++ b/common/bin/kubfn @@ -8,5 +8,5 @@ kubectl get namespaces --show-labels | \ uniq | \ sort | \ cut -d ' ' -f1 | \ - fzf | \ + sk | \ xargs -I{} kubectl config set-context --current --namespace='{}' diff --git a/common/bin/launch b/common/bin/launch index daef507..58a78ea 100755 --- a/common/bin/launch +++ b/common/bin/launch @@ -11,7 +11,7 @@ app="$( sd -fm '^\s+' '' | \ cut -d' ' -f2- | \ grep "\S" | \ - fzf + sk )" # if no app is selected, just exit test -z "$app" && exit 1 diff --git a/common/bin/pass-chooser b/common/bin/pass-chooser deleted file mode 100755 index 31c385f..0000000 --- a/common/bin/pass-chooser +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env sh -env FZFP_HEIGHT="100%" floating-term fish -c "fzfp | head -n 1 | clip &" diff --git a/common/bin/tenv b/common/bin/tenv index 49a4f7f..fee13a1 100755 --- a/common/bin/tenv +++ b/common/bin/tenv @@ -1,3 +1,3 @@ #!/usr/bin/env sh -d="$(command ls $ENV_PATH | fzf)" && \ +d="$(command ls "$ENV_PATH" | sk)" && \ tmux-lyte-session "env-$d" "$ENV_PATH/$d" diff --git a/common/bin/tmuxswitcher b/common/bin/tmuxswitcher index fd5d5fe..bd51f9c 100755 --- a/common/bin/tmuxswitcher +++ b/common/bin/tmuxswitcher @@ -7,12 +7,12 @@ t="tmux switch-client -t" sess="$({ tmux display-message -p -F "$fmt" && tmux list-sessions -F "$fmt"; } \ | awk '!seen[$1]++' \ | column -t -s'|' \ - | fzf -q '$' --reverse --prompt 'switch session: ' -1 --preview "tmux-session-preview {}" \ + | sk -q '$' --reverse --prompt 'switch session: ' -1 --preview "tmux-session-preview {}" \ | cut -d':' -f1)" [ -z "$sess" ] && exit 1 -$t $sess +$t "$sess" diff --git a/common/fish/functions.fish b/common/fish/functions.fish index 96aee3b..4290d50 100644 --- a/common/fish/functions.fish +++ b/common/fish/functions.fish @@ -155,6 +155,8 @@ alias mount 'sudo -E mount' alias umount 'sudo -E umount' alias ip 'ip -color' +alias pt 'pass tessen' + has_command xdg-open && alias open xdg-open has_command docker && begin alias dc "docker compose" diff --git a/common/tmux/conf b/common/tmux/conf index 0ea22c2..2d24cd7 100644 --- a/common/tmux/conf +++ b/common/tmux/conf @@ -58,7 +58,7 @@ set -g pane-base-index 1 set -g window-status-current-format "" # present a menu of urls to open from the visible pane -# TODO: fzf-ify this +# TODO: fuzzy search this # bind u capture-pane \;\ # save-buffer /tmp/tmux-buffer \;\ # split-window -l 10 "urlscan /tmp/tmux-buffer" diff --git a/readme.md b/readme.md index a49693f..92cd4f1 100644 --- a/readme.md +++ b/readme.md @@ -74,7 +74,7 @@ You will want to symlink relevant environment layers into the `$ENV_PATH` in order to have your OS-specific applications be configured and common applications configured for the host OS. -There's a handy `fzf`-based script that makes this super easy (note that you +There's a handy script that makes this super easy (note that you can select multiple environments with TAB): ```bash