Skip to content

Commit

Permalink
WIP: Reduce shell-specific overlap
Browse files Browse the repository at this point in the history
Trying to be as shell-agnostic as I can, as I tend to jump between shells.
  • Loading branch information
kevinSuttle committed Jan 5, 2016
1 parent 436e07d commit eaf6d9c
Show file tree
Hide file tree
Showing 16 changed files with 266 additions and 21 deletions.
17 changes: 1 addition & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,7 @@


## Overview
This dotfile setup is for an efficient Zsh, Ruby, and Vim-oriented work environment.

## Installation
1. Open up your terminal of choice.
2. Run `zsh < <( curl https://raw.github.com/kevinSuttle/dotfiles/master/install.zsh)`
- If you have existing files, they **will** be overwritten.
3. Enjoy.

## Removal
1. Open up your terminal of choice.
3. Run ```source uninstall.zsh```
- Again, existing files **will** be removed.
- Enjoy?

## Disclaimer
You should read both of these files before running them.
An opinionated attempt for a cross-shell setup.

## Contributing
Pull requests are very welcome. Fork away!
41 changes: 41 additions & 0 deletions aliases
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# git aliases
alias ga='git add'
alias gai='git add -interactive'
alias gA='git add --all'
alias gbl="git branch --list --verbose"
alias gcb="git checkout -B"
alias gca='git commit --amend'
alias gcl="git clone --progress"
alias gco="git checkout"
alias gcm="git checkout master"
alias gct='git commit'
alias gd="git diff"
alias gitundocommit="git reset --soft 'HEAD^'"
alias gitundopush="git push -f origin 'HEAD^:master'"
alias glo="git log --decorate --oneline --graph"
alias glg="git log --decorate --graph --abbrev-commit --date=relative"
alias gmg='git merge --no-ff'
alias gph="git push"
alias gpr="git pull"
alias gpom="git push origin master"
alias grao="git remote add origin"
alias grau="git remote add upstream"
alias grv="git remote -v"
alias gs="git status --short --branch"
alias gss='git stash save'
alias gsa='git stash apply'
alias gsl='git stash list'
alias gsp='git stash pop'
alias gsc='git stash clear'
alias gsd='git stash drop'

## Directory nav
alias ..="cd .."
alias mkcd="mkdir -p && cd $_"
alias ls="ls -AFqLG"

alias sz='source ~/.zshrc'

# Hiding and showing files in Finder
alias shf="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder"
alias hhf="defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder"
43 changes: 43 additions & 0 deletions bash/colors.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
if tput setaf 1 &> /dev/null; then
tput sgr0; # reset colors
bold=$(tput bold);
reset=$(tput sgr0);
# Solarized colors, taken from http://git.io/solarized-colors.
black=$(tput setaf 0);
blue=$(tput setaf 33);
cyan=$(tput setaf 37);
green=$(tput setaf 64);
orange=$(tput setaf 166);
purple=$(tput setaf 125);
red=$(tput setaf 124);
violet=$(tput setaf 61);
white=$(tput setaf 15);
yellow=$(tput setaf 136);
else
bold='';
reset="\e[0m";
black="\e[1;30m";
blue="\e[1;34m";
cyan="\e[1;36m";
green="\e[1;32m";
orange="\e[1;33m";
purple="\e[1;35m";
red="\e[1;31m";
violet="\e[1;35m";
white="\e[1;37m";
yellow="\e[1;33m";
fi;

# Highlight the user name when logged in as root.
if [[ "${USER}" == "root" ]]; then
userStyle="${red}";
else
userStyle="${orange}";
fi;

# Highlight the hostname when connected via SSH.
if [[ "${SSH_TTY}" ]]; then
hostStyle="${bold}${red}";
else
hostStyle="${yellow}";
fi;
3 changes: 3 additions & 0 deletions bash/extras.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[ -f /etc/bash_completion ] && source /etc/bash_completion

test -e ${HOME}/.iterm2_shell_integration.bash && source ${HOME}/.iterm2_shell_integration.bash
7 changes: 7 additions & 0 deletions bash/prompt.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
set PROMPT_DIRTRIM=1

PS1="\[${bold}${white}\]\n${PROMPT_CHARACTER} \[${reset}\]"; # `$` (and reset color)
export PS1;

