From 16e6c27b0fccc2e303dbe22b455ca80f1c4c47ae Mon Sep 17 00:00:00 2001 From: Anton Zadvorny Date: Tue, 23 Jul 2019 18:54:26 +0300 Subject: [PATCH] Update zsh config and plugins --- home/.zsh/.linkdir | 0 home/.zsh/cmd/kp.sh | 12 ++++++++++++ home/.zsh/cmd/vmc.sh | 18 ++++++++++++++++++ home/.zsh/cmd/vmi.sh | 25 +++++++++++++++++++++++++ home/.zshrc | 36 ++++++++++++++++++++---------------- 5 files changed, 75 insertions(+), 16 deletions(-) create mode 100644 home/.zsh/.linkdir create mode 100755 home/.zsh/cmd/kp.sh create mode 100755 home/.zsh/cmd/vmc.sh create mode 100755 home/.zsh/cmd/vmi.sh diff --git a/home/.zsh/.linkdir b/home/.zsh/.linkdir new file mode 100644 index 0000000..e69de29 diff --git a/home/.zsh/cmd/kp.sh b/home/.zsh/cmd/kp.sh new file mode 100755 index 0000000..566869c --- /dev/null +++ b/home/.zsh/cmd/kp.sh @@ -0,0 +1,12 @@ +### PROCESS +# mnemonic: [K]ill [P]rocess +# show output of "ps -ef", use [tab] to select one or multiple entries +# press [enter] to kill selected processes. +# press [escape] to exit. + +pid=$(ps -ef | sed 1d | eval "fzf ${FZF_DEFAULT_OPTS} -m --header='[kill:process]'" | awk '{print $2}') + +if [ "x$pid" != "x" ] +then + echo $pid | xargs kill -${1:-9} +fi diff --git a/home/.zsh/cmd/vmc.sh b/home/.zsh/cmd/vmc.sh new file mode 100755 index 0000000..764a7c1 --- /dev/null +++ b/home/.zsh/cmd/vmc.sh @@ -0,0 +1,18 @@ +### ASDF +# uninstall multiple languages at once, async +# mnemonic [V]ersion [M]anager [C]lean + +lang=${1} + +if [[ -z $lang ]]; then + lang=$(asdf plugin-list | eval "fzf ${FZF_DEFAULT_OPTS} -m --header='[asdf:clean]'") +fi + +if [[ $lang ]]; then + for lng in $(echo $lang); do + for version in $(asdf list $lng | sort -nrk1,1 | eval "fzf ${FZF_DEFAULT_OPTS} -m --header='[asdf:${lng}:clean]'") + do asdf uninstall $lng $version + done + done +fi + diff --git a/home/.zsh/cmd/vmi.sh b/home/.zsh/cmd/vmi.sh new file mode 100755 index 0000000..d6081b5 --- /dev/null +++ b/home/.zsh/cmd/vmi.sh @@ -0,0 +1,25 @@ +### ASDF +# install multiple languages at once, async +# mnemonic [V]ersion [M]anager [I]nstall + +lang=${1} +asdf plugin-list-all &>/dev/null 2>&1 + +if [[ -z $lang ]]; then + lang=$(asdf plugin-list-all | eval "fzf ${FZF_DEFAULT_OPTS} -m --header='[asdf:install]'") +fi + +if [[ $lang ]]; then + for lng in $(echo $lang); do + if [[ -z $(asdf plugin-list | rg $lng) ]]; then + asdf plugin-add $lng + else + asdf plugin-update $lng + fi + + for version in $(asdf list-all $lng | sort -nrk1,1 | eval "fzf ${FZF_DEFAULT_OPTS} -m --header='[asdf:${lng}:install]'") + do asdf install $lng $version + done + done +fi + diff --git a/home/.zshrc b/home/.zshrc index 158f712..fa03404 100644 --- a/home/.zshrc +++ b/home/.zshrc @@ -2,17 +2,19 @@ if [[ ! -d ~/.zplug ]]; then git clone https://github.com/zplug/zplug ~/.zplug - source ~/.zplug/init.zsh && zplug update --self + source ~/.zplug/init.zsh && zplug update +else + source ~/.zplug/init.zsh fi -source ~/.zplug/init.zsh zplug "zplug/zplug", hook-build:'zplug --self-manage' -zplug "junegunn/fzf-bin", from:gh-r, as:command, rename-to:fzf -zplug "stedolan/jq", from:gh-r, as:command, rename-to:jq -zplug "akavel/up", from:gh-r, as:command, rename-to:up -zplug "sharkdp/bat", from:gh-r, as:command, rename-to:bat -zplug "wagoodman/dive", from:gh-r, as:command, rename-to:dive +zplug "wagoodman/dive", from:gh-r, as:command, rename-to:dive +zplug "stedolan/jq", from:gh-r, as:command, rename-to:jq +zplug "sharkdp/bat", from:gh-r, as:command, rename-to:bat +zplug "junegunn/fzf-bin", from:gh-r, as:command, rename-to:fzf +zplug "genuinetools/reg", from:gh-r, as:command, rename-to:reg +zplug "BurntSushi/ripgrep", from:gh-r, as:command, rename-to:rg zplug "b4b4r07/enhancd", use:init.sh if zplug check "b4b4r07/enhancd"; then @@ -20,27 +22,29 @@ if zplug check "b4b4r07/enhancd"; then export ENHANCD_DOT_SHOW_FULLPATH=1 fi -zplug "lib/completion", from:oh-my-zsh -zplug "lib/directories", from:oh-my-zsh -zplug "lib/grep", from:oh-my-zsh -zplug "lib/history", from:oh-my-zsh -zplug "lib/key-bindings", from:oh-my-zsh zplug "lib/termsupport", from:oh-my-zsh +zplug "lib/key-bindings", from:oh-my-zsh +zplug "lib/history", from:oh-my-zsh +zplug "lib/grep", from:oh-my-zsh +zplug "lib/directories", from:oh-my-zsh +zplug "lib/completion", from:oh-my-zsh -zplug "plugins/asdf", from:oh-my-zsh -zplug "plugins/bundler", from:oh-my-zsh -zplug "plugins/docker", from:oh-my-zsh zplug "plugins/git", from:oh-my-zsh +zplug "plugins/docker", from:oh-my-zsh +zplug "plugins/bundler", from:oh-my-zsh +zplug "plugins/asdf", from:oh-my-zsh zplug "zsh-users/zsh-completions" zplug "zsh-users/zsh-syntax-highlighting", defer:2 +zplug "~/.zsh/cmd", from:local, use:'(*).sh', as:command, rename-to:'$1' +zplug "~/.zsh/themes", from:local, use:cheetah.zsh-theme, as:theme + if [[ $OSTYPE == *darwin* ]]; then zplug "plugins/osx", from:oh-my-zsh zplug "plugins/pass", from:oh-my-zsh fi -zplug "~/.zsh/themes", from:local, use:cheetah.zsh-theme, as:theme [ -s "$HOME/.zsh.local" ] && source $HOME/.zsh.local zplug check || zplug install