fzf -> sk

This commit is contained in:
Daniel Flanagan 2022-12-13 14:12:29 -06:00
parent ee2445d1c5
commit 57a5439bd7
Signed by: lytedev
GPG key ID: 5B2020A0F9921EF4
14 changed files with 18 additions and 18 deletions

View file

@ -1,4 +1,4 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# TODO: needs fixing...? # TODO: needs fixing...?
cd "$(dirname "$(fzf)")" || exit 1 cd "$(dirname "$(sk)")" || exit 1

View file

@ -1,7 +1,7 @@
#!/usr/bin/env fish #!/usr/bin/env fish
has_command fzf || begin has_command sk || begin
echo "fzf not installed" echo "sk not installed (skim fuzzy finder)"
exit 1 exit 1
end end
@ -30,7 +30,7 @@ end
cat $DOTFILES_PATH/common/envs | cat $DOTFILES_PATH/common/envs |
filter_existing_directory | filter_existing_directory |
fzf --multi \ sk --multi \
--prompt "Select applicable environments (multi-select w/ TAB): " \ --prompt "Select applicable environments (multi-select w/ TAB): " \
--preview-window="up:50%:noborder" \ --preview-window="up:50%:noborder" \
--preview="ls -la --color=always $DOTFILES_PATH/{}" | --preview="ls -la --color=always $DOTFILES_PATH/{}" |

View file

@ -1,5 +1,5 @@
#!/usr/bin/env sh #!/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 "$r" | awk '$0=$1' | tr -d '\n' | clip
echo "Copied $r emoji to your clipboard" echo "Copied $r emoji to your clipboard"

View file

@ -3,13 +3,13 @@
rf="$1" # history count record file rf="$1" # history count record file
cf="$1" # all choices file cf="$1" # all choices file
touch "$record" touch "$LAUNCHER_HISTORY_FILE"
app="$( app="$(
< "$rf" awk 'NF{NF--};1' | cat - "$cf" | \ < "$rf" awk 'NF{NF--};1' | cat - "$cf" | \
sort | uniq -c | sort -nr | \ sort | uniq -c | sort -nr | \
sd '^\s+' '' | \ sd '^\s+' '' | \
cut -d' ' -f2- | \ cut -d' ' -f2- | \
fzf sk
)" )"
echo "$app $(date +%s)" >> "$LAUNCHER_HISTORY_FILE" echo "$app $(date +%s)" >> "$LAUNCHER_HISTORY_FILE"
echo "$app" echo "$app"

View file

@ -1,3 +1,3 @@
#!/usr/bin/env fish #!/usr/bin/env fish
fish -c (history | head -n 1 | grep -v history) | fzf fish -c (history | head -n 1 | grep -v history) | sk

View file

@ -5,5 +5,5 @@ kubectl config get-contexts --no-headers | \
tr -s ' ' | \ tr -s ' ' | \
sed -E 's/^\*?[[:space:]]*//g' | \ sed -E 's/^\*?[[:space:]]*//g' | \
cut -d ' ' -f1 | \ cut -d ' ' -f1 | \
fzf | \ sk | \
xargs -I{} kubectl config use-context '{}' xargs -I{} kubectl config use-context '{}'

View file

@ -8,5 +8,5 @@ kubectl get namespaces --show-labels | \
uniq | \ uniq | \
sort | \ sort | \
cut -d ' ' -f1 | \ cut -d ' ' -f1 | \
fzf | \ sk | \
xargs -I{} kubectl config set-context --current --namespace='{}' xargs -I{} kubectl config set-context --current --namespace='{}'

View file

@ -11,7 +11,7 @@ app="$(
sd -fm '^\s+' '' | \ sd -fm '^\s+' '' | \
cut -d' ' -f2- | \ cut -d' ' -f2- | \
grep "\S" | \ grep "\S" | \
fzf sk
)" )"
# if no app is selected, just exit # if no app is selected, just exit
test -z "$app" && exit 1 test -z "$app" && exit 1

View file

@ -1,2 +0,0 @@
#!/usr/bin/env sh
env FZFP_HEIGHT="100%" floating-term fish -c "fzfp | head -n 1 | clip &"

View file

@ -1,3 +1,3 @@
#!/usr/bin/env sh #!/usr/bin/env sh
d="$(command ls $ENV_PATH | fzf)" && \ d="$(command ls "$ENV_PATH" | sk)" && \
tmux-lyte-session "env-$d" "$ENV_PATH/$d" tmux-lyte-session "env-$d" "$ENV_PATH/$d"

View file

@ -7,12 +7,12 @@ t="tmux switch-client -t"
sess="$({ tmux display-message -p -F "$fmt" && tmux list-sessions -F "$fmt"; } \ sess="$({ tmux display-message -p -F "$fmt" && tmux list-sessions -F "$fmt"; } \
| awk '!seen[$1]++' \ | awk '!seen[$1]++' \
| column -t -s'|' \ | 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)" | cut -d':' -f1)"
[ -z "$sess" ] && exit 1 [ -z "$sess" ] && exit 1
$t $sess $t "$sess"

View file

@ -155,6 +155,8 @@ alias mount 'sudo -E mount'
alias umount 'sudo -E umount' alias umount 'sudo -E umount'
alias ip 'ip -color' alias ip 'ip -color'
alias pt 'pass tessen'
has_command xdg-open && alias open xdg-open has_command xdg-open && alias open xdg-open
has_command docker && begin has_command docker && begin
alias dc "docker compose" alias dc "docker compose"

View file

@ -58,7 +58,7 @@ set -g pane-base-index 1
set -g window-status-current-format "" set -g window-status-current-format ""
# present a menu of urls to open from the visible pane # present a menu of urls to open from the visible pane
# TODO: fzf-ify this # TODO: fuzzy search this
# bind u capture-pane \;\ # bind u capture-pane \;\
# save-buffer /tmp/tmux-buffer \;\ # save-buffer /tmp/tmux-buffer \;\
# split-window -l 10 "urlscan /tmp/tmux-buffer" # split-window -l 10 "urlscan /tmp/tmux-buffer"

View file

@ -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 order to have your OS-specific applications be configured and common
applications configured for the host OS. 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): can select multiple environments with TAB):
```bash ```bash