From 8d3b64e57ecffafc37a6ac29e593cb29c9ceb917 Mon Sep 17 00:00:00 2001 From: surtur Date: Fri, 8 Sep 2023 14:29:46 +0200 Subject: [PATCH] functions.zsh: actually declare funcs as funcs --- .zsh/functions.zsh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.zsh/functions.zsh b/.zsh/functions.zsh index 7b0f079..160288b 100644 --- a/.zsh/functions.zsh +++ b/.zsh/functions.zsh @@ -1,16 +1,16 @@ -transfer() { if [ $# -eq 0 ]; then echo -e "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md"; return 1; fi;tmpfile=$( mktemp -t transferXXX ); if tty -s; then basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g'); curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile; else curl --progress-bar --upload-file "-" "https://transfer.sh/$1" >> $tmpfile ; fi; cat $tmpfile; rm -f $tmpfile; } +function transfer() { if [ $# -eq 0 ]; then echo -e "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md"; return 1; fi;tmpfile=$( mktemp -t transferXXX ); if tty -s; then basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g'); curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile; else curl --progress-bar --upload-file "-" "https://transfer.sh/$1" >> $tmpfile ; fi; cat $tmpfile; rm -f $tmpfile; } -info() { printf "\n%s %s\n\n" "$( date )" "$*" >&2; } +function info() { printf "\n%s %s\n\n" "$( date )" "$*" >&2; } -ix () { curl -n -F 'f:1=<-' http://ix.io 2>/dev/null ;} +function ix () { curl -n -F 'f:1=<-' http://ix.io 2>/dev/null ;} -viman() { text=$(man "$@") && echo "$text" | vim -R +":set ft=man nomod nonu noma nolist colorcolumn=" - ; } +function viman() { text=$(man "$@") && echo "$text" | vim -R +":set ft=man nomod nonu noma nolist colorcolumn=" - ; } -upload() { +function upload() { # inspired by https://www.alexander-pluhar.de/paste-file-host.html # make eternity the default lifespan FILE_LIFESPAN=${2:-e} @@ -32,12 +32,12 @@ upload() { } -timesh() { +function timesh() { shell=${1:-$SHELL} for i in $(seq 1 10); do time $shell -i -c exit; done } -timeplugins() { +function timeplugins() { for plugin ($plugins); do timer=$(($(date +%s%N)/1000000)) if [ -f $ZSH/plugins/$plugin/$plugin.plugin.zsh ]; then @@ -50,7 +50,7 @@ timeplugins() { } -delete-branches() { +function delete-branches() { git branch | grep --invert-match '\*' | cut -c 3- | @@ -58,7 +58,7 @@ delete-branches() { xargs --no-run-if-empty git branch --delete --force } -fzf-open() { +function fzf-open() { local output output=$(fzf