PS2="\[${yellow}\]→ \[${reset}\]";
export PS2;
14 changes: 14 additions & 0 deletions bashrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
source ~/.config/env
source $XDG_CONFIG_HOME/aliases
source $XDG_CONFIG_HOME/colors
source $XDG_CONFIG_HOME/extras
source $XDG_CONFIG_HOME/prompt

source $XDG_CONFIG_HOME/bash/colors.sh
source $XDG_CONFIG_HOME/bash/extras.sh
source $XDG_CONFIG_HOME/bash/prompt.sh

shopt -s cdspell
shopt -s checkwinsize
shopt -s histappend
shopt -s nocaseglob
10 changes: 10 additions & 0 deletions colors
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Colors
TERM=xterm-256color
CLICOLOR=1
LS_COLORS=exfxcxdxbxegedabagacad

if [[ $COLORTERM = gnome-* && $TERM = xterm ]] && infocmp gnome-256color >/dev/null 2>&1; then
export TERM='gnome-256color';
elif infocmp xterm-256color >/dev/null 2>&1; then
export TERM='xterm-256color';
fi;
23 changes: 23 additions & 0 deletions env
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
export EDITOR=vim
export XDG_CONFIG_HOME=~/.config

export MY_NAME=""
export PRIVATE_NPM_REGISTRY=
export GITHUB_ORG=iot
export WORK_EMAIL_ADDRESS=""
export OPEN_SOURCE_EMAIL_ADDRESS=""

export GITHUB_TOKEN=""
export SLACK_TOKEN_FOR_TRAVIS=""
export NPM_TOKEN=""

export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:

# System
GIT_TERMINAL_PROMPT=1
LANG=en_US.UTF-8
USER=kevinSuttle
TERM_PROGRAM=iTerm2.app

# Actual data for the sensitive values above
if [ -r ~/.private ]; then . ~/.private; fi
7 changes: 7 additions & 0 deletions extras
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[ -f ~.travis/travis.sh ] && source ~.travis/travis.sh

if which ruby >/dev/null && which gem >/dev/null; then
PATH="$(ruby -rubygems -e 'puts Gem.user_dir')/bin:$PATH"
fi

eval "$(rbenv init -)"
2 changes: 1 addition & 1 deletion fish/config.fish
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ if not status --is-interactive
exit 0
end

source "$HOME/.config/fish/abbreviations.fish"
source "$XDG_CONFIG_HOME/fish/abbreviations.fish"

# Fishhh
set -x fish_greeting ""
Expand Down
6 changes: 2 additions & 4 deletions gitconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,18 @@
ui = true
[core]
autocrlf = input
editor = vim
excludesfile = ~/.gitignore
whitespace = space-before-tab,indent-with-non-tab,trailing-space,cr-at-eol
[diff]
keepBackup = false
[help]
autocorrect = 1
[include]
path = ~/.gitconfig.local
[merge]
keepBackup = false
[push]
default = simple
[filter "media"]
clean = git-media-clean %f
smudge = git-media-smudge %f

[include]
path = ~/.private
64 changes: 64 additions & 0 deletions prompt
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Prompt settings # Alternatives starting at column 40
PROMPT_CHARACTER="⬡ " # ❯ ∠ ⋔ 🝓

PROMPT_PROMPT_ON_NEWLINE=false
# PROMPT_MULTILINE_FIRST_PREFIX="\n\r"
# PROMPT_MULTILINE_SECOND_PROMPT_PREFIX=${PROMPT_CHARACTER}
PROMPT_CARRIAGE_RETURN_ICON="↵"

PROMPT_LEFT_SEGMENT_SEPARATOR=""
PROMPT_LEFT_SUBSEGMENT_SEPARATOR=""
PROMPT_RIGHT_SEGMENT_SEPARATOR="⎪"
PROMPT_RIGHT_SUBSEGMENT_SEPARATOR="⎪"

PROMPT_FAIL_ICON="✕"
PROMPT_STATUS_VERBOSE=false
PROMPT_STATUS_BACKGROUND='red'
PROMPT_STATUS_FOREGROUND='white'
PROMPT_STATUS_ERROR_FOREGROUND='white'
PROMPT_STATUS_ERROR_BACKGROUND='red'

# PROMPT_GIT_ICON="⋋ "
PROMPT_GIT_ICON=""
PROMPT_OUTGOING_CHANGES_ICON="\U21E1" # ↥ ⊷ ↗ \U234F
PROMPT_INCOMING_CHANGES_ICON="\U21E3" # ↧ ⊶ ↙ \U2356 ⎌
PROMPT_TAG_ICON="\UF092 "
PROMPT_COMMIT_ICON="\UF03C "
PROMPT_BOOKMARK_ICON="\U1F516 "

