zshrc: add alias and viman function

This commit is contained in:
surtur 2021-05-03 02:52:38 +02:00
parent 5fe9344396
commit e4d4f426bc
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D

2
zshrc
View File

@ -179,11 +179,13 @@
alias dc='docker-compose'
alias urlencode='python2 -c "import urllib, sys; print urllib.quote_plus( sys.argv[1] if len(sys.argv) > 1 else sys.stdin.read()[0:-1], \"\")"'
alias urldecode='python2 -c "import urllib, sys; print urllib.unquote_plus(sys.argv[1] if len(sys.argv) > 1 else sys.stdin.read()[0:-1])"'
alias obs="QT_QPA_PLATFORM=xcb obs"
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; }
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=" - ; }
upload() {
# inspired by https://www.alexander-pluhar.de/paste-file-host.html
# make eternity the default lifespan