Skip to content

Instantly share code, notes, and snippets.

@iahim
Last active May 2, 2021 16:35
Show Gist options
  • Save iahim/5426c003de64ce22945791c1ba78adef to your computer and use it in GitHub Desktop.
Save iahim/5426c003de64ce22945791c1ba78adef to your computer and use it in GitHub Desktop.
#!/bin/bash
# DEFINE COLORS
red='$(tput setaf 1)'
green='$(tput setaf 2)'
yellow='$(tput setaf 3)'
blue='$(tput setaf 4)'
magenta='$(tput setaf 5)'
cyan='$(tput setaf 6)'
gray='$(tput setaf 7)'
none='$(tput sgr0)'
# =============================================
# USER
# =============================================
export EDITOR="vim"
export VISUAL="vim"
# will trim the PS1 to have only the last 2 dirs (not the entire path)
PROMPT_DIRTRIM=2
# Get current git branch
__git_branch='`git branch 2> /dev/null | grep -e ^* | sed -E s/^\\\\\*\ \(.+\)$/\(\\\\\1\)\ /`'
# =============================================
# USER ALIASES
# =============================================
alias ..='cd ..'
alias ll='ls -alh'
alias lt='ls -alhtr'
# python env
alias senv='source env/bin/activate'
alias ww='cd /var/www/html'
alias sa='cd /etc/apache2/sites-available'
alias chw='sudo chown -R www-data:www-data /var/www/html; sudo chmod -R 775 /var/www/html;'
alias phinx='./vendor/robmorgan/phinx/bin/phinx'
# =============================================
# FUNCTIONS
# =============================================
# make a directory and cd to it
mkcd()
{
test -d "$1" || mkdir -p "$1" && cd "$1"
}
function lazygit() {
git add -A :/
git commit -a -m "$*"
git push
}
export PS1="\[$red\]\u\[$blue\]@\h\[$cyan\] \w \[$red\]$__git_branch\[$red\]#\[$none\] "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment