mirror of https://github.com/bjeanes/dotfiles.git
Major refactoring
parent
717affdc1c
commit
b2c6a258ac
30
bash/bashrc
30
bash/bashrc
|
@ -2,34 +2,10 @@ export CURRENT_SHELL=`which bash`
|
||||||
export DOT_FILES=$HOME/.config
|
export DOT_FILES=$HOME/.config
|
||||||
|
|
||||||
# All things that are both ZSH and Bash compatible
|
# All things that are both ZSH and Bash compatible
|
||||||
source $DOT_FILES/bash/common
|
source $DOT_FILES/shell/common.sh
|
||||||
source $DOT_FILES/bash/save-directory
|
|
||||||
|
# Git completion support in bash
|
||||||
source $DOT_FILES/git/git-completion
|
source $DOT_FILES/git/git-completion
|
||||||
|
|
||||||
alias reload="source ~/.bashrc"
|
|
||||||
|
|
||||||
export PS1="\w ♪ "
|
|
||||||
|
|
||||||
if [ $system_name == 'Darwin' ]; then
|
|
||||||
source $DOT_FILES/bash/terminal
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f /etc/bash_completion ]; then
|
|
||||||
. /etc/bash_completion
|
|
||||||
# else
|
|
||||||
# . $DOT_FILES/bash/bash_completion
|
|
||||||
fi
|
|
||||||
|
|
||||||
# readline settings
|
|
||||||
bind "set completion-ignore-case on"
|
|
||||||
bind "set bell-style none" # No bell, because it's damn annoying
|
|
||||||
bind "set show-all-if-ambiguous On" # this allows you to automatically show completion without double tab-ing
|
|
||||||
|
|
||||||
shopt -s checkwinsize
|
|
||||||
shopt -s histappend
|
|
||||||
shopt -s globstar 2>/dev/null # Bash 4 and above only
|
|
||||||
|
|
||||||
complete -C $DOT_FILES/bash/rake-completion.rb -o default rake}
|
|
||||||
|
|
||||||
# RVM
|
# RVM
|
||||||
[[ -s $HOME/.rvm/scripts/rvm ]] && source $HOME/.rvm/scripts/rvm
|
[[ -s $HOME/.rvm/scripts/rvm ]] && source $HOME/.rvm/scripts/rvm
|
||||||
|
|
11
bash/common
11
bash/common
|
@ -1,11 +0,0 @@
|
||||||
export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/local/mongodb/bin:/usr/local/pgsql/bin:/usr/X11/bin:/opt/local/bin
|
|
||||||
export CDPATH=".:${HOME}"
|
|
||||||
|
|
||||||
system_name=`uname -s` # Sets 'Darwin' or 'Linux' etc
|
|
||||||
|
|
||||||
# Common functionality between Zsh and Bash
|
|
||||||
source $DOT_FILES/bash/exports
|
|
||||||
source $DOT_FILES/git/gitrc
|
|
||||||
source $DOT_FILES/bash/aliases
|
|
||||||
|
|
||||||
export VCPROMPT=~/.config/misc/vcprompt.py
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
alias reload="source ~/.bashrc"
|
||||||
|
|
||||||
|
export PS1="\w ♪ "
|
||||||
|
|
||||||
|
if [ $system_name == 'Darwin' ]; then
|
||||||
|
source $DOT_FILES/bash/terminal
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f /etc/bash_completion ]; then
|
||||||
|
. /etc/bash_completion
|
||||||
|
# else
|
||||||
|
# . $DOT_FILES/bash/bash_completion
|
||||||
|
fi
|
||||||
|
|
||||||
|
# readline settings
|
||||||
|
bind "set completion-ignore-case on"
|
||||||
|
bind "set bell-style none" # No bell, because it's damn annoying
|
||||||
|
bind "set show-all-if-ambiguous On" # this allows you to automatically show completion without double tab-ing
|
||||||
|
|
||||||
|
shopt -s checkwinsize
|
||||||
|
shopt -s histappend
|
||||||
|
shopt -s cdable_vars
|
||||||
|
shopt -s globstar 2>/dev/null # Bash 4 and above only
|
||||||
|
|
||||||
|
complete -C $DOT_FILES/bash/rake-completion.rb -o default rake}
|
|
@ -1,10 +0,0 @@
|
||||||
if [ ! -f ~/.dirs ]; then
|
|
||||||
touch ~/.dirs
|
|
||||||
fi
|
|
||||||
|
|
||||||
alias show='cat ~/.dirs'
|
|
||||||
save (){
|
|
||||||
command sed "/!$/d" ~/.dirs > ~/.dirs1; \mv ~/.dirs1 ~/.dirs; echo "$@"=\"`pwd`\" >> ~/.dirs; source ~/.dirs ;
|
|
||||||
}
|
|
||||||
source ~/.dirs # Initialization for the above 'save' facility: source the .dirs file
|
|
||||||
shopt -s cdable_vars # set the bash option so that no '$' is required when using the above facility
|
|
|
@ -1,8 +1,3 @@
|
||||||
# From http://codesnippets.joyent.com/posts/show/1516
|
|
||||||
|
|
||||||
declare -x PROMPT_COMMAND='printf "\e]0;$(/bin/pwd | /usr/bin/tr -d "[[:cntrl:]]") \a"'
|
|
||||||
|
|
||||||
|
|
||||||
# Minimise terminal window to Dock
|
# Minimise terminal window to Dock
|
||||||
function mintw() { printf "\e[2t"; return 0; }
|
function mintw() { printf "\e[2t"; return 0; }
|
||||||
|
|
||||||
|
@ -50,12 +45,3 @@ function maxr() { printf "\e[3;0;0;t\e[8;0;100t"; /usr/bin/clear; return 0; }
|
||||||
|
|
||||||
# show number of lines & columns
|
# show number of lines & columns
|
||||||
function lc() { printf "lines: $(/usr/bin/tput lines)\ncolums: $(/usr/bin/tput cols)\n"; return 0; }
|
function lc() { printf "lines: $(/usr/bin/tput lines)\ncolums: $(/usr/bin/tput cols)\n"; return 0; }
|
||||||
|
|
||||||
# open a new Terminal window in same location as current directory
|
|
||||||
unset -f newin
|
|
||||||
function newin() {
|
|
||||||
/bin/pwd | /usr/bin/pbcopy
|
|
||||||
/usr/bin/open -a Terminal
|
|
||||||
/usr/bin/osascript -e 'tell application "Terminal" to do script with command "cd \"$(/usr/bin/pbpaste)\"; echo \" \" | /usr/bin/pbcopy; /usr/bin/clear"'
|
|
||||||
return 0
|
|
||||||
}
|
|
|
@ -2,7 +2,7 @@
|
||||||
:benchmark: false
|
:benchmark: false
|
||||||
:verbose: true
|
:verbose: true
|
||||||
:update_sources: true
|
:update_sources: true
|
||||||
gem: --no-ri
|
gem: --no-ri --no-rdoc
|
||||||
:sources:
|
:sources:
|
||||||
- http://gemcutter.org
|
- http://gemcutter.org
|
||||||
:backtrace: false
|
:backtrace: false
|
||||||
|
|
|
@ -1,18 +1,16 @@
|
||||||
alias gi='sudo gem install'
|
alias gi='sudo gem install'
|
||||||
alias ls='ls -FG'
|
|
||||||
alias ll='ls -lah'
|
alias ll='ls -lah'
|
||||||
alias ..='cd ..;' # can then do .. .. .. to move up multiple directories.
|
alias ..='cd ..;' # can then do .. .. .. to move up multiple directories.
|
||||||
alias ...='.. ..'
|
alias ...='.. ..'
|
||||||
alias g='grep -i' #case insensitive grep
|
alias g='grep -i' #case insensitive grep
|
||||||
alias h='history|g'
|
alias h='history|g'
|
||||||
alias ducks='du -cks * | sort -rn|head -11' # Lists the size of all the folders
|
alias ducks='du -cks * | sort -rn |head -11' # Lists the size of all the folders
|
||||||
alias top='top -o cpu'
|
alias top='top -o cpu'
|
||||||
alias o='open .'
|
alias et="$EDITOR ."
|
||||||
alias et="m"
|
|
||||||
|
|
||||||
alias sprof="reload"
|
alias sprof="reload"
|
||||||
|
|
||||||
alias home='cd ~' # the tilda is too hard to reach
|
alias home="cd $HOME" # the tilde is too hard to reach
|
||||||
alias systail='tail -f -n0 /var/log/system.log'
|
alias systail='tail -f -n0 /var/log/system.log'
|
||||||
alias aptail='tail -f -n0 /var/log/apache*/*log'
|
alias aptail='tail -f -n0 /var/log/apache*/*log'
|
||||||
alias l='ls'
|
alias l='ls'
|
||||||
|
@ -34,11 +32,7 @@ alias rollback='rake db:rollback'
|
||||||
alias r='rake'
|
alias r='rake'
|
||||||
alias webshare='python -c "import SimpleHTTPServer;SimpleHTTPServer.test()"'
|
alias webshare='python -c "import SimpleHTTPServer;SimpleHTTPServer.test()"'
|
||||||
|
|
||||||
alias pubkey='cat ~/.ssh/*.pub'
|
alias pubkey="cat $HOME/.ssh/*.pub"
|
||||||
|
|
||||||
# replacement netstat cmd to find ports used by apps on OS X
|
|
||||||
alias netstat="sudo lsof -i -P"
|
|
||||||
|
|
||||||
alias colorslist="set | egrep 'COLOR_\w*'" # lists all the colors
|
alias colorslist="set | egrep 'COLOR_\w*'" # lists all the colors
|
||||||
|
|
||||||
function f() { find * -name $1; }
|
function f() { find * -name $1; }
|
||||||
|
@ -75,7 +69,7 @@ function extract() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ `uname` = "Darwin" ]; then
|
if [ `uname -s` = "Darwin" ]; then
|
||||||
function prompt_pwd() {
|
function prompt_pwd() {
|
||||||
if [ "$PWD" != "$HOME" ]; then
|
if [ "$PWD" != "$HOME" ]; then
|
||||||
printf "%s" `echo $PWD|sed -e 's|/private||' -e "s|^$HOME|~|" -e 's-/\(\.\{0,1\}[^/]\)\([^/]*\)-/\1-g'`
|
printf "%s" `echo $PWD|sed -e 's|/private||' -e "s|^$HOME|~|" -e 's-/\(\.\{0,1\}[^/]\)\([^/]*\)-/\1-g'`
|
||||||
|
@ -97,27 +91,3 @@ else # defined two for diff systems because Fish did (not entirely sure why)
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if [ $system_name = 'Darwin' ]; then
|
|
||||||
function manpdf() { man -t $@ | open -f -a Preview; }
|
|
||||||
function osinfo() {
|
|
||||||
x1="$(/usr/bin/sw_vers -productName)"
|
|
||||||
x2="$(/usr/bin/sw_vers -productVersion)"
|
|
||||||
x3="$(/usr/bin/sw_vers -buildVersion)"
|
|
||||||
x4="$(/usr/bin/arch)"
|
|
||||||
echo "${x1} - ${x2} - ${x3} - ${x4}"
|
|
||||||
}
|
|
||||||
alias ls='ls -G'
|
|
||||||
alias pubkey='pubkey | pbcopy && echo "Keys copied to clipboard"'
|
|
||||||
alias et="m"
|
|
||||||
alias o='open .'
|
|
||||||
alias eprof="mate ~/.config"
|
|
||||||
alias hidefile='/usr/bin/SetFile -a "V"'
|
|
||||||
alias showfile='/usr/bin/SetFile -a "v"'
|
|
||||||
alias startpg='sudo /Library/StartupItems/PostgreSQL/PostgreSQL start'
|
|
||||||
alias readrails="mate `ruby -rubygems -e "puts( ['rails', 'activerecord', 'activeresource', 'actionpack', 'activesupport'].collect { |gem| gems = Gem.source_index.find_name(gem); gems.last.full_gem_path; }.join(' '))"`"
|
|
||||||
else
|
|
||||||
alias ls='ls --color=auto'
|
|
||||||
fi
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/local/mongodb/bin:/usr/local/pgsql/bin:/usr/X11/bin:/opt/local/bin
|
||||||
|
CDPATH=".:${HOME}"
|
||||||
|
|
||||||
|
source $DOT_FILES/shell/exports.sh
|
||||||
|
source $DOT_FILES/shell/aliases.sh
|
||||||
|
source $DOT_FILES/shell/save-directory.sh
|
||||||
|
source $DOT_FILES/git/git.sh
|
||||||
|
|
||||||
|
[[ `uname -s` == 'Darwin' ]] && source $DOT_FILES/shell/osx.sh
|
||||||
|
|
||||||
|
VCPROMPT=~/.config/misc/vcprompt.py
|
|
@ -1,24 +1,14 @@
|
||||||
if [ $system_name = 'Darwin' ]; then
|
|
||||||
export EDITOR='mate -w'
|
|
||||||
export PATH="/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/:$PATH"
|
|
||||||
export PATH="/Library/PostgreSQL8/bin/:$PATH"
|
|
||||||
CDPATH="${CDPATH}:${HOME}/Code/Mocra/:${HOME}/Code/Personal:${HOME}/Sites/Mocra/:${HOME}/Sites/Personal/"
|
|
||||||
export GEM_OPEN_EDITOR='mate'
|
|
||||||
else
|
|
||||||
export EDITOR='nano -w'
|
|
||||||
fi
|
|
||||||
|
|
||||||
export PATH="/usr/local/mysql/bin/:$PATH"
|
export PATH="/usr/local/mysql/bin/:$PATH"
|
||||||
export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
|
export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
|
||||||
export PATH="$PATH:/usr/local/jruby/bin"
|
export PATH="$PATH:/usr/local/jruby/bin"
|
||||||
|
|
||||||
|
export GEM_OPEN_EDITOR=$EDITOR
|
||||||
|
export GIT_EDITOR=$EDITOR
|
||||||
|
export VISUAL=$EDITOR
|
||||||
|
|
||||||
export IRBRC="$HOME/.irbrc"
|
export IRBRC="$HOME/.irbrc"
|
||||||
export JEWELER_OPTS="--rspec --gemcutter --rubyforge --reek --roodi"
|
export JEWELER_OPTS="--rspec --gemcutter --rubyforge --reek --roodi"
|
||||||
|
|
||||||
export GIT_EDITOR=$EDITOR
|
|
||||||
export VISUAL=$EDITOR
|
|
||||||
|
|
||||||
export COLOR_NC='\e[0m' # No Color
|
export COLOR_NC='\e[0m' # No Color
|
||||||
export COLOR_WHITE='\e[1;37m'
|
export COLOR_WHITE='\e[1;37m'
|
||||||
export COLOR_BLACK='\e[0;30m'
|
export COLOR_BLACK='\e[0;30m'
|
||||||
|
@ -41,9 +31,5 @@ export TERM=xterm-color
|
||||||
export GREP_OPTIONS='--color=auto' GREP_COLOR='1;32'
|
export GREP_OPTIONS='--color=auto' GREP_COLOR='1;32'
|
||||||
export CLICOLOR=1
|
export CLICOLOR=1
|
||||||
|
|
||||||
# sets title of window to be user@host
|
|
||||||
export PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*} ${PWD}"; echo -ne "\007"'
|
|
||||||
|
|
||||||
# export HISTCONTROL=erasedups # I actually want duplicates because of profileme
|
|
||||||
export HISTSIZE=1000000
|
export HISTSIZE=1000000
|
||||||
|
|
|
@ -0,0 +1,84 @@
|
||||||
|
export EDITOR='mate -w'
|
||||||
|
export PATH="/Library/PostgreSQL8/bin/:$PATH"
|
||||||
|
CDPATH="${CDPATH}:${HOME}/Code/Mocra/:${HOME}/Code/Personal:${HOME}/Sites/Mocra/:${HOME}/Sites/Personal/"
|
||||||
|
|
||||||
|
alias o='open .'
|
||||||
|
|
||||||
|
# replacement netstat cmd to find ports used by apps on OS X
|
||||||
|
alias netstat="sudo lsof -i -P"
|
||||||
|
alias pubkey='pubkey | pbcopy && echo "Keys copied to clipboard"'
|
||||||
|
|
||||||
|
|
||||||
|
alias hidefile='/usr/bin/SetFile -a "V"'
|
||||||
|
alias showfile='/usr/bin/SetFile -a "v"'
|
||||||
|
|
||||||
|
function manpdf() { man -t $@ | open -f -a Preview; }
|
||||||
|
function osinfo() {
|
||||||
|
x1="$(/usr/bin/sw_vers -productName)"
|
||||||
|
x2="$(/usr/bin/sw_vers -productVersion)"
|
||||||
|
x3="$(/usr/bin/sw_vers -buildVersion)"
|
||||||
|
x4="$(/usr/bin/arch)"
|
||||||
|
echo "${x1} - ${x2} - ${x3} - ${x4}"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function tab() {
|
||||||
|
osascript 2>/dev/null <<EOF
|
||||||
|
tell application "System Events"
|
||||||
|
tell process "Terminal" to keystroke "t" using command down
|
||||||
|
end
|
||||||
|
tell application "Terminal"
|
||||||
|
activate
|
||||||
|
do script with command "cd \"$PWD\"; $*" in window 1
|
||||||
|
end tell
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
# Minimise terminal window to Dock
|
||||||
|
function mintw() { printf "\e[2t"; return 0; }
|
||||||
|
|
||||||
|
# Send Terminal window to background
|
||||||
|
function bgtw() { printf "\e[6t"; return 0; }
|
||||||
|
|
||||||
|
function hidetw() {
|
||||||
|
/usr/bin/osascript -e 'tell application "System Events" to set visible of some item of ( get processes whose name = "Terminal" ) to false'
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# positive integer test (including zero)
|
||||||
|
function positive_int() { return $(test "$@" -eq "$@" > /dev/null 2>&1 && test "$@" -ge 0 > /dev/null 2>&1); }
|
||||||
|
|
||||||
|
# move the Terminal window
|
||||||
|
function mvtw() {
|
||||||
|
if [[ $# -eq 2 ]] && $(positive_int "$1") && $(positive_int "$2"); then
|
||||||
|
printf "\e[3;${1};${2};t"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# resize the Terminal window
|
||||||
|
function sizetw() {
|
||||||
|
if [[ $# -eq 2 ]] && $(positive_int "$1") && $(positive_int "$2"); then
|
||||||
|
printf "\e[8;${1};${2};t"
|
||||||
|
/usr/bin/clear
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# full screen
|
||||||
|
function fullscreen() { printf "\e[3;0;0;t\e[8;0;0t"; /usr/bin/clear; return 0; }
|
||||||
|
|
||||||
|
# default screen
|
||||||
|
function defaultscreen() { printf "\e[8;35;150;t"; printf "\e[3;300;240;t"; /usr/bin/clear; return 0; }
|
||||||
|
|
||||||
|
# max columns
|
||||||
|
function maxc() { printf "\e[3;0;0;t\e[8;50;0t"; /usr/bin/clear; return 0; }
|
||||||
|
|
||||||
|
# max rows
|
||||||
|
function maxr() { printf "\e[3;0;0;t\e[8;0;100t"; /usr/bin/clear; return 0; }
|
||||||
|
|
||||||
|
# show number of lines & columns
|
||||||
|
function lc() { printf "lines: $(/usr/bin/tput lines)\ncolums: $(/usr/bin/tput cols)\n"; return 0; }
|
|
@ -0,0 +1,11 @@
|
||||||
|
if [ ! -f ~/.dirs ]; then
|
||||||
|
touch ~/.dirs
|
||||||
|
fi
|
||||||
|
|
||||||
|
alias show='cat ~/.dirs'
|
||||||
|
save (){
|
||||||
|
command sed "/!$/d" ~/.dirs > ~/.dirs1
|
||||||
|
mv ~/.dirs1 ~/.dirs; echo "$@"=\"`pwd`\" >> ~/.dirs
|
||||||
|
source ~/.dirs
|
||||||
|
}
|
||||||
|
source ~/.dirs # Initialization for the above 'save' facility: source the .dirs file
|
16
zsh/zshrc
16
zsh/zshrc
|
@ -1,23 +1,23 @@
|
||||||
export DOT_FILES=$HOME/.config
|
|
||||||
export CURRENT_SHELL=`which zsh`
|
export CURRENT_SHELL=`which zsh`
|
||||||
|
export DOT_FILES=$HOME/.config
|
||||||
|
|
||||||
# Include some ZSH-compatible config from bash (such as aliases, etc)
|
# Common functionality between Zsh and Bash
|
||||||
source $DOT_FILES/bash/common
|
source $DOT_FILES/shell/common.sh
|
||||||
|
|
||||||
# Install and load oh-my-zsh
|
# Install and load oh-my-zsh
|
||||||
source $DOT_FILES/zsh/oh-my-zsh
|
source $DOT_FILES/zsh/oh-my-zsh.zsh
|
||||||
|
|
||||||
# Extra ZSH configuration
|
# Extra ZSH configuration
|
||||||
source $DOT_FILES/zsh/config
|
source $DOT_FILES/zsh/config.zsh
|
||||||
|
|
||||||
# Rake completion
|
# Rake completion
|
||||||
source $DOT_FILES/zsh/completions
|
source $DOT_FILES/zsh/completions.zsh
|
||||||
|
|
||||||
# Rake completion
|
# Rake completion
|
||||||
source $DOT_FILES/zsh/rake_completion
|
source $DOT_FILES/zsh/rake_completion.zsh
|
||||||
|
|
||||||
# My custom theme
|
# My custom theme
|
||||||
source $DOT_FILES/zsh/theme
|
source $DOT_FILES/zsh/theme.zsh
|
||||||
|
|
||||||
# RVM
|
# RVM
|
||||||
[[ -s $HOME/.rvm/scripts/rvm ]] && source $HOME/.rvm/scripts/rvm
|
[[ -s $HOME/.rvm/scripts/rvm ]] && source $HOME/.rvm/scripts/rvm
|
Loading…
Reference in New Issue