From ec69fed5d23b615f986c0738c429e60786e22e10 Mon Sep 17 00:00:00 2001 From: David Tomaschik Date: Thu, 10 Dec 2015 19:37:53 -0800 Subject: [PATCH] Dotfile refactoring. --- dotfiles/bashrc | 21 ++++++++------------- dotfiles/env | 24 ++++++++++++++++++++++++ dotfiles/profile | 38 -------------------------------------- dotfiles/zshenv | 2 ++ dotfiles/zshrc | 4 +++- 5 files changed, 37 insertions(+), 52 deletions(-) create mode 100644 dotfiles/env diff --git a/dotfiles/bashrc b/dotfiles/bashrc index e1f0c64..8107dee 100644 --- a/dotfiles/bashrc +++ b/dotfiles/bashrc @@ -1,6 +1,10 @@ +# Load env first +if [ -f $HOME/.env ] ; then source $HOME/.env ; fi + # History settings HISTCONTROL=ignoredups:ignorespace shopt -s histappend +shopt -s expand_aliases HISTSIZE=1000 HISTFILESIZE=0 @@ -10,23 +14,12 @@ shopt -s checkwinsize # Fancier outputs [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" -case "$TERM" in - xterm-color) color_prompt=yes;; -esac -force_color_prompt=yes -if [ -n "$force_color_prompt" ]; then - if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then - color_prompt=yes - else - color_prompt= - fi -fi -if [ "$color_prompt" = yes ]; then + +if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' else PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' fi -unset color_prompt force_color_prompt # If this is an xterm set the title to user@host:dir case "$TERM" in @@ -45,3 +38,5 @@ fi if [ -f /etc/bash_completion ] && ! shopt -oq posix; then . /etc/bash_completion fi + +if [[ -e $HOME/.aliases ]] ; then source $HOME/.aliases ; fi diff --git a/dotfiles/env b/dotfiles/env new file mode 100644 index 0000000..9f6fe6c --- /dev/null +++ b/dotfiles/env @@ -0,0 +1,24 @@ +# Sourced by zshrc as well as bash. + +umask 027 +ulimit -c unlimited + +# Paths and preferences +export PATH="$HOME/bin:/sbin:/usr/sbin:$PATH" +export PYTHONPATH="$HOME/.python:$PYTHONPATH" +export GOPATH="$HOME/.go" +export VISUAL=vim +export EDITOR=vim +export DEBEMAIL="david@systemoverlord.com" +export DEBFULLNAME="David Tomaschik" +export LESS="-MR" + +# Unconditional because /bin/sh sucks +export PATH="$PATH:$HOME/.gce/google-cloud-sdk/bin:$HOME/bin/genymotion:$HOME/bin/genymotion/tools:$HOME/bin/google_appengine:$HOME/bin/go_appengine" + +# Fix gnome-terminal +if [[ $TERM == "xterm" && $COLORTERM == "gnome-terminal" ]] ; then + export TERM="xterm-256color" +fi + +if [[ -e $HOME/.localenv ]] ; then source $HOME/.localenv ; fi diff --git a/dotfiles/profile b/dotfiles/profile index 6291e02..d533854 100644 --- a/dotfiles/profile +++ b/dotfiles/profile @@ -1,30 +1,3 @@ -# Sourced by zshrc as well as bash. - -umask 027 -ulimit -c unlimited - -# if running bash -if [ -n "$BASH_VERSION" ]; then - # include .bashrc if it exists - if [ -f "$HOME/.bashrc" ]; then - . "$HOME/.bashrc" - fi - shopt -s expand_aliases -fi - -# Paths and preferences -export PATH="$HOME/bin:/sbin:/usr/sbin:$PATH" -export PYTHONPATH="$HOME/.python:$PYTHONPATH" -export GOPATH="$HOME/.go" -export VISUAL=vim -export EDITOR=vim -export DEBEMAIL="david@systemoverlord.com" -export DEBFULLNAME="David Tomaschik" -export LESS="-MR" - -# Unconditional because /bin/sh sucks -export PATH="$PATH:$HOME/.gce/google-cloud-sdk/bin:$HOME/bin/genymotion:$HOME/bin/genymotion/tools:$HOME/bin/google_appengine:$HOME/bin/go_appengine" - # Setup GPG Agent GPG_AGENT_INFO_PATH=$HOME/.gnupg/gpg-agent-info-`hostname` if test -f $GPG_AGENT_INFO_PATH && kill -0 `cut -d: -f 2 $GPG_AGENT_INFO_PATH` 2>/dev/null ; then @@ -38,14 +11,3 @@ fi unset GPG_AGENT_INFO_PATH export GPG_TTY=`tty` # End GPG - -# Fix gnome-terminal -if [[ $TERM == "xterm" && $COLORTERM == "gnome-terminal" ]] ; then - export TERM="xterm-256color" -fi - -# dircolors -eval `dircolors $HOME/.dircolors` - -if [[ -e $HOME/.localenv ]] ; then source $HOME/.localenv ; fi -if [[ -e $HOME/.aliases ]] ; then source $HOME/.aliases ; fi diff --git a/dotfiles/zshenv b/dotfiles/zshenv index 3b9dd24..5503657 100644 --- a/dotfiles/zshenv +++ b/dotfiles/zshenv @@ -1,2 +1,4 @@ +if [[ -f $HOME/.env ]] ; then source $HOME/.env ; fi + # ZSH specific environment DEBIAN_PREVENT_KEYBOARD_CHANGES=yes diff --git a/dotfiles/zshrc b/dotfiles/zshrc index 461faa1..a8d3107 100644 --- a/dotfiles/zshrc +++ b/dotfiles/zshrc @@ -1,3 +1,4 @@ +# For interactive shells HISTFILE=~/.histfile HISTSIZE=1000 SAVEHIST=1000 @@ -45,8 +46,9 @@ bindkey '^[[B' history-search-forward bindkey '^[[1;5C' forward-word bindkey '^[[1;5D' backward-word -# Source extras if interactive +# Source extras and aliases if interactive if [[ $- == *i* ]] ; then + if [[ -e $HOME/.aliases ]] ; then source $HOME/.aliases ; fi for file in $HOME/.zshrc.d/* ; do source "$file" ; done fi