# PROMPT_GIT_HIDE_BRANCH_ICON=false
# PROMPT_GIT_REMOTE_BRANCH_ICON="⑂ "

PROMPT_GIT_BRANCH_ICON="" # 🝓 ⤚
PROMPT_GIT_HIDE_BRANCH_ICON=true
PROMPT_GIT_STAGED_ICON="" # ⊕
PROMPT_GIT_UNSTAGED_ICON="" # ⊙
PROMPT_GIT_UNTRACKED_ICON="" # ⚐
PROMPT_GIT_HIDE_STASH_ICON=true
PROMPT_GIT_STASH_ICON="" # ⎆

# Advanced color customization
PROMPT_FOREGROUND='black'
PROMPT_DARK_FOREGROUND='green'
PROMPT_BACKGROUND='green'

# If changes are detected:
PROMPT_MODIFIED_FOREGROUND='black'
PROMPT_MODIFIED_BACKGROUND='white'

PROMPT_TIME_FOREGROUND='black'
PROMPT_TIME_BACKGROUND='magenta'

PROMPT_BATTERY_ICON="\U26A1"
PROMPT_BATTERY_CHARGING_FOREGROUND="black"
PROMPT_BATTERY_CHARGING_BACKGROUND="yellow"
PROMPT_BATTERY_CHARGED_FOREGROUND="white"
PROMPT_BATTERY_CHARGED_BACKGROUND="green"
PROMPT_BATTERY_DISCONNECTED=$DEFAULT_COLOR
PROMPT_BATTERY_LOW_FOREGROUND="white"
PROMPT_BATTERY_LOW_BACKGROUND="red"
PROMPT_BATTERY_LOW_THRESHOLD=15

PROMPT_LEFT_ELEMENTS=(status dir)
PROMPT_TIME_FORMAT="%D{%m/%d/%y %H:%M:%S}"
PROMPT_RIGHT_ELEMENTS=(time battery)
16 changes: 16 additions & 0 deletions zsh/colors.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Colors
autoload colors; colors

# The variables are wrapped in \%\{\%\}. This should be the case for every
# variable that does not contain space.
for COLOR in RED GREEN YELLOW BLUE MAGENTA CYAN BLACK WHITE; do
eval PR_$COLOR='%{$fg_no_bold[${(L)COLOR}]%}'
eval PR_BOLD_$COLOR='%{$fg_bold[${(L)COLOR}]%}'
done

eval RESET='$reset_color'
export PR_RED PR_GREEN PR_YELLOW PR_BLUE PR_WHITE PR_BLACK
export PR_BOLD_RED PR_BOLD_GREEN PR_BOLD_YELLOW PR_BOLD_BLUE
export PR_BOLD_WHITE PR_BOLD_BLACK

unset LSCOLORS
4 changes: 4 additions & 0 deletions zsh/extras.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
test -e ${HOME}/.iterm2_shell_integration.zsh && source ${HOME}/.iterm2_shell_integration.zsh

# brew info zsh-syntax-highlighting
source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
7 changes: 7 additions & 0 deletions zsh/prompt.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
autoload -U promptinit && promptinit

PURE_PROMPT_SYMBOL=${PROMPT_CHARACTER}
PURE_GIT_DOWN_ARROW=${PROMPT_INCOMING_CHANGES_ICON}
PURE_GIT_UP_ARROW=${PROMPT_OUTGOING_CHANGES_ICON}

prompt pure
23 changes: 23 additions & 0 deletions zshrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
source ~/.config/env
source $XDG_CONFIG_HOME/aliases
source $XDG_CONFIG_HOME/colors
source $XDG_CONFIG_HOME/extras
source $XDG_CONFIG_HOME/prompt

source $XDG_CONFIG_HOME/zsh/colors.zsh
source $XDG_CONFIG_HOME/zsh/extras.zsh
source $XDG_CONFIG_HOME/zsh/prompt.zsh

HISTFILE=~/.histfile
HISTSIZE=100
SAVEHIST=100000
setopt appendhistory autocd extendedglob
unsetopt beep
bindkey -v

# zsh autocomplete
zstyle :compinstall filename '~/.zshrc'
zstyle ':completion:*' rehash true

autoload -Uz compinit
compinit

0 comments on commit eaf6d9c

Please # to comment.