feat(base): improve fzf wrappers

This commit is contained in:
Moritz Böhme 2023-07-15 12:46:53 +02:00
parent 4dbec7bade
commit 795d6ececd
No known key found for this signature in database
GPG key ID: 970C6E89EB0547A9
3 changed files with 30 additions and 27 deletions

View file

@ -4,30 +4,6 @@ with lib;
let
cfg = config.my.programs.tmux;
fzf1 = pkgs.writeShellApplication {
name = "fzf1";
runtimeInputs = with pkgs; [ coreutils fzf ];
text = ''
#!/usr/bin/env bash
options=$(fzf --filter "''$*" < /dev/stdin)
if [[ -z $options ]]; then
exit 1
elif [[ $(wc -l <<< "$options") -eq 1 ]]; then
selected="$options"
else
selected=$(echo "$options" | fzf --query="$*")
fi
if [[ -z $selected ]]; then
exit 0
fi
echo "$selected"
'';
};
tmux-switch = pkgs.writeShellApplication {
name = "tmux-switch";
runtimeInputs = with pkgs; [ tmux ];