Improve autoinstall

This commit is contained in:
Tobias Reisinger 2022-10-17 21:37:38 +02:00
parent b5764c0376
commit 57cd02890a
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
8 changed files with 92 additions and 187 deletions

View file

@ -55,6 +55,8 @@ alias sail='bash vendor/bin/sail'
alias sl='ls'
alias sudo='sudo '
alias tokei='tokei --hidden'
alias watch='watch -c'
alias wget='wget -c'

View file

@ -7,7 +7,7 @@ then
rm "$HOME/.zshrc"
fi
autoinstall-packages
autoinstall all
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
@ -69,15 +69,13 @@ HIST_STAMPS="yyyy-mm-dd"
# Would you like to use another custom folder than $ZSH/custom?
ZSH_CUSTOM=$ZDOTDIR/custom
function omz_install_custom_plugin() {
plugin_path="$ZSH_CUSTOM/plugins/$1"
if [ ! -d "$plugin_path" ]
then
echo "Installing plugin $1"
git clone "$2" "$plugin_path" >/dev/null 2>&1
fi
}
omz_install_custom_plugin "zsh-syntax-highlighting" "https://github.com/zsh-users/zsh-syntax-highlighting.git"
plugin_path="$ZSH_CUSTOM/plugins"
autoinstall git \
"https://github.com/zsh-users/zsh-syntax-highlighting.git" \
"$plugin_path/zsh-syntax-highlighting"
autoinstall file \
"https://gist.githubusercontent.com/oshybystyi/475ee7768efc03727f21/raw/4bfd57ef277f5166f3070f11800548b95a501a19/git-auto-status.plugin.zsh" \
"$plugin_path/git-auto-status/git-auto-status.plugin.zsh"
# Which plugins would you like to load?
@ -120,6 +118,8 @@ export SAVEHIST=1000000
export HISTSIZE=1000000
export HISTFILE="$HOME/.cache/zsh_history"
source source-remote-file "dracula-syntax-highlighting" "https://raw.githubusercontent.com/dracula/zsh-syntax-highlighting/master/zsh-syntax-highlighting.sh"
source source-remote-file \
"https://raw.githubusercontent.com/dracula/zsh-syntax-highlighting/master/zsh-syntax-highlighting.sh" \
"dracula-syntax-highlighting"
[ -x "$(command -v starship)" ] && eval "$(starship init zsh)"

View file

@ -1,31 +0,0 @@
#
# Run git status after specified set of command
#
# @author Oleksandr Shybystyi oleksandr.shybystyi@gmail.com
#
# default list of git commands `git status` is running after
gitPreAutoStatusCommands=(
'add'
'rm'
'reset'
'commit'
'checkout'
'mv'
'init'
)
# taken from http://stackoverflow.com/a/8574392/4647743
function elementInArray() {
local e
for e in "${@:2}"; do [[ "$e" == "$1" ]] && return 0; done
return 1
}
function git() {
command git $@
if (elementInArray $1 $gitPreAutoStatusCommands); then
command git status
fi
}