Dotfile refactoring.

This commit is contained in:
David Tomaschik
2015-12-10 19:37:53 -08:00
parent 138f9ef3c3
commit ec69fed5d2
5 changed files with 37 additions and 52 deletions

View File

@@ -1,6 +1,10 @@
# Load env first
if [ -f $HOME/.env ] ; then source $HOME/.env ; fi
# History settings # History settings
HISTCONTROL=ignoredups:ignorespace HISTCONTROL=ignoredups:ignorespace
shopt -s histappend shopt -s histappend
shopt -s expand_aliases
HISTSIZE=1000 HISTSIZE=1000
HISTFILESIZE=0 HISTFILESIZE=0
@@ -10,23 +14,12 @@ shopt -s checkwinsize
# Fancier outputs # Fancier outputs
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" [ -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 if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
color_prompt=yes
else
color_prompt=
fi
fi
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi fi
unset color_prompt force_color_prompt
# If this is an xterm set the title to user@host:dir # If this is an xterm set the title to user@host:dir
case "$TERM" in case "$TERM" in
@@ -45,3 +38,5 @@ fi
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
. /etc/bash_completion . /etc/bash_completion
fi fi
if [[ -e $HOME/.aliases ]] ; then source $HOME/.aliases ; fi

24
dotfiles/env Normal file
View File

@@ -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

View File

@@ -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 # Setup GPG Agent
GPG_AGENT_INFO_PATH=$HOME/.gnupg/gpg-agent-info-`hostname` 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 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 unset GPG_AGENT_INFO_PATH
export GPG_TTY=`tty` export GPG_TTY=`tty`
# End GPG # 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

View File

@@ -1,2 +1,4 @@
if [[ -f $HOME/.env ]] ; then source $HOME/.env ; fi
# ZSH specific environment # ZSH specific environment
DEBIAN_PREVENT_KEYBOARD_CHANGES=yes DEBIAN_PREVENT_KEYBOARD_CHANGES=yes

View File

@@ -1,3 +1,4 @@
# For interactive shells
HISTFILE=~/.histfile HISTFILE=~/.histfile
HISTSIZE=1000 HISTSIZE=1000
SAVEHIST=1000 SAVEHIST=1000
@@ -45,8 +46,9 @@ bindkey '^[[B' history-search-forward
bindkey '^[[1;5C' forward-word bindkey '^[[1;5C' forward-word
bindkey '^[[1;5D' backward-word bindkey '^[[1;5D' backward-word
# Source extras if interactive # Source extras and aliases if interactive
if [[ $- == *i* ]] ; then if [[ $- == *i* ]] ; then
if [[ -e $HOME/.aliases ]] ; then source $HOME/.aliases ; fi
for file in $HOME/.zshrc.d/* ; do source "$file" ; done for file in $HOME/.zshrc.d/* ; do source "$file" ; done
fi fi