mirror of https://github.com/bjeanes/dotfiles.git
Merge branch 'master' of git@github.com:bjeanes/dot-files
* 'master' of git@github.com:bjeanes/dot-files: More fish config Renamed a lot of @ben_h's git aliases to the ones used at the office Added stuff from fish-nuggets and changed behaviour of a few Fish configuration from benhoskings Lots of changes over last few weeks the colorize option for ls is different on linux and darwin Reorganising slightly to hopefully work on Linux Conflicts: aliasespull/2/head
commit
c38307c26e
|
@ -0,0 +1,3 @@
|
|||
fish/fish_history
|
||||
fish/fish_read_history
|
||||
fish/fishd.*
|
|
@ -0,0 +1,3 @@
|
|||
[submodule "fish/nuggets"]
|
||||
path = fish/nuggets
|
||||
url = git://github.com/zmalltalker/fish-nuggets.git
|
67
aliases
67
aliases
|
@ -1,5 +1,5 @@
|
|||
alias gem='sudo gem' # sick of always forgetting sudo
|
||||
alias ls='ls -G'
|
||||
alias ls='ls -FG'
|
||||
alias ll='ls -lah'
|
||||
alias ..='cd ..;' # can then do .. .. .. to move up multiple directories.
|
||||
alias ...='.. ..'
|
||||
|
@ -7,14 +7,18 @@ alias g='grep -i' #case insensitive grep
|
|||
alias h='history|g'
|
||||
alias ducks='du -cks * | sort -rn|head -11' # Lists the size of all the folders
|
||||
alias top='top -o cpu'
|
||||
alias systail='tail -f /var/log/system.log'
|
||||
alias m='mate .'
|
||||
alias o='open .'
|
||||
alias et="m"
|
||||
|
||||
alias home='cd ~' # the tilda is too hard to reach
|
||||
alias systail='tail -f -n0 /var/log/system.log'
|
||||
alias aptail='tail -f -n0 /var/log/apache*/*log'
|
||||
alias l='ls'
|
||||
alias b='cd -'
|
||||
|
||||
alias c='clear' # shortcut to clear your terminal
|
||||
alias eprof='mate ~/.dot-files'
|
||||
|
||||
alias sprof='source ~/.bash_profile'
|
||||
|
||||
# useful command to find what you should be aliasing:
|
||||
|
@ -30,25 +34,58 @@ alias controller='script/generate controller'
|
|||
alias migration='script/generate migration'
|
||||
alias migrate='rake db:migrate'
|
||||
alias rollback='rake db:rollback'
|
||||
alias r='rake'
|
||||
alias webshare='python -c "import SimpleHTTPServer;SimpleHTTPServer.test()"'
|
||||
|
||||
alias startpg='sudo /Library/StartupItems/PostgreSQL/PostgreSQL start'
|
||||
alias pubkey='cat ~/.ssh/*.pub'
|
||||
|
||||
# replacement netstat cmd to find ports used by apps on OS X
|
||||
alias netstat="sudo lsof -i -P"
|
||||
|
||||
alias hidefile='/usr/bin/SetFile -a "V"'
|
||||
alias showfile='/usr/bin/SetFile -a "v"'
|
||||
|
||||
alias colorslist="set | egrep 'COLOR_\w*'" # lists all the colors
|
||||
|
||||
function f() { find * -name $1; }
|
||||
|
||||
function manpdf() { man -t $@ | open -f -a Preview; }
|
||||
function extract() {
|
||||
if [ -f $1 ] ; then
|
||||
case $1 in
|
||||
*.tar.bz2) tar xvjf $1 ;;
|
||||
*.tar.gz) tar xvzf $1 ;;
|
||||
*.bz2) bunzip2 $1 ;;
|
||||
*.rar) unrar x $1 ;;
|
||||
*.gz) gunzip $1 ;;
|
||||
*.tar) tar xvf $1 ;;
|
||||
*.tbz2) tar xvjf $1 ;;
|
||||
*.tgz) tar xvzf $1 ;;
|
||||
*.zip) unzip $1 ;;
|
||||
*.Z) uncompress $1 ;;
|
||||
*.7z) 7z x $1 ;;
|
||||
*) echo "'$1' cannot be extracted via >extract<" ;;
|
||||
esac
|
||||
else
|
||||
echo "'$1' is not a valid file"
|
||||
fi
|
||||
}
|
||||
|
||||
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}"
|
||||
}
|
||||
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='cat ~/.ssh/*.pub | pbcopy && echo "Keys copied to clipboard"'
|
||||
alias m='mate .'
|
||||
alias et="m"
|
||||
alias o='open .'
|
||||
alias eprof="mate ~/.dot-files"
|
||||
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
|
||||
|
|
23
bashrc
23
bashrc
|
@ -1,12 +1,24 @@
|
|||
system_name=`uname -s` # Sets 'Darwin' or 'Linux' etc
|
||||
|
||||
source ~/.exports
|
||||
# source ~/.bash_completion
|
||||
source ~/.gitrc
|
||||
source ~/.gemdoc
|
||||
source ~/.aliases
|
||||
source ~/.terminal
|
||||
source ~/.save-directory
|
||||
|
||||
export PS1='$(__git_ps1 "\[${COLOR_RED}\](%s)\[${COLOR_NC}\] ")\$ '
|
||||
if [ $system_name == 'Darwin' ]; then
|
||||
source ~/.gemdoc
|
||||
source ~/.terminal
|
||||
else
|
||||
if [ -f /etc/bash_completion ]; then
|
||||
. /etc/bash_completion
|
||||
fi
|
||||
fi
|
||||
|
||||
export PS1=' [`pwd`$(__git_ps1 " \[${COLOR_RED}\](%s)\[${COLOR_NC}\]")]\n$ '
|
||||
|
||||
function __pair_status {
|
||||
hitchstatus " %s";
|
||||
}
|
||||
|
||||
# readline settings
|
||||
bind "set completion-ignore-case on"
|
||||
|
@ -15,5 +27,6 @@ bind "set show-all-if-ambiguous On" # this allows you to automatically show comp
|
|||
|
||||
shopt -s checkwinsize
|
||||
shopt -s histappend
|
||||
shopt -s globstar
|
||||
|
||||
complete -C ~/.rake-completion.rb -o default rake
|
||||
complete -C ~/.rake-completion.rb -o default rake}
|
||||
|
|
28
exports
28
exports
|
@ -1,9 +1,23 @@
|
|||
export PATH="/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/:$PATH"
|
||||
export PATH="/Library/PostgreSQL8/bin/:$PATH"
|
||||
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"
|
||||
export CDPATH='.:~:~/Projecs:~/Sites'
|
||||
export GEM_OPEN_EDITOR='mate'
|
||||
else
|
||||
export EDITOR='nano -w'
|
||||
fi
|
||||
|
||||
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 IRBRC="$HOME/.irbrc"
|
||||
|
||||
export GIT_EDITOR=$EDITOR
|
||||
export VISUAL=$EDITOR
|
||||
|
||||
export COLOR_NC='\e[0m' # No Color
|
||||
export COLOR_WHITE='\e[1;37m'
|
||||
export COLOR_BLACK='\e[0;30m'
|
||||
|
@ -25,14 +39,10 @@ export COLOR_LIGHT_GRAY='\e[0;37m'
|
|||
export TERM=xterm-color
|
||||
export GREP_OPTIONS='--color=auto' GREP_COLOR='1;32'
|
||||
export CLICOLOR=1
|
||||
export EDITOR='mate -w'
|
||||
export GIT_EDITOR=$EDITOR
|
||||
export VISUAL=$EDITOR
|
||||
|
||||
# sets title of window to be user@host
|
||||
export PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*} ${PWD}"; echo -ne "\007"'
|
||||
|
||||
export BASH_COMPLETION='~/.bash_completion'
|
||||
|
||||
# export HISTCONTROL=erasedups # I actually want duplicates because of profileme
|
||||
export HISTSIZE=1000000
|
||||
export HISTSIZE=1000000
|
||||
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
#!/usr/bin/env ruby
|
||||
require 'rubygems'
|
||||
|
||||
if ARGV.first == '-l' || ARGV.first == '--list'
|
||||
puts Gem.cache.map{ |s| s[1].name }.uniq.sort.join( "\n" )
|
||||
else
|
||||
gem_name = ARGV.first
|
||||
gem_info = Gem.cache.search( gem_name ).first
|
||||
system "mate #{gem_info.full_gem_path}"
|
||||
end
|
|
@ -0,0 +1,12 @@
|
|||
#!/usr/bin/env ruby
|
||||
require 'rubygems'
|
||||
|
||||
|
||||
if ARGV.first == '-l' || ARGV.first == '--list'
|
||||
puts Gem.cache.map{ |s| s[1].name }.uniq.sort.join( "\n" )
|
||||
else
|
||||
gem_name = ARGV.first
|
||||
gem_info = Gem.cache.search( gem_name ).first
|
||||
doc_file = File.join( gem_info.full_gem_path.gsub(/1\.8\/gems/, "1.8/doc"), 'rdoc/index.html' )
|
||||
system "open #{doc_file}"
|
||||
end
|
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/env ruby
|
||||
|
||||
exit(1) unless ARGV[0] && File.exist?(ARGV[0])
|
||||
|
||||
require 'yaml'
|
||||
|
||||
dbs = YAML.load_file(ARGV[0]).collect do |name,info|
|
||||
adapter = info['adapter'] || info[:adapter]
|
||||
db = info['database'] || info[:database]
|
||||
[adapter,db]
|
||||
end.uniq.each do |(adapter,db)|
|
||||
puts "%s\t%s" % [adapter, db]
|
||||
end
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,13 @@
|
|||
function __cache_or_get_cap_completion -d "Create cap completions"
|
||||
mkdir -p "/tmp/cap_completion_cache"
|
||||
set -l hashed_pwd (md5 -q -s (pwd))
|
||||
set -l cap_cache_file "/tmp/cap_completion_cache/$hashed_pwd"
|
||||
|
||||
if not test -f "$cap_cache_file"
|
||||
cap -T 2>&1 | grep "^cap" |cut -d " " -f 2 > "$cap_cache_file"
|
||||
end
|
||||
|
||||
cat "$cap_cache_file"
|
||||
end
|
||||
|
||||
complete -x -c cap -a "(__cache_or_get_cap_completion)" --description 'Capistrano task'
|
|
@ -0,0 +1,5 @@
|
|||
function __gem_names
|
||||
gem list --no-versions | grep -v '*'
|
||||
end
|
||||
|
||||
complete -x -c cdgem -d 'gem name' -a "(__gem_names)"
|
|
@ -0,0 +1 @@
|
|||
complete -x -c createdb -d 'database name' -a "(__db_list_pg | uniq)"
|
|
@ -0,0 +1 @@
|
|||
complete -c cucumber -a "(ls features | sort | grep -vE \"^_\")"
|
|
@ -0,0 +1 @@
|
|||
complete -x -c dropdb -d 'database name' -a "(__db_list_pg | uniq)"
|
|
@ -0,0 +1,3 @@
|
|||
complete -x -c edit_gem -a '(edit_gem --list)' --description 'Ruby Gem'
|
||||
complete -c edit_gem -s l -l list --description "List installed gems"
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
complete -x -c gem_doc -a '(gem_doc --list)' --description 'Ruby Gem'
|
||||
complete -c gem_doc -s l -l list --description "List installed gems"
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
complete -c git-svn -a clone -d "Initialize and fetch revisions"
|
||||
complete -c git-svn -a commit-diff -d "Commit a diff between two trees"
|
||||
complete -c git-svn -a create-ignore -d "Create a .gitignore per svn:ignore"
|
||||
complete -c git-svn -a dcommit -d "Commit several diffs to merge with upstream"
|
||||
complete -c git-svn -a fetch -d "Download new revisions from Subversion"
|
||||
complete -c git-svn -a find-rev -d "Translate between Subversion revision numbers and tree-ish"
|
||||
complete -c git-svn -a info -d "Show info about the latest Subversion revision"
|
||||
complete -c git-svn -a init -d "Initialize a repo for tracking (requires URL argument)"
|
||||
complete -c git-svn -a log -d "Show commit logs"
|
||||
complete -c git-svn -a migrate -d "Migrate configuration/metadata/layout from previous versions of git-svn"
|
||||
complete -c git-svn -a propget -d "Print the value of a property on a file or directory"
|
||||
complete -c git-svn -a proplist -d "List all properties of a file or directory"
|
||||
complete -c git-svn -a rebase -d "Fetch and rebase your working directory"
|
||||
complete -c git-svn -a set-tree -d "Set a Subversion repository to a git tree-ish"
|
||||
complete -c git-svn -a show-externals -d "Show svn:externals listings"
|
||||
complete -c git-svn -a show-ignore -d "Show svn:ignore listings"
|
|
@ -0,0 +1,226 @@
|
|||
# fish completion for git
|
||||
|
||||
function __fish_git_branches
|
||||
git branch --no-color -a 2>/dev/null | sed 's/^..//'
|
||||
end
|
||||
|
||||
function __fish_git_tags
|
||||
git tag
|
||||
end
|
||||
|
||||
function __fish_git_heads
|
||||
__fish_git_branches
|
||||
__fish_git_tags
|
||||
end
|
||||
|
||||
function __fish_git_remotes
|
||||
git remote
|
||||
end
|
||||
|
||||
function __fish_git_ranges
|
||||
set from (commandline -ot | perl -ne 'my @parts = split(/\.\./); print $parts[0]')
|
||||
set to (commandline -ot | perl -ne 'my @parts = split(/\.\./); print $parts[1]')
|
||||
if [ "$from" = "" ]
|
||||
__fish_git_branches
|
||||
return 0
|
||||
end
|
||||
|
||||
for from_ref in (__fish_git_heads | grep -e "$from")
|
||||
for to_ref in (__fish_git_heads | grep -e "$to")
|
||||
printf "%s..%s\n" $from_ref $to_ref
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function __fish_git_needs_command
|
||||
set cmd (commandline -opc)
|
||||
if [ (count $cmd) -eq 1 -a $cmd[1] = 'git' ]
|
||||
return 0
|
||||
end
|
||||
return 1
|
||||
end
|
||||
|
||||
function __fish_git_using_command
|
||||
set cmd (commandline -opc)
|
||||
if [ (count $cmd) -gt 1 ]
|
||||
if [ $argv[1] = $cmd[2] ]
|
||||
return 0
|
||||
end
|
||||
end
|
||||
return 1
|
||||
end
|
||||
|
||||
# general options
|
||||
complete -f -c git -n 'not __fish_git_needs_command' -l help -d 'Display the manual of a git command'
|
||||
|
||||
#### fetch
|
||||
complete -f -c git -n '__fish_git_needs_command' -a fetch -d 'Download objects and refs from another repository'
|
||||
complete -f -c git -n '__fish_git_using_command fetch' -a '(__fish_git_remotes)' -d 'Remote'
|
||||
complete -f -c git -n '__fish_git_using_command fetch' -s q -l quiet -d 'Be quiet'
|
||||
complete -f -c git -n '__fish_git_using_command fetch' -s v -l verbose -d 'Be verbose'
|
||||
complete -f -c git -n '__fish_git_using_command fetch' -s a -l append -d 'Append ref names and object names'
|
||||
# TODO --upload-pack
|
||||
complete -f -c git -n '__fish_git_using_command fetch' -s f -l force -d 'Force update of local branches'
|
||||
# TODO other options
|
||||
|
||||
### remote
|
||||
complete -f -c git -n '__fish_git_needs_command' -a remote -d 'Manage set of tracked repositories'
|
||||
complete -f -c git -n '__fish_git_using_command remote' -a '(__fish_git_remotes)'
|
||||
complete -f -c git -n '__fish_git_using_command remote' -s v -l verbose -d 'Be verbose'
|
||||
complete -f -c git -n '__fish_git_using_command remote' -a add -d 'Adds a new remote'
|
||||
complete -f -c git -n '__fish_git_using_command remote' -a rm -d 'Removes a remote'
|
||||
complete -f -c git -n '__fish_git_using_command remote' -a show -d 'Shows a remote'
|
||||
complete -f -c git -n '__fish_git_using_command remote' -a prune -d 'Deletes all stale tracking branches'
|
||||
complete -f -c git -n '__fish_git_using_command remote' -a update -d 'Fetches updates'
|
||||
# TODO options
|
||||
|
||||
### show
|
||||
complete -f -c git -n '__fish_git_needs_command' -a show -d 'Shows the last commit of a branch'
|
||||
complete -f -c git -n '__fish_git_using_command show' -a '(__fish_git_branches)' -d 'Branch'
|
||||
# TODO options
|
||||
|
||||
### show-branch
|
||||
complete -f -c git -n '__fish_git_needs_command' -a show-branch -d 'Shows the commits on branches'
|
||||
complete -f -c git -n '__fish_git_using_command show-branch' -a '(__fish_git_heads)' --description 'Branch'
|
||||
# TODO options
|
||||
|
||||
### add
|
||||
complete -c git -n '__fish_git_needs_command' -a add -d 'Add file contents to the index'
|
||||
# TODO options
|
||||
|
||||
### checkout
|
||||
complete -f -c git -n '__fish_git_needs_command' -a checkout -d 'Checkout and switch to a branch'
|
||||
complete -c git -n '__fish_git_using_command checkout' -a '(__fish_git_branches)' --description 'Branch'
|
||||
complete -c git -n '__fish_git_using_command checkout' -a '(__fish_git_tags)' --description 'Tag'
|
||||
complete -c git -n '__fish_git_using_command checkout' -s b -d 'Create a new branch'
|
||||
# TODO options
|
||||
|
||||
### apply
|
||||
complete -f -c git -n '__fish_git_needs_command' -a apply -d 'Apply a patch on a git index file and a working tree'
|
||||
# TODO options
|
||||
|
||||
### archive
|
||||
complete -f -c git -n '__fish_git_needs_command' -a archive -d 'Create an archive of files from a named tree'
|
||||
# TODO options
|
||||
|
||||
### bisect
|
||||
complete -f -c git -n '__fish_git_needs_command' -a bisect -d 'Find the change that introduced a bug by binary search'
|
||||
# TODO options
|
||||
|
||||
### branch
|
||||
complete -f -c git -n '__fish_git_needs_command' -a branch -d 'List, create, or delete branches'
|
||||
complete -f -c git -n '__fish_git_using_command branch' -a '(__fish_git_branches)' -d 'Branch'
|
||||
complete -f -c git -n '__fish_git_using_command branch' -s d -d 'Delete Branch'
|
||||
complete -f -c git -n '__fish_git_using_command branch' -s D -d 'Force deletion of branch'
|
||||
complete -f -c git -n '__fish_git_using_command branch' -s m -d 'Rename branch'
|
||||
complete -f -c git -n '__fish_git_using_command branch' -s M -d 'Force renaming branch'
|
||||
complete -f -c git -n '__fish_git_using_command branch' -s a -d 'Lists both local and remote branches'
|
||||
|
||||
### cherry-pick
|
||||
complete -f -c git -n '__fish_git_needs_command' -a cherry-pick -d 'Apply the change introduced by an existing commit'
|
||||
complete -f -c git -n '__fish_git_using_command cherry-pick' -a '(__fish_git_branches)' -d 'Branch'
|
||||
# TODO options
|
||||
|
||||
### clone
|
||||
complete -f -c git -n '__fish_git_needs_command' -a clone -d 'Clone a repository into a new directory'
|
||||
# TODO options
|
||||
|
||||
### commit
|
||||
complete -c git -n '__fish_git_needs_command' -a commit -d 'Record changes to the repository'
|
||||
complete -c git -n '__fish_git_using_command commit' -l amend -d 'Amend the log message of the last commit'
|
||||
# TODO options
|
||||
|
||||
### diff
|
||||
complete -c git -n '__fish_git_needs_command' -a diff -d 'Show changes between commits, commit and working tree, etc'
|
||||
complete -c git -n '__fish_git_using_command diff' -a '(__fish_git_ranges)' -d 'Branch'
|
||||
complete -c git -n '__fish_git_using_command diff' -l cached -d 'Show diff of changes in the index'
|
||||
# TODO options
|
||||
|
||||
### grep
|
||||
complete -c git -n '__fish_git_needs_command' -a grep -d 'Print lines matching a pattern'
|
||||
# TODO options
|
||||
|
||||
### init
|
||||
complete -f -c git -n '__fish_git_needs_command' -a init -d 'Create an empty git repository or reinitialize an existing one'
|
||||
# TODO options
|
||||
|
||||
### log
|
||||
complete -c git -n '__fish_git_needs_command' -a log -d 'Show commit logs'
|
||||
complete -c git -n '__fish_git_using_command log' -a '(__fish_git_heads) (__fish_git_ranges)' -d 'Branch'
|
||||
complete -f -c git -n '__fish_git_using_command log' -l pretty -a 'oneline short medium full fuller email raw format:'
|
||||
# TODO options
|
||||
|
||||
### merge
|
||||
complete -f -c git -n '__fish_git_needs_command' -a merge -d 'Join two or more development histories together'
|
||||
complete -f -c git -n '__fish_git_using_command merge' -a '(__fish_git_branches)' -d 'Branch'
|
||||
complete -f -c git -n '__fish_git_using_command merge' -l commit -d "Autocommit the merge"
|
||||
complete -f -c git -n '__fish_git_using_command merge' -l no-commit -d "Don't autocommit the merge"
|
||||
complete -f -c git -n '__fish_git_using_command merge' -l stat -d "Show diffstat of the merge"
|
||||
complete -f -c git -n '__fish_git_using_command merge' -s n -l no-stat -d "Don't show diffstat of the merge"
|
||||
complete -f -c git -n '__fish_git_using_command merge' -l squash -d "Squash changes from other branch as a single commit"
|
||||
complete -f -c git -n '__fish_git_using_command merge' -l no-squash -d "Don't squash changes"
|
||||
complete -f -c git -n '__fish_git_using_command merge' -l ff -d "Don't generate a merge commit if merge is fast forward"
|
||||
complete -f -c git -n '__fish_git_using_command merge' -l no-ff -d "Generate a merge commit even if merge is fast forward"
|
||||
|
||||
# TODO options
|
||||
|
||||
### mv
|
||||
complete -c git -n '__fish_git_needs_command' -a mv -d 'Move or rename a file, a directory, or a symlink'
|
||||
# TODO options
|
||||
|
||||
### prune
|
||||
complete -f -c git -n '__fish_git_needs_command' -a prune -d 'Prune all unreachable objects from the object database'
|
||||
# TODO options
|
||||
|
||||
### pull
|
||||
complete -f -c git -n '__fish_git_needs_command' -a pull -d 'Fetch from and merge with another repository or a local branch'
|
||||
# TODO options
|
||||
|
||||
### push
|
||||
complete -f -c git -n '__fish_git_needs_command' -a push -d 'Update remote refs along with associated objects'
|
||||
# TODO options
|
||||
|
||||
### rebase
|
||||
complete -f -c git -n '__fish_git_needs_command' -a rebase -d 'Forward-port local commits to the updated upstream head'
|
||||
complete -f -c git -n '__fish_git_using_command rebase' -a '(__fish_git_branches)' -d 'Branch'
|
||||
# TODO options
|
||||
|
||||
### reset
|
||||
complete -c git -n '__fish_git_needs_command' -a reset -d 'Reset current HEAD to the specified state'
|
||||
complete -f -c git -n '__fish_git_using_command reset' -l hard -d 'Reset files in working directory'
|
||||
complete -c git -n '__fish_git_using_command reset' -a '(__fish_git_branches)'
|
||||
# TODO options
|
||||
|
||||
### revert
|
||||
complete -f -c git -n '__fish_git_needs_command' -a revert -d 'Revert an existing commit'
|
||||
# TODO options
|
||||
|
||||
### rm
|
||||
complete -c git -n '__fish_git_needs_command' -a rm -d 'Remove files from the working tree and from the index'
|
||||
# TODO options
|
||||
|
||||
### status
|
||||
complete -f -c git -n '__fish_git_needs_command' -a status -d 'Show the working tree status'
|
||||
# TODO options
|
||||
|
||||
### tag
|
||||
complete -f -c git -n '__fish_git_needs_command' -a tag -d 'Create, list, delete or verify a tag object signed with GPG'
|
||||
complete -f -c git -n '__fish_git_using_command tag; and __fish_not_contain_opt -s d; and __fish_not_contain_opt -s v; and test (count (commandline -opc | grep -v -e \'^-\')) -eq 3' -a '(__fish_git_branches)' -d 'Branch'
|
||||
complete -f -c git -n '__fish_git_using_command tag' -s d -d 'Remove a tag'
|
||||
complete -f -c git -n '__fish_git_using_command tag' -s v -d 'Verify signature of a tag'
|
||||
complete -f -c git -n '__fish_git_using_command tag' -s f -d 'Force overwriting exising tag'
|
||||
complete -f -c git -n '__fish_git_using_command tag' -s s -d 'Make a GPG-signed tag'
|
||||
complete -f -c git -n '__fish_contains_opt -s d' -a '(__fish_git_tags)' -d 'Tag'
|
||||
complete -f -c git -n '__fish_contains_opt -s v' -a '(__fish_git_tags)' -d 'Tag'
|
||||
# TODO options
|
||||
|
||||
### config
|
||||
complete -f -c git -n '__fish_git_needs_command' -a config -d 'Set and read git configuration variables'
|
||||
# TODO options
|
||||
|
||||
### format-patch
|
||||
complete -f -c git -n '__fish_git_needs_command' -a format-patch -d 'Generate patch series to send upstream'
|
||||
complete -f -c git -n '__fish_git_using_command format-patch' -a '(__fish_git_branches)' -d 'Branch'
|
||||
|
||||
### aliases (custom user-definer commands)
|
||||
complete -c git -n '__fish_git_needs_command' -a '(git config --get-regexp alias | sed -e "s/^alias\.\(\S\+\).*/\1/")' -d 'Alias (user-defined command)'
|
|
@ -0,0 +1 @@
|
|||
complete -x -c pg_dump -d postgres -a "(__db_list_pg | uniq)"
|
|
@ -0,0 +1 @@
|
|||
complete -x -c psql -d 'database name' -a "(__db_list_pg | uniq)"
|
|
@ -0,0 +1,13 @@
|
|||
function __cache_or_get_rake_completion -d "Create rake completions"
|
||||
mkdir -p "/tmp/rake_completion_cache_for_$USER"
|
||||
set -l hashed_pwd (md5 -q -s (pwd))
|
||||
set -l rake_cache_file "/tmp/rake_completion_cache_for_$USER/$hashed_pwd"
|
||||
|
||||
if not test -f "$rake_cache_file"
|
||||
rake -T 2>&1 | sed -e "/^(/d" -e "s/^rake \([a-z:_0-9!\-]*\).*/\1/" > "$rake_cache_file"
|
||||
end
|
||||
|
||||
cat "$rake_cache_file"
|
||||
end
|
||||
|
||||
complete -x -c rake -a "(__cache_or_get_rake_completion)" --description 'Rake Task'
|
|
@ -0,0 +1 @@
|
|||
complete -x -c rcd -a '(rdir | sed -e "s/\/.*\///g")' --description 'Rails Project'
|
|
@ -0,0 +1 @@
|
|||
complete -x -c rmate -a '(rdir | sed -e "s/\/.*\///g")' --description 'Rails Project'
|
|
@ -0,0 +1,23 @@
|
|||
cd $HOME ^/dev/null # for some reason $PWD is empty in new consoles
|
||||
|
||||
mkdir -p ~/.l
|
||||
|
||||
set fish_greeting ''
|
||||
|
||||
set -x PATH $PATH /usr/local/git/bin /usr/local/mysql/bin /usr/local/jruby/bin
|
||||
set -x CDPATH . ~ ~/Sites ~/Code /Volumes ~/.l
|
||||
|
||||
set -x EDITOR "mate -w"
|
||||
set -x VISUAL $EDITOR
|
||||
set -x GITEDITOR $EDITOR
|
||||
|
||||
set -x CLICOLOR 1
|
||||
set -x JAVA_HOME "/usr/"
|
||||
set -U BROWSER "open -a Safari"
|
||||
|
||||
|
||||
bind \cr "rake"
|
||||
|
||||
set fish_color_git_branch green
|
||||
set fish_color_cwd blue
|
||||
set fish_color_uneditable_cwd red
|
|
@ -0,0 +1,4 @@
|
|||
function __completion_cache_path
|
||||
echo "$HOME/.config/completion_caches/$argv[1]"
|
||||
|
||||
end
|
|
@ -0,0 +1,8 @@
|
|||
function __db_list
|
||||
switch $argv[1]
|
||||
case "pg"
|
||||
__db_list_pg | uniq
|
||||
case "mysql"
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
function __db_list_pg
|
||||
psql -c '\l' -t -A -F, | cut -d, -f1 | grep -E -v '^(postgres|template)'
|
||||
__db_list_web | grep -E '^postgres' | cut -f2
|
||||
|
||||
end
|
|
@ -0,0 +1,8 @@
|
|||
function __db_list_web
|
||||
switch (__detect_webapp)
|
||||
case rails merb merb_bundle
|
||||
parse_database_yml.rb config/database.yml
|
||||
case '*'
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,24 @@
|
|||
function __detect_webapp
|
||||
if __sinatra_app > /dev/null
|
||||
echo sinatra
|
||||
return
|
||||
end
|
||||
|
||||
if test -d 'script'
|
||||
echo rails
|
||||
return
|
||||
end
|
||||
|
||||
if test -d 'config'
|
||||
if test -d 'bin'
|
||||
echo merb_bundle
|
||||
else
|
||||
echo merb
|
||||
end
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
echo "unknown"
|
||||
|
||||
end
|
|
@ -0,0 +1,4 @@
|
|||
function __sinatra_app
|
||||
egrep -l "^require.+sinatra.\$" *.rb
|
||||
|
||||
end
|
|
@ -0,0 +1,16 @@
|
|||
function c
|
||||
switch (__detect_webapp)
|
||||
case rails
|
||||
./script/console $argv
|
||||
case sinatra
|
||||
irb -r (__sinatra_app)
|
||||
case merb_bundle
|
||||
./bin/merb -i $argv
|
||||
case merb
|
||||
merb -i $argv
|
||||
case '*'
|
||||
echo "doesn't look like you're in a web app... using plain ol' irb"
|
||||
irb
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,4 @@
|
|||
function cdgem --description 'cd to a gems directory'
|
||||
cd (dirname (gem which $argv)[2])
|
||||
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
function clean_rake_cache -d "Clean the rake autocomplete cache"
|
||||
for a in /tmp/rake_completion_cache_for_$USER/*
|
||||
rm "$a"
|
||||
end
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
function confirm
|
||||
echo "OK [y/N]?"
|
||||
read confirm_result
|
||||
test 'y' = $confirm_result
|
||||
|
||||
|
||||
end
|
|
@ -0,0 +1,16 @@
|
|||
function deplol
|
||||
gitst
|
||||
and gitco deploy
|
||||
and git merge work
|
||||
and gitlcg -25
|
||||
and gitco work
|
||||
and gitstp
|
||||
and gitlc origin/deploy..deploy
|
||||
and echo "Hit enter if that looks OK."
|
||||
and read
|
||||
and echo "Pushing..."
|
||||
and git push
|
||||
and cap deploy:all
|
||||
|
||||
|
||||
end
|
|
@ -0,0 +1,4 @@
|
|||
function eprof
|
||||
mate ~/.config
|
||||
|
||||
end
|
|
@ -0,0 +1,30 @@
|
|||
# function fish_prompt --description 'Write out the prompt'
|
||||
# set pr_timestamp (date '+%a %H:%M:%S')
|
||||
# set pr_user (whoami)
|
||||
# set pr_host (hostname | cut -d . -f 1)
|
||||
# set pr_cwd (prompt_pwd)
|
||||
# set pr_git_info (git_cwd_info)
|
||||
# printf "\033[90m$pr_timestamp\033[0m $pr_user\033[90m@\033[0m$pr_host \033[90m$pr_cwd\033[0m \033[32m>\033[0m "
|
||||
# end
|
||||
|
||||
function fish_prompt --description 'Write out the prompt'
|
||||
printf '%s%s@%s%s ' (set_color green) (whoami) (hostname|cut -d . -f 1) (set_color normal)
|
||||
|
||||
# Write the process working directory
|
||||
if test -w "."
|
||||
printf '%s%s ' (set_color -o $fish_color_cwd) (prompt_pwd)
|
||||
else
|
||||
printf '%s%s ' (set_color -o $fish_color_uneditable_cwd) (prompt_pwd)
|
||||
end
|
||||
|
||||
printf '%s%s ' (set_color $fish_color_git_branch) (git_parse_branch)
|
||||
|
||||
|
||||
if git_dirty
|
||||
printf '%s☠ ' (set_color red)
|
||||
end
|
||||
|
||||
printf '%s$%s ' (set_color -o $fish_color_cwd) (set_color normal)
|
||||
|
||||
printf '%s> ' (set_color normal)
|
||||
end
|
|
@ -0,0 +1,3 @@
|
|||
function fish_title
|
||||
echo -n $PWD
|
||||
end
|
|
@ -0,0 +1,3 @@
|
|||
function ga
|
||||
git add $argv;
|
||||
end
|
|
@ -0,0 +1,3 @@
|
|||
function gau
|
||||
git add -u $argv;
|
||||
end
|
|
@ -0,0 +1,3 @@
|
|||
function gc
|
||||
git commit -v $argv;
|
||||
end
|
|
@ -0,0 +1,4 @@
|
|||
function gca
|
||||
gc -a
|
||||
|
||||
end
|
|
@ -0,0 +1,3 @@
|
|||
function gco
|
||||
git checkout $argv;
|
||||
end
|
|
@ -0,0 +1,3 @@
|
|||
function gd
|
||||
git diff $argv | mate;
|
||||
end
|
|
@ -0,0 +1,3 @@
|
|||
function gdc.
|
||||
git diff --cached --color-words='.' $argv | mate;
|
||||
end
|
|
@ -0,0 +1,3 @@
|
|||
function gdc
|
||||
git diff --cached $argv | mate;
|
||||
end
|
|
@ -0,0 +1,10 @@
|
|||
function git_cwd_info
|
||||
if test -d .git
|
||||
printf -- " - %s, " (git_parse_branch)
|
||||
if test (git ls-files -m | wc -l) -eq 0
|
||||
echo 'clean'
|
||||
else
|
||||
printf "%s" (git_dirty_files_count)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
function git_dirty
|
||||
|
||||
not git diff HEAD --quiet ^/dev/null
|
||||
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
function git_dirty_files_count
|
||||
if test -d .git
|
||||
git diff --stat | tail -n1 | sed -E 's/^ *//' | sed -E 's/ [a-z ]+\((.)(\),)?/\1/g' | sed -E 's/[a-z ]+, / (/' | sed -E "s/([0-9]+)\+/$pr_green\1$pr_grey+/g" | sed -E "s/([0-9]+)\-/$pr_red\1$pr_grey-/g"
|
||||
end
|
||||
|
||||
|
||||
end
|
|
@ -0,0 +1,3 @@
|
|||
function git_parse_branch
|
||||
sh -c 'git branch --no-color 2> /dev/null' | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
|
||||
end
|
|
@ -0,0 +1,4 @@
|
|||
function gl
|
||||
git pull $argv
|
||||
|
||||
end
|
|
@ -0,0 +1,3 @@
|
|||
function glc
|
||||
git log $git_concise_log_format $argv;
|
||||
end
|
|
@ -0,0 +1,3 @@
|
|||
function glcg
|
||||
gslc --graph $argv;
|
||||
end
|
|
@ -0,0 +1,8 @@
|
|||
function glp
|
||||
printf "commits from %s%s/%s%s to %sHEAD%s" (set_color red) (git config branch.(git_parse_branch).remote) (git_parse_branch) (set_color normal) (set_color red) (set_color normal)
|
||||
echo
|
||||
git --no-pager log --graph (git config branch.(git_parse_branch).remote)/(git_parse_branch)..HEAD $git_concise_log_format
|
||||
echo
|
||||
|
||||
|
||||
end
|
|
@ -0,0 +1,4 @@
|
|||
function gps
|
||||
git push $argv
|
||||
|
||||
end
|
|
@ -0,0 +1,3 @@
|
|||
function gst
|
||||
git status $argv;
|
||||
end
|
|
@ -0,0 +1,4 @@
|
|||
function log
|
||||
tail -f n0 log/*.log
|
||||
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
function m
|
||||
if not test $argv
|
||||
set argv .
|
||||
end
|
||||
mate $argv
|
||||
|
||||
end
|
|
@ -0,0 +1,4 @@
|
|||
function migrate
|
||||
rake db:migrate $argv
|
||||
|
||||
end
|
|
@ -0,0 +1,4 @@
|
|||
function migration
|
||||
script/generate migration $argv
|
||||
|
||||
end
|
|
@ -0,0 +1,3 @@
|
|||
function mysqlbackup -d "Dump MySQL database"
|
||||
mysqldump --add-drop-table --single-transaction --allow-keywords --hex-blob --quick -u $MYSQL_USER -p --set-variable=max_allowed_packet=1000000000 $argv
|
||||
end
|
|
@ -0,0 +1,4 @@
|
|||
function netpid --description 'list process <-> socket handles'
|
||||
sudo lsof -i -P
|
||||
|
||||
end
|
|
@ -0,0 +1,4 @@
|
|||
function new_function --description 'my cool siretn'
|
||||
echo "cool"
|
||||
|
||||
end
|
|
@ -0,0 +1,12 @@
|
|||
function rcd -d "Search for rails project and change dir"
|
||||
if test $argv
|
||||
set dir (rdir $argv)
|
||||
if test $dir
|
||||
cd $dir
|
||||
else
|
||||
echo "Cannot find any project named '$argv'"
|
||||
end
|
||||
else
|
||||
echo "Usage: rcd <project>"
|
||||
end
|
||||
end
|
|
@ -0,0 +1,24 @@
|
|||
function rdir -d "Find dir for rails project"
|
||||
if test "$argv" = "clean"
|
||||
for a in /tmp/rdir_cache/*
|
||||
rm "$a"
|
||||
end
|
||||
echo "Cache cleaned"
|
||||
else
|
||||
if test "$argv"
|
||||
set -l hashed_project (md5 -q -s "$argv")
|
||||
set -l rdir_cache_file "/tmp/rdir_cache/$hashed_project"
|
||||
if not test -f "$rdir_cache_file"
|
||||
find ~/**/$argv/config/environment.rb | head -n 1 | sed -e 's/\/config\/environment.rb$//g' > "$rdir_cache_file"
|
||||
end
|
||||
cat "$rdir_cache_file"
|
||||
else
|
||||
set -l rdir_cache_file "/tmp/rdir_cache/all_projects"
|
||||
if not test -f "$rdir_cache_file"
|
||||
mkdir -p "/tmp/rdir_cache"
|
||||
find ~/**/config/environment.rb | sed -e 's/\/config\/environment.rb$//g' > "$rdir_cache_file"
|
||||
end
|
||||
cat "$rdir_cache_file"
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,12 @@
|
|||
function rmate -d "Search for rails project and open in Textmate"
|
||||
if test $argv
|
||||
set dir (rdir $argv)
|
||||
if test $dir
|
||||
mate $dir
|
||||
else
|
||||
echo "Cannot find any project named '$argv'"
|
||||
end
|
||||
else
|
||||
echo "Usage: rmate <project>"
|
||||
end
|
||||
end
|
|
@ -0,0 +1,16 @@
|
|||
function s
|
||||
switch (__detect_webapp)
|
||||
case rails
|
||||
./script/server $argv
|
||||
case sinatra
|
||||
ruby (__sinatra_app)
|
||||
case merb_bundle
|
||||
./bin/merb $argv
|
||||
case merb
|
||||
merb $argv
|
||||
case '*'
|
||||
echo "doesn't look like you're in a web app!"
|
||||
end
|
||||
|
||||
|
||||
end
|
|
@ -0,0 +1,3 @@
|
|||
function save --description 'Save current directory with name for quick access'
|
||||
ln -s "$PWD" "$HOME/.l/$argv"
|
||||
end
|
|
@ -0,0 +1,4 @@
|
|||
function sc --description 'Run the Rails console'
|
||||
script/console
|
||||
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
function ss --description 'Run the script/server'
|
||||
script/server
|
||||
|
||||
|
||||
end
|
|
@ -0,0 +1,4 @@
|
|||
function sshkey --description 'copy ssh keys to clipboard'
|
||||
cat ~/.ssh/*.pub | pbcopy
|
||||
|
||||
end
|
|
@ -0,0 +1,3 @@
|
|||
function tigs
|
||||
tig status $argv;
|
||||
end
|
|
@ -0,0 +1,3 @@
|
|||
function vi
|
||||
mate $argv;
|
||||
end
|
6
gemrc
6
gemrc
|
@ -1,10 +1,10 @@
|
|||
---
|
||||
:benchmark: false
|
||||
:gem: --no-ri --no-rdoc
|
||||
:verbose: true
|
||||
:update_sources: true
|
||||
:bulk_threshold: 1000
|
||||
:backtrace: false
|
||||
:sources:
|
||||
- http://gems.rubyforge.org/
|
||||
- http://gems.github.com/
|
||||
:backtrace: false
|
||||
:bulk_threshold: 1000
|
||||
:benchmark: false
|
||||
|
|
47
gitignore
47
gitignore
|
@ -8,4 +8,49 @@ pkg/*
|
|||
*.move1v3
|
||||
*~
|
||||
log/*
|
||||
tmp/**/*
|
||||
tmp/**/*
|
||||
# use glob syntax.
|
||||
syntax: glob
|
||||
*.ser
|
||||
*.class
|
||||
*~
|
||||
*.bak
|
||||
*.off
|
||||
*.old
|
||||
.DS_Store
|
||||
|
||||
# logs
|
||||
derby.log
|
||||
|
||||
# eclipse conf file
|
||||
.settings
|
||||
.classpath
|
||||
.project
|
||||
.manager
|
||||
|
||||
# building
|
||||
target
|
||||
build
|
||||
null
|
||||
tmp*
|
||||
temp*
|
||||
dist
|
||||
test-output
|
||||
|
||||
# other scm
|
||||
.svn
|
||||
.CVS
|
||||
.hg*
|
||||
|
||||
# switch to regexp syntax.
|
||||
# syntax: regexp
|
||||
# ^\.pc/
|
||||
|
||||
|
||||
# IntelliJ
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
|
||||
# Rubymine
|
||||
.idea
|
12
irbrc
12
irbrc
|
@ -1,10 +1,11 @@
|
|||
# require 'wirble'
|
||||
require 'pp'
|
||||
require 'rubygems'
|
||||
require 'wirble'
|
||||
|
||||
Wirble.init(:history_size => 10000)
|
||||
Wirble.colorize
|
||||
|
||||
=begin
|
||||
Wirble::Colorize.colors = {
|
||||
# delimiter colors
|
||||
:comma => :white,
|
||||
|
@ -38,6 +39,7 @@ Wirble::Colorize.colors = {
|
|||
:class => :red,
|
||||
:range => :light_blue,
|
||||
}
|
||||
=end
|
||||
|
||||
class Object
|
||||
# Return a list of methods defined locally for a particular object. Useful
|
||||
|
@ -46,4 +48,10 @@ class Object
|
|||
def local_methods(obj = self)
|
||||
(obj.methods - obj.class.superclass.instance_methods).sort
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Log to STDOUT if in Rails
|
||||
if ENV.include?('RAILS_ENV') && !Object.const_defined?('RAILS_DEFAULT_LOGGER')
|
||||
require 'logger'
|
||||
RAILS_DEFAULT_LOGGER = Logger.new(STDOUT)
|
||||
end
|
||||
|
|
9
terminal
9
terminal
|
@ -1,5 +1,8 @@
|
|||
# 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
|
||||
function mintw() { printf "\e[2t"; return 0; }
|
||||
|
||||
|
@ -48,12 +51,6 @@ 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; }
|
||||
|
||||
unset -v TITLE PROMPT_COMMAND
|
||||
declare -x TITLE="Terminal"
|
||||
declare -x PROMPT_COMMAND='printf "\e]0;${TITLE}\a"'
|
||||
|
||||
function title() { declare -x TITLE="$@"; }
|
||||
|
||||
# open a new Terminal window in same location as current directory
|
||||
unset -f newin
|
||||
function newin() {
|
||||
|
|
Loading…
Reference in New Issue