From f1b828c7fefdcf8e84ba9270e1a8d4f932673c24 Mon Sep 17 00:00:00 2001 From: Anton Date: Fri, 19 Dec 2025 16:06:43 +0100 Subject: [PATCH] chore: standardize fish config (+ sync `into`) --- pkgs/fish/functions/clip.fish | 23 ++++++++--------------- pkgs/fish/functions/into.fish | 4 ++++ pkgs/fish/functions/nix-shell.fish.bckup | 12 ------------ 3 files changed, 12 insertions(+), 27 deletions(-) create mode 100644 pkgs/fish/functions/into.fish delete mode 100644 pkgs/fish/functions/nix-shell.fish.bckup diff --git a/pkgs/fish/functions/clip.fish b/pkgs/fish/functions/clip.fish index 358add1..c68640b 100644 --- a/pkgs/fish/functions/clip.fish +++ b/pkgs/fish/functions/clip.fish @@ -1,26 +1,19 @@ function clip - if not command -q xclip - echoerr "clip: 'xclip' is not available on this system" + if not command -q xclip + echoerr "clip: xclip is not available on this system" return 1 end if not tty -s - set -l stdin - read stdin -z + read -zl stdin + echo $stdin | xclip -selection clipboard + return $status end - if set -ql stdin - echo "$stdin" | xclip -selection clipboard - echo "copied into clipboard (stdin)" - return 0 - end - - if [ -n "$(string trim -- $argv)" ] - echo "$argv" | xclip -selection clipboard - echo "copied into clipboard" - return 0 + if string length -qV -- (string trim -- $argv) + echo $argv | xclip -selection clipboard + return $status end xclip -selection clipboard -o end - diff --git a/pkgs/fish/functions/into.fish b/pkgs/fish/functions/into.fish new file mode 100644 index 0000000..c9f5a46 --- /dev/null +++ b/pkgs/fish/functions/into.fish @@ -0,0 +1,4 @@ +function into -a dir + mkdir -p $dir + cd $dir +end diff --git a/pkgs/fish/functions/nix-shell.fish.bckup b/pkgs/fish/functions/nix-shell.fish.bckup deleted file mode 100644 index f4d25b9..0000000 --- a/pkgs/fish/functions/nix-shell.fish.bckup +++ /dev/null @@ -1,12 +0,0 @@ -function nix-shell - if not command -q nix-shell - command nix-shell; - return $status; - end - - set -l _argv $argv - argparse -i 'p/packages=' -- $argv - or command nix-shell -- $_argv - - set -x FISH_NIX_PACKAGES -end