# make aliases and other stuff work in sudo
alias sudo='sudo '

# always use nvim, see exports
alias vim=$EDITOR
alias vi=$EDITOR
alias v=$EDITOR
alias vimdiff='$EDITOR -d'
alias vdiff='$EDITOR -d'
alias vd='$EDITOR -d'

# Easier navigation: .., ..., ~ and -
alias ~="cd ~"
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias .....='cd ../../../..'
alias q='exit'

# suffix-aliases for file-types (zsh only)
alias -s css=$EDITOR
alias -s scss=$EDITOR
alias -s js=$EDITOR
alias -s html=$EDITOR
alias -s md=$EDITOR
alias -s txt=$EDITOR

# clipper -- https://github.com/wincent/clipper
alias clip="nc localhost 8377"

# better ls / l command
alias ls='ls -alGp'
alias l='ls -alGp'

# mutt
alias m='neomutt'
# alias for syncing everything
alias office="cd ~ && clear && mbsync -a && mu index --maildir ~/Mail && vdirsyncer sync && khal"

# Gitty gitgit
alias g="git"
alias gf="git-flow"
alias gs="git status"
alias gst="git status"
alias ggpl='git pull origin $(current_branch)'
alias ggps='git push origin $(current_branch)'
alias ggpnp='git pull origin $(current_branch) && git push origin $(current_branch)'
alias gsmu='git submodule init && git submodule update'
alias gsmuu='git submodule foreach git pull origin master'
alias gmo='$EDITOR $(git ls-files -m)'

# tmux
alias t='tmux -u -2'
alias ta='tmux -u attach'

# all in one homebrew, gem update commands
alias brewup='brew update && brew upgrade && brew cu -a -f -y && brew cleanup'
alias npmup='ncu -g && npm -g outdated && npm -g update'
alias upall='brewup && npmup'

# other often used stuff, mostly node/npm
alias nr='npm run'
alias ns="npm start"
alias nb="npm run build"
alias np="npm run production"
alias npmre='rm -f package-lock.json && rm -rf node_modules && npm install'
alias yre='rm -f yarn.lock && rm -rf node_modules && yarn'

# easy hosts / apache / php editing
alias hosts='sudo $EDITOR /etc/hosts'
alias vhosts='$EDITOR /usr/local/etc/nginx/servers/'

# often used folder shortcuts
alias web='cd ~/Sites && ls'
alias rep='cd ~/Repositories && ls'
alias dot='cd ~/Dotfiles && ls'

# random usefull stuff
alias dnsflush='sudo dscacheutil -flushcache'
alias lock="/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend"

# imagemagick downsampling shortcuts (c&p retina folder, run, done!)
alias jpegoptim='for i (*.jpg) mozjpeg -copy none -optimize -scans ~/dotfiles/other/scans.txt -outfile $i $i'
alias jpg25='mogrify -format jpg -resize 25% -strip -quality 80 *.jpg'
alias jpg50='mogrify -format jpg -resize 50% -strip -quality 80 *.jpg'
alias png25='mogrify -format png -resize 25% -strip -quality 80 *.png'
alias png50='mogrify -format png -resize 50% -strip -quality 80 *.png'
alias gallery='mogrify -format jpg -resize 2280x2280 -strip -quality 80 *.jpg'
alias anigif='convert -delay 12 -loop 0 *.jpg animated.gif'
