chore: zshrc updates

* add gradle completion plugin
* fix asdf completions
* add dotnet completions
* set autosuggest strategy to both history and completion (again)
* add ix() function
* fix upload function
* rm yarn from ohmyzsh plugins
This commit is contained in:
surtur 2021-02-04 22:43:56 +01:00
parent abb7372b0c
commit bda284f700
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D

27
zshrc
View File

@ -9,6 +9,7 @@
zplug "plugins/gitignore", from:oh-my-zsh, defer:2
zplug "plugins/systemd", from:oh-my-zsh, defer:2
zplug "plugins/dnf", from:oh-my-zsh, defer:2
zplug "gradle/gradle-completion", from:github, defer:2
# zplug "arzzen/calc.plugin.zsh", defer:2
zplug 'zplug/zplug', hook-build:'zplug --self-manage'
@ -28,6 +29,7 @@
source ~/.zplug/repos/robbyrussell/oh-my-zsh/plugins/gitignore/gitignore.plugin.zsh
source ~/.zplug/repos/robbyrussell/oh-my-zsh/plugins/systemd/systemd.plugin.zsh
source ~/.zplug/repos/robbyrussell/oh-my-zsh/plugins/dnf/dnf.plugin.zsh
source ~/.zplug/repos/gradle/gradle-completion/gradle-completion.plugin.zsh
#source ~/.zplug/repos/arzzen/calc.plugin.zsh/calc.plugin.zsh
ZSH_THEME="spaceship"
@ -74,7 +76,7 @@
# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"
DISABLE_MAGIC_FUNCTIONS=false
DISABLE_MAGIC_FUNCTIONS="false"
# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"
@ -104,12 +106,16 @@
# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder
plugins=(safe-paste docker yarn fzf)
plugins=(safe-paste docker fzf)
source ~/.asdf/asdf.sh
# append completions to fpath
fpath=(${ASDF_DIR}/completions $fpath)
source $ZSH/oh-my-zsh.sh
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern cursor)
ZSH_AUTOSUGGEST_STRATEGY=(history)
ZSH_AUTOSUGGEST_STRATEGY=(history completion)
ZSH_AUTOSUGGEST_USE_ASYNC=
# map Del escape sequence to actual Del key in all (n,i) modes to resemble vim instead of vi
@ -126,12 +132,12 @@
export FZF_DEFAULT_COMMAND="fzf --preview 'head -100 {}'"
# User configuration
source ~/.asdf/asdf.sh
# append completions to fpath
fpath=(${ASDF_DIR}/completions $fpath)
# initialise completions with ZSH's compinit
autoload -Uz compinit
compinit
_dotnet_zsh_complete(){
local completions=("$(dotnet complete "$words")")
reply=( "${(ps:\n:)completions}" )
}
compctl -K _dotnet_zsh_complete dotnet
source ~/.zprofile
source ~/.dotenv
export PATH="$HOME/.local/bin:$HOME/utils/bin:$HOME/.cargo/bin:$GOPATH/bin:$PATH"
@ -214,13 +220,14 @@
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 ;}
upload() {
# inspired by https://www.alexander-pluhar.de/paste-file-host.html
# make eternity the default lifespan
FILE_LIFESPAN=${2:-e}
FILE_ID=$(base64 /dev/urandom | tr -d '/+' | dd bs=16 count=1 2>/dev/null)
rsync $1 nebula:/var/www/htdocs/dotya.ml/files/$FILE_LIFESPAN/$FILE_ID-$1
rsync -auvP -4 $1 nebula:/var/www/htdocs/dotya.ml/files/$FILE_LIFESPAN/$FILE_ID-$1
FILE_URL="https://dotya.ml/files/$FILE_LIFESPAN/$FILE_ID-$1"