Skip to content

Instantly share code, notes, and snippets.

@sweikenb
Last active October 23, 2024 08:08
Show Gist options
  • Save sweikenb/47609812faa1843096f13947a2ce6c18 to your computer and use it in GitHub Desktop.
Save sweikenb/47609812faa1843096f13947a2ce6c18 to your computer and use it in GitHub Desktop.
Linux ZSH dotconf
#
# Load Antigen ZSH package manager
#
ANTIGEN_PATH="${HOME}/antigen.zsh"
if [ ! -f "${ANTIGEN_PATH}" ]; then
# auto-install antigen
curl -L git.io/antigen > ${ANTIGEN_PATH}
fi
source "${ANTIGEN_PATH}"
# Load the oh-my-zsh's library.
antigen use oh-my-zsh
# Bundles from the default repo (robbyrussell's oh-my-zsh).
antigen bundle z
antigen bundle git
# Syntax highlighting bundle.
antigen bundle zsh-users/zsh-syntax-highlighting
# Load the theme.
antigen theme fishy
# Tell Antigen that you're done with plugin configuration
antigen apply
#------------------------------------------------------------------------------
#
# Configure keyboard
#
# enable Keypad Enter
bindkey -s "^[OM" "^M"
# jump opt + left + right
bindkey "^[^[[C" forward-word
bindkey "^[^[[D" backward-word
#------------------------------------------------------------------------------
#
# Prompt configuration
#
# Prepare prompt functions
git_info() {
GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD 2>&1)
if [[ "0" = "$?" ]]; then
echo "%{$fg[white]%} [${GIT_BRANCH}] %{$reset_color%}$del"
fi
}
php_info() {
PHP_VERSION=$(php -r "\$v = explode('-', PHP_VERSION); echo \$v[0];")
#PHP_XDEBUG=$(php -r "echo extension_loaded('xdebug') ? ' Xdebug' : '';")
#echo "PHP ${PHP_VERSION}${PHP_XDEBUG}"
echo "${PHP_VERSION}"
}
# Prepare leftprompt
PS1='%{$fg[$user_color]%}$(_fishy_collapsed_wd)%{$reset_color%}$(git_info)%(!.#.>) '
# Prepare rightprompt
setopt rcquotes
RPROMPT='%{$fg[white]%}%{$bg[blue]%} $(php_info) %{$reset_color%}'
#------------------------------------------------------------------------------
#
# Aliases
#
# Docker
alias d="docker"
alias dc="docker compose"
alias dcu="dc up -d"
# git
alias gname="git rev-parse --abbrev-ref HEAD"
alias gy="git add . && git commit --no-verify -m 'Save Current State' && git push origin"
alias gtree='git log --graph --full-history --all --color --pretty=format:"%x1b[31m%h%x09%x1b[32m%d%x1b[0m%x20%s"'
# PHP
alias php="/usr/local/bin/vphp-cli"
alias php74='$(brew --prefix [email protected])/bin/php'
alias php82='$(brew --prefix [email protected])/bin/php'
alias php83='$(brew --prefix [email protected])/bin/php'
# Composer
alias c="php /usr/local/bin/composer"
# Symfony
alias sf="php ./bin/console"
alias db-fixtures='printf "y\n" | sf doctrine:fixtures:load'
alias db-reset='sf doctrine:database:drop --force && sf doctrine:database:create && printf "y\n" | sf doctrine:migration:migrate'
alias db-reset-full='db-reset && db-fixtures'
#------------------------------------------------------------------------------
#
# FZF
#
export FZF_DEFAULT_OPTS="--no-height --no-reverse"
[ -f "${HOME}/.fzf.zsh" ] && source "${HOME}/.fzf.zsh"
#------------------------------------------------------------------------------
#
# Load device specific configurations if present
#
[ -f "${HOME}/.local-config.zsh" ] && source "${HOME}/.local-config.zsh"
#------------------------------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment