updated stuff

This commit is contained in:
Nikolas Weger 2019-12-11 12:13:54 +01:00
parent c37679a883
commit c4ff5a9900
24 changed files with 138 additions and 30 deletions

View file

@ -14,10 +14,10 @@ echo ">>> Installing Linuxbrew - Please Wait! <<<"
[[ ! -d "/home/linuxbrew/.linuxbrew" ]] && ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install)" && echo "> Linuxbrew installed" || echo "> Linuxbrew already installed" [[ ! -d "/home/linuxbrew/.linuxbrew" ]] && ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install)" && echo "> Linuxbrew installed" || echo "> Linuxbrew already installed"
echo ">>> Copying Gitconfig - Please Wait! <<<" echo ">>> Copying Gitconfig - Please Wait! <<<"
sudo cp ${HOME}/.config/dotfiles/toCopy/gitconfig /etc/gitconfig sudo cp ${HOME}/.config/dotfiles/copy/gitconfig /etc/gitconfig
echo ">>> Copying Gitignore - Please Wait! <<<" echo ">>> Copying Gitignore - Please Wait! <<<"
sudo cp ${HOME}/.config/dotfiles/toCopy/gitignore /etc/gitignore sudo cp ${HOME}/.config/dotfiles/copy/gitignore /etc/gitignore
echo ">>> Copying SSH Config - Please Wait! <<<" echo ">>> Copying SSH Config - Please Wait! <<<"
sudo cp ${HOME}/.config/dotfiles/toCopy/sshconfig /etc/ssh/ssh_config sudo cp ${HOME}/.config/dotfiles/copy/sshconfig /etc/ssh/ssh_config

View file

