diff options
-rw-r--r-- | .aliases | 6 | ||||
-rwxr-xr-x | .bash_profile | 2 | ||||
-rw-r--r-- | .bash_prompt | 58 | ||||
-rw-r--r-- | .functions | 16 | ||||
-rw-r--r-- | .vimrc | 10 | ||||
-rwxr-xr-x | bootstrap.sh | 2 |
6 files changed, 49 insertions, 45 deletions
@@ -12,7 +12,7 @@ alias lsd='ls -l | grep "^d"' # Always use color output for `ls` if [[ "$OSTYPE" =~ ^darwin ]]; then - alias ls="command ls -G" + alias ls="command ls -G" else alias ls="command ls --color" export LS_COLORS='no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.ogg=01;35:*.mp3=01;35:*.wav=01;35:' @@ -82,7 +82,9 @@ alias spoton="sudo mdutil -a -i on" alias plistbuddy="/usr/libexec/PlistBuddy" # One of @janmoesen’s ProTip™s -for method in GET HEAD POST PUT DELETE TRACE OPTIONS; do alias "$method"="lwp-request -m '$method'"; done +for method in GET HEAD POST PUT DELETE TRACE OPTIONS; do + alias "$method"="lwp-request -m '$method'" +done # Stuff I never really use but cannot delete either because of http://xkcd.com/530/ alias stfu="osascript -e 'set volume output muted true'" diff --git a/.bash_profile b/.bash_profile index f376b4b..7b15a81 100755 --- a/.bash_profile +++ b/.bash_profile @@ -1,7 +1,7 @@ # Load ~/.bash_prompt, ~/.exports, ~/.aliases, ~/.functions and ~/.extra # ~/.extra can be used for settings you don’t want to commit for file in ~/.{bash_prompt,exports,aliases,functions,extra}; do - [ -r "$file" ] && source "$file" + [ -r "$file" ] && source "$file" done unset file diff --git a/.bash_prompt b/.bash_prompt index 639808d..6301948 100644 --- a/.bash_prompt +++ b/.bash_prompt @@ -1,43 +1,45 @@ -# @gf3’s Sexy Bash Prompt, inspired by "Extravagant Zsh Prompt" +# @gf3’s Sexy Bash Prompt, inspired by “Extravagant Zsh Prompt” # Shamelessly copied from https://github.com/gf3/dotfiles -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 +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 if tput setaf 1 &> /dev/null; then - tput sgr0 - if [[ $(tput colors) -ge 256 ]] 2>/dev/null; then - MAGENTA=$(tput setaf 9) - ORANGE=$(tput setaf 172) - GREEN=$(tput setaf 190) - PURPLE=$(tput setaf 141) - WHITE=$(tput setaf 256) - else - MAGENTA=$(tput setaf 5) - ORANGE=$(tput setaf 4) - GREEN=$(tput setaf 2) - PURPLE=$(tput setaf 1) - WHITE=$(tput setaf 7) - fi - BOLD=$(tput bold) - RESET=$(tput sgr0) + tput sgr0 + if [[ $(tput colors) -ge 256 ]] 2>/dev/null; then + MAGENTA=$(tput setaf 9) + ORANGE=$(tput setaf 172) + GREEN=$(tput setaf 190) + PURPLE=$(tput setaf 141) + WHITE=$(tput setaf 256) + else + MAGENTA=$(tput setaf 5) + ORANGE=$(tput setaf 4) + GREEN=$(tput setaf 2) + PURPLE=$(tput setaf 1) + WHITE=$(tput setaf 7) + fi + BOLD=$(tput bold) + RESET=$(tput sgr0) else - MAGENTA="\033[1;31m" - ORANGE="\033[1;33m" - GREEN="\033[1;32m" - PURPLE="\033[1;35m" - WHITE="\033[1;37m" - BOLD="" - RESET="\033[m" + MAGENTA="\033[1;31m" + ORANGE="\033[1;33m" + GREEN="\033[1;32m" + PURPLE="\033[1;35m" + WHITE="\033[1;37m" + BOLD="" + RESET="\033[m" fi function parse_git_dirty() { - [[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*" + [[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*" } function parse_git_branch() { - git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1$(parse_git_dirty)/" + git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1$(parse_git_dirty)/" } PS1="\[${BOLD}${MAGENTA}\]\u \[$WHITE\]at \[$ORANGE\]\h \[$WHITE\]in \[$GREEN\]\w\[$WHITE\]\$([[ -n \$(git branch 2> /dev/null) ]] && echo \" on \")\[$PURPLE\]\$(parse_git_branch)\[$WHITE\]\n\$ \[$RESET\]"
\ No newline at end of file @@ -1,32 +1,32 @@ # Create a new directory and enter it function md() { - mkdir -p "$@" && cd "$@" + mkdir -p "$@" && cd "$@" } # Test if HTTP compression (RFC 2616 + SDCH) is enabled for a given URL. # Send a fake UA string for sites that sniff it instead of using the Accept-Encoding header. (Looking at you, ajax.googleapis.com!) function httpcompression() { - encoding="$(curl -LIs -H 'User-Agent: Mozilla/5 Gecko' -H 'Accept-Encoding: gzip,deflate,compress,sdch' "$1" | grep '^Content-Encoding:')" && echo "$1 is encoded using ${encoding#* }" || echo "$1 is not using any encoding" + encoding="$(curl -LIs -H 'User-Agent: Mozilla/5 Gecko' -H 'Accept-Encoding: gzip,deflate,compress,sdch' "$1" | grep '^Content-Encoding:')" && echo "$1 is encoded using ${encoding#* }" || echo "$1 is not using any encoding" } # Syntax-highlight JSON files function json() { - python -mjson.tool <<< "$*" | pygmentize -l javascript + python -mjson.tool <<< "$*" | pygmentize -l javascript } # All the dig info function digga() { - dig +nocmd "$1" any +multiline +noall +answer + dig +nocmd "$1" any +multiline +noall +answer } # Escape UTF-8 characters into their 3-byte format function escape() { - printf "\\\x%s" $(printf "$@" | xxd -p -c1 -u) - echo # newline + printf "\\\x%s" $(printf "$@" | xxd -p -c1 -u) + echo # newline } # Decode \x{ABCD}-style Unicode escape sequences function unidecode() { - perl -e "binmode(STDOUT, ':utf8'); print \"$@\"" - echo # newline + perl -e "binmode(STDOUT, ':utf8'); print \"$@\"" + echo # newline }
\ No newline at end of file @@ -61,10 +61,10 @@ set scrolloff=3 " Strip trailing whitespace (,ss) function! StripWhitespace () - let save_cursor = getpos(".") - let old_query = getreg('/') - :%s/\s\+$//e - call setpos('.', save_cursor) - call setreg('/', old_query) + let save_cursor = getpos(".") + let old_query = getreg('/') + :%s/\s\+$//e + call setpos('.', save_cursor) + call setreg('/', old_query) endfunction noremap <leader>ss :call StripWhitespace ()<CR>
\ No newline at end of file diff --git a/bootstrap.sh b/bootstrap.sh index 719568a..d8d8e67 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -4,6 +4,6 @@ git pull read -p "This may overwrite existing files in your home directory. Are you sure? (y/n) " -n 1 echo if [[ $REPLY =~ ^[Yy]$ ]]; then - rsync --exclude ".git/" --exclude ".DS_Store" --exclude "bootstrap.sh" --exclude "README.md" -av . ~ + rsync --exclude ".git/" --exclude ".DS_Store" --exclude "bootstrap.sh" --exclude "README.md" -av . ~ fi source "$HOME/.bash_profile"
\ No newline at end of file |