From 570d4af7eba6af9837241d0c12baca4735586b2c Mon Sep 17 00:00:00 2001 From: lelgenio Date: Wed, 2 Jun 2021 20:36:53 -0300 Subject: [PATCH] fish: add wl-copy file alias --- dotfiles/fish/alias.fish | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/dotfiles/fish/alias.fish b/dotfiles/fish/alias.fish index 7f00cc3..ce531d2 100644 --- a/dotfiles/fish/alias.fish +++ b/dotfiles/fish/alias.fish @@ -107,6 +107,28 @@ function open -w xdg-open end +################################################################ +# Copy files like graphical programs +################################################################ + +function wl-copy-f -w wl-copy + set -a file + for arg in (seq 1 (count $argv)) + if test -f "$argv[$arg]" + set -a file (realpath $argv[$arg]) + set -e argv[$arg] + end + end + if test -n "$file" + wl-copy $argv -t text/uri-list "file:///$file" + else + wl-copy $argv + end +end + +abbr -g wcf 'wl-copy-f' + + ################################################################ # man ################################################################