@ -1,36 +1,24 @@
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then if [[ -r "$HOME/.cache/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" source "$HOME/.cache/p10k-instant-prompt-${(%):-%n}.zsh"
fi fi
source "$ZDOTDIR/libraries/export.zsh" source $ZDOTDIR/exports.zsh
source "$ZDOTDIR/libraries/dircolor.zsh" source $ZDOTDIR/dircolor.zsh
source "/usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh" source $share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
source "/usr/share/zsh-theme-powerlevel10k/powerlevel10k.zsh-theme" source $share/zsh-theme-powerlevel10k/powerlevel10k.zsh-theme
autoload -Uz compinit autoload -Uz compinit
if [[ -n $HOME/.cache/zsh/compdump(#qN.mh+24) ]]; then compinit -d $HOME/.cache/zsh/compdump; else compinit -d $HOME/.cache/zsh/compdump -C; fi if [[ -n $HOME/.cache/zsh/compdump(#qN.mh+24) ]]; then compinit -d $HOME/.cache/zsh/compdump; else compinit -d $HOME/.cache/zsh/compdump -C; fi
for file in $ZDOTDIR/libraries/source/*.zsh; do source "$file"; done for file in $ZDOTDIR/libs/*.zsh; do source "$file"; done
for file in $ZDOTDIR/libraries/plugins/*.zsh; do source "$file"; done for file in $ZDOTDIR/plgs/*.zsh; do source "$file"; done
source "/usr/share/fzf/completion.zsh" source $fzf/completion.zsh
source "/usr/share/fzf/key-bindings.zsh" source $fzf/key-bindings.zsh
source "/usr/share/doc/pkgfile/command-not-found.zsh" source $share/doc/pkgfile/command-not-found.zsh
source "$ZDOTDIR/libraries/tmux/tmux.zsh" source $ZDOTDIR/tmux/tmux.zsh
# Use lf to switch directories and bind it to ctrl-o
lfcd () {
tmp="$(mktemp)"
lf -last-dir-path="$tmp" "$@"
if test -f "$tmp"; then
dir="$(cat "$tmp")"
rm -f "$tmp"
[ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir"
fi
}
bindkey -s '^o' 'lfcd\n'
[[ ! -f $ZDOTDIR/.p10k.zsh ]] || source $ZDOTDIR/.p10k.zsh [[ ! -f $ZDOTDIR/.p10k.zsh ]] || source $ZDOTDIR/.p10k.zsh
source "/usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" source $share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

View file

@ -1,8 +1,8 @@
# Local Path Additions #local
export path=($path $HOME/.config/dotfiles/bin /opt/phalcon-devtools) export path=($path $HOME/.config/dotfiles/bin /opt/phalcon-devtools)
export PTOOLSPATH="/opt/phalcon-devtools/" export PTOOLSPATH="/opt/phalcon-devtools/"
# Stuff for Homebrew #homebrew
export path=($path /home/linuxbrew/.linuxbrew/{sbin,bin}) export path=($path /home/linuxbrew/.linuxbrew/{sbin,bin})
export fpath=($fpath /home/linuxbrew/.linuxbrew/share/zsh/site-functions) export fpath=($fpath /home/linuxbrew/.linuxbrew/share/zsh/site-functions)
export manpath=($manpath /home/linuxbrew/.linuxbrew/share/man) export manpath=($manpath /home/linuxbrew/.linuxbrew/share/man)
@ -13,3 +13,6 @@ export XDG_DATA_DIRS=($XDG_DATA_DIRS /home/linuxbrew/.linuxbrew/share)
export GEM_HOME=$(ruby -e 'print Gem.user_dir') export GEM_HOME=$(ruby -e 'print Gem.user_dir')
export path=($path $GEM_HOME/bin) export path=($path $GEM_HOME/bin)
#share
export share="/usr/share"
export fzf="$share/fzf"

117
zsh/plgs/appup.zsh Normal file
View file

@ -0,0 +1,117 @@
# Docker
_appup_docker () {
if hash docker-compose >/dev/null 2>&1; then
# Check if docker-machine has been started
if hash docker-machine >/dev/null 2>&1; then
if docker-machine status | grep -qi "Stopped"; then
read -q "REPLY?Docker Machine is not running, would you like to start it? [y/n] "
echo ""
if [[ "$REPLY" == "y" ]]; then
docker-machine start default && eval $(docker-machine env default)
echo ""
else
return
fi
fi
fi
# Check YAML extension
compose_file=''
compose_project_file=''
if [ -e "docker-compose.yml" ]; then
compose_file='docker-compose.yml'
elif [ -e "docker-compose.yaml" ]; then
compose_file='docker-compose.yaml'
fi
# <cmd> <project name> will look for docker-compose.<project name>.yml
if [ -n "$2" ]; then
if [ -e "docker-compose.$2.yml" ]; then
compose_project_file="docker-compose.$2.yml"
elif [ -e "docker-compose.$2.yaml" ]; then
compose_project_file="docker-compose.$2.yaml"
fi
if [ -n "$compose_project_file" ]; then
# Override project name from custom env
if [ -e ".env.$2" ]; then
project=$(source ".env.$2"; echo $COMPOSE_PROJECT_NAME)
if [ -n $project ]; then
docker-compose -p "${project}" -f "$compose_file" -f "$compose_project_file" $1 "${@:3}"
return
fi
fi
docker-compose -f "$compose_file" -f "$compose_project_file" $1 "${@:3}"
return
fi
fi
docker-compose $1 "${@:2}"
else
echo >&2 "Docker compose file found but docker-compose is not installed."
fi
}
# Vagrant
_appup_vagrant () {
if hash vagrant >/dev/null 2>&1; then
vagrant $1 "${@:2}"
else
echo >&2 "Vagrant file found but vagrant is not installed."
fi
}
up () {
if [ -e "docker-compose.yml" ] || [ -e "docker-compose.yaml" ]; then
_appup_docker up "$@"
elif [ -e "Vagrantfile" ]; then
_appup_vagrant up "$@"
elif hash up >/dev/null 2>&1; then
env up "$@"
fi
}
down () {
if [ -e "docker-compose.yml" ] || [ -e "docker-compose.yaml" ]; then
_appup_docker down "$@"
elif [ -e "Vagrantfile" ]; then
_appup_vagrant destroy "$@"
elif hash down >/dev/null 2>&1; then
env down "$@"
fi
}
start () {
if [ -e "docker-compose.yml" ] || [ -e "docker-compose.yaml" ]; then
_appup_docker start "$@"
elif [ -e "Vagrantfile" ]; then
_appup_vagrant up "$@"
elif hash start >/dev/null 2>&1; then
env start "$@"
fi
}
restart () {
if [ -e "docker-compose.yml" ] || [ -e "docker-compose.yaml" ]; then
_appup_docker restart "$@"
elif [ -e "Vagrantfile" ]; then
_appup_vagrant reload "$@"
elif hash start >/dev/null 2>&1; then
env start "$@"
fi
}
stop () {
if [ -e "docker-compose.yml" ] || [ -e "docker-compose.yaml" ]; then
_appup_docker stop "$@"
elif [ -e "Vagrantfile" ]; then
_appup_vagrant halt "$@"
elif hash stop >/dev/null 2>&1; then
env stop "$@"
fi
}