├── themes ├── dos │ └── dos.theme.bash ├── candy │ └── candy.theme.bash ├── minimal │ └── minimal.theme.bash ├── roderik │ └── roderik.theme.bash ├── pete │ └── pete.theme.bash ├── envy │ └── envy.theme.bash ├── simple │ └── simple.theme.bash ├── doubletime_multiline_pyonly │ └── doubletime_multiline_pyonly.theme.bash ├── doubletime_multiline │ └── doubletime_multiline.theme.bash ├── duru │ └── duru.theme.bash ├── standard │ └── standard.theme.bash ├── tylenol │ └── tylenol.theme.bash ├── sirup │ └── sirup.theme.bash ├── n0qorg │ └── n0qorg.theme.bash ├── bobby-python │ └── bobby-python.theme.bash ├── bobby │ └── bobby.theme.bash ├── rainbowbrite │ └── rainbowbrite.theme.bash ├── brunton │ └── brunton.theme.bash ├── luan │ └── luan.theme.bash ├── bakke │ └── bakke.theme.bash ├── emperor │ └── emperor.theme.bash ├── axon │ └── axon.theme.bash ├── tonka │ └── tonka.theme.bash ├── modern │ └── modern.theme.bash ├── axin │ └── axin.theme.bash ├── clean │ └── clean.theme.bash ├── modern-t │ └── modern-t.theme.bash ├── mbriggs │ └── mbriggs.theme.bash ├── nwinkler │ └── nwinkler.theme.bash ├── sexy │ └── sexy.theme.bash ├── zitron │ └── zitron.theme.bash ├── iterate │ └── iterate.theme.bash ├── pure │ └── pure.theme.bash ├── zork │ └── zork.theme.bash ├── slick │ └── slick.theme.bash ├── cupcake │ └── cupcake.theme.bash ├── doubletime │ └── doubletime.theme.bash ├── binaryanomaly │ └── binaryanomaly.theme.bash ├── rjorgenson │ └── rjorgenson.theme.bash ├── powerline-naked │ └── powerline-naked.theme.bash ├── dulcie │ └── dulcie.theme.bash ├── powerline-plain │ └── powerline-plain.theme.bash ├── demula │ └── demula.theme.bash └── powerline │ └── powerline.theme.bash ├── test ├── run ├── README.md ├── lib │ └── composure.bats ├── plugins │ ├── ruby.plugin.bats │ └── base.plugin.bats └── test_helper.bash ├── aliases └── available │ ├── fuck.aliases.bash │ ├── ansible.aliases.bash │ ├── hg.aliases.bash │ ├── tmux.aliases.bash │ ├── atom.aliases.bash │ ├── gitsvn.aliases.bash │ ├── todo.txt-cli.aliases.bash │ ├── bundler.aliases.bash │ ├── textmate.aliases.bash │ ├── maven.aliases.bash │ ├── svn.aliases.bash │ ├── emacs.aliases.bash │ ├── vim.aliases.bash │ ├── homebrew-cask.aliases.bash │ ├── homebrew.aliases.bash │ ├── clipboard.aliases.bash │ ├── vagrant.aliases.bash │ ├── rails.aliases.bash │ ├── heroku.aliases.bash │ ├── apt.aliases.bash │ ├── jitsu.aliases.bash │ ├── docker.aliases.bash │ ├── general.aliases.bash │ ├── osx.aliases.bash │ ├── laravel.aliases.bash │ └── git.aliases.bash ├── plugins └── available │ ├── fzf.plugin.bash │ ├── hub.plugin.bash │ ├── chruby.plugin.bash │ ├── gh.plugin.bash │ ├── pipsi.plugin.bash │ ├── tmuxinator.plugin.bash │ ├── tmux.plugin.bash │ ├── chruby-auto.plugin.bash │ ├── textmate.plugin.bash │ ├── node.plugin.bash │ ├── history.plugin.bash │ ├── latex.plugin.bash │ ├── git-subrepo.plugin.bash │ ├── java.plugin.bash │ ├── rbenv.plugin.bash │ ├── docker-machine.plugin.bash │ ├── boot2docker.plugin.bash │ ├── visual-studio-code.plugin.bash │ ├── xterm.plugin.bash │ ├── ssh.plugin.bash │ ├── subversion.plugin.bash │ ├── pyenv.plugin.bash │ ├── ruby.plugin.bash │ ├── hg.plugin.bash │ ├── extract.plugin.bash │ ├── todo.plugin.bash │ ├── rvm.plugin.bash │ ├── projects.plugin.bash │ ├── virtualenv.plugin.bash │ ├── z_autoenv.plugin.bash │ ├── python.plugin.bash │ ├── less-pretty-cat.plugin.bash │ ├── explain.plugin.bash │ ├── gif.plugin.bash │ ├── javascript.plugin.bash │ ├── nginx.plugin.bash │ ├── browser.plugin.bash │ ├── docker.plugin.bash │ ├── postgres.plugin.bash │ ├── todo │ ├── todo.cfg │ └── todo_completion │ ├── osx.plugin.bash │ ├── osx-timemachine.plugin.bash │ ├── dirs.plugin.bash │ ├── aws.plugin.bash │ ├── alias-completion.plugin.bash │ ├── battery.plugin.bash │ ├── z.plugin.bash │ └── git.plugin.bash ├── .travis.yml ├── custom └── example.bash ├── completion └── available │ ├── npm.completion.bash │ ├── conda.completion.bash │ ├── pip.completion.bash │ ├── brew.completion.bash │ ├── dirs.completion.bash │ ├── rake.completion.bash │ ├── gulp.completion.bash │ ├── capistrano.completion.bash │ ├── test_kitchen.completion.bash │ ├── projects.completion.bash │ ├── todo.completion.bash │ ├── gem.completion.bash │ ├── ssh.completion.bash │ ├── drush.completion.bash │ ├── bundler.completion.bash │ ├── maven.completion.bash │ ├── grunt.completion.bash │ ├── homesick.completion.bash │ ├── gradle.completion.bash │ ├── django.completion.bash │ ├── bash-it.completion.bash │ ├── git_flow.completion.bash │ ├── packer.completion.bash │ └── fabric-completion.bash ├── .gitignore ├── lib ├── appearance.bash ├── preview.bash └── history.bash ├── template └── bash_profile.template.bash ├── uninstall.sh ├── bash_it.sh └── install.sh /themes/dos/dos.theme.bash: -------------------------------------------------------------------------------- 1 | PROMPT="\w>>" 2 | -------------------------------------------------------------------------------- /test/run: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | 4 | exec bats ${CI:+--tap} test/{lib,plugins} 5 | -------------------------------------------------------------------------------- /aliases/available/fuck.aliases.bash: -------------------------------------------------------------------------------- 1 | # https://github.com/nvbn/thefuck 2 | alias fuck='eval $(thefuck $(fc -ln -1))' 3 | alias please='fuck' 4 | -------------------------------------------------------------------------------- /test/README.md: -------------------------------------------------------------------------------- 1 | ## Testing with [Bats](https://github.com/sstephenson/bats#installing-bats-from-source) 2 | ``` 3 | bats test/{lib,plugins} 4 | ``` 5 | -------------------------------------------------------------------------------- /aliases/available/ansible.aliases.bash: -------------------------------------------------------------------------------- 1 | cite 'about-alias' 2 | about-alias 'ansible abbreviations' 3 | 4 | alias ans=ansible 5 | alias ap=ansible-playbook 6 | -------------------------------------------------------------------------------- /plugins/available/fzf.plugin.bash: -------------------------------------------------------------------------------- 1 | cite about-plugin 2 | about-plugin 'load fzf, if you are using it' 3 | 4 | [ -f ~/.fzf.bash ] && source ~/.fzf.bash 5 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | install: git clone --depth 1 https://github.com/sstephenson/bats.git 3 | script: PATH="./bats/bin:$PATH" test/run 4 | language: c 5 | -------------------------------------------------------------------------------- /plugins/available/hub.plugin.bash: -------------------------------------------------------------------------------- 1 | cite about-plugin 2 | about-plugin 'load hub, if you are using it' 3 | 4 | command -v hub &> /dev/null && eval "$(hub alias -s)" 5 | -------------------------------------------------------------------------------- /aliases/available/hg.aliases.bash: -------------------------------------------------------------------------------- 1 | cite 'about-alias' 2 | about-alias 'mercurial abbreviations' 3 | 4 | alias hs='hg status' 5 | alias hsum='hg summary' 6 | alias hcm='hg commit -m' 7 | -------------------------------------------------------------------------------- /aliases/available/tmux.aliases.bash: -------------------------------------------------------------------------------- 1 | cite 'about-alias' 2 | about-alias 'Tmux terminal multiplexer' 3 | 4 | alias txl='tmux ls' 5 | alias txn='tmux new -s' 6 | alias txa='tmux a -t' 7 | -------------------------------------------------------------------------------- /custom/example.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # This is an example file. Don't use this for your custom scripts. Instead, create another file within the 4 | # custom directory. 5 | -------------------------------------------------------------------------------- /plugins/available/chruby.plugin.bash: -------------------------------------------------------------------------------- 1 | cite about-plugin 2 | about-plugin 'load chruby (from /usr/local/share/chruby)' 3 | 4 | source /usr/local/share/chruby/chruby.sh 5 | -------------------------------------------------------------------------------- /aliases/available/atom.aliases.bash: -------------------------------------------------------------------------------- 1 | cite 'about-alias' 2 | about-alias 'Atom.io editor abbreviations' 3 | 4 | alias a='atom' 5 | alias ah='atom .' 6 | alias apmup='apm update --no-confirm' 7 | -------------------------------------------------------------------------------- /plugins/available/gh.plugin.bash: -------------------------------------------------------------------------------- 1 | cite about-plugin 2 | about-plugin 'load gh, if you are using it (DEPRECATED, use hub instead)' 3 | 4 | command -v gh 2> /dev/null && eval "$(gh alias -s)" 5 | -------------------------------------------------------------------------------- /completion/available/npm.completion.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # npm (Node Package Manager) completion 4 | 5 | if command -v npm &>/dev/null 6 | then 7 | eval "$(npm completion)" 8 | fi 9 | -------------------------------------------------------------------------------- /plugins/available/pipsi.plugin.bash: -------------------------------------------------------------------------------- 1 | cite about-plugin 2 | about-plugin 'load pipsi, if you are using it' 3 | 4 | if [[ -f "$HOME/.local/bin/pipsi" ]] 5 | then 6 | pathmunge ~/.local/bin 7 | fi 8 | -------------------------------------------------------------------------------- /aliases/available/gitsvn.aliases.bash: -------------------------------------------------------------------------------- 1 | cite 'about-alias' 2 | about-alias 'common git-svn abbreviations' 3 | 4 | # Aliases 5 | alias gsr='git svn rebase' 6 | alias gsc='git svn dcommit' 7 | alias gsi='git svn info' 8 | -------------------------------------------------------------------------------- /plugins/available/tmuxinator.plugin.bash: -------------------------------------------------------------------------------- 1 | cite about-plugin 2 | about-plugin 'sources tmuxinator script if available' 3 | 4 | [[ -s "$HOME/.tmuxinator/scripts/tmuxinator" ]] && . "$HOME/.tmuxinator/scripts/tmuxinator" 5 | -------------------------------------------------------------------------------- /plugins/available/tmux.plugin.bash: -------------------------------------------------------------------------------- 1 | # make sure that tmux is launched in 256 color mode 2 | 3 | cite about-plugin 4 | about-plugin 'make sure that tmux is launched in 256 color mode' 5 | 6 | alias tmux="TERM=xterm-256color tmux" 7 | -------------------------------------------------------------------------------- /plugins/available/chruby-auto.plugin.bash: -------------------------------------------------------------------------------- 1 | cite about-plugin 2 | about-plugin 'load chruby + auto-switching (from /usr/local/share/chruby)' 3 | 4 | source /usr/local/share/chruby/chruby.sh 5 | source /usr/local/share/chruby/auto.sh 6 | -------------------------------------------------------------------------------- /aliases/available/todo.txt-cli.aliases.bash: -------------------------------------------------------------------------------- 1 | cite 'about-alias' 2 | about-alias 'todo.txt-cli abbreviations' 3 | 4 | alias tls="$TODO ls" 5 | alias ta="$TODO a" 6 | alias trm="$TODO rm" 7 | alias tdo="$TODO do" 8 | alias tpri="$TODO pri" 9 | -------------------------------------------------------------------------------- /completion/available/conda.completion.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | which register-python-argcomplete > /dev/null \ 3 | && eval "$(register-python-argcomplete conda)" \ 4 | || echo "Please install argcomplete to use conda completion" 5 | -------------------------------------------------------------------------------- /plugins/available/textmate.plugin.bash: -------------------------------------------------------------------------------- 1 | cite about-plugin 2 | about-plugin 'set textmate as a default editor' 3 | 4 | if $(command -v mate &> /dev/null) ; then 5 | export EDITOR="$(which mate) -w" 6 | export GIT_EDITOR=$EDITOR 7 | fi 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | */enabled/* 2 | .DS_Store 3 | custom/* 4 | !custom/example.bash 5 | .rvmrc 6 | aliases/custom.aliases.bash 7 | completion/custom.completion.bash 8 | lib/custom.bash 9 | plugins/custom.plugins.bash 10 | *.swp 11 | .*.un~ 12 | -------------------------------------------------------------------------------- /plugins/available/node.plugin.bash: -------------------------------------------------------------------------------- 1 | cite about-plugin 2 | about-plugin 'Node.js helper functions' 3 | 4 | pathmunge ./node_modules/.bin 5 | 6 | # Make sure the global npm prefix is on the path 7 | [[ `which npm` ]] && pathmunge $(npm config get prefix)/bin 8 | -------------------------------------------------------------------------------- /test/lib/composure.bats: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bats 2 | 3 | load ../test_helper 4 | load ../../lib/composure 5 | 6 | @test "lib composure: composure_keywords()" { 7 | run composure_keywords 8 | assert_output "about author example group param version" 9 | } 10 | -------------------------------------------------------------------------------- /themes/candy/candy.theme.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | function prompt_command() { 3 | PS1="${green}\u@\h ${blue}\T ${reset_color}${white}\w${reset_color}$(scm_prompt_info)${blue} →${bold_blue} ${reset_color} "; 4 | } 5 | 6 | PROMPT_COMMAND=prompt_command; 7 | -------------------------------------------------------------------------------- /aliases/available/bundler.aliases.bash: -------------------------------------------------------------------------------- 1 | cite 'about-alias' 2 | about-alias 'ruby bundler' 3 | 4 | # Bundler Commands 5 | alias be='bundle exec' 6 | alias bi='bundle install' 7 | alias bl='bundle list' 8 | alias bu='bundle update' 9 | alias bp='bundle package' 10 | -------------------------------------------------------------------------------- /plugins/available/history.plugin.bash: -------------------------------------------------------------------------------- 1 | # enter a few characters and press UpArrow/DownArrow 2 | # to search backwards/forwards through the history 3 | if [ -t 1 ]; 4 | then 5 | bind '"":history-search-backward' 6 | bind '"":history-search-forward' 7 | fi 8 | -------------------------------------------------------------------------------- /plugins/available/latex.plugin.bash: -------------------------------------------------------------------------------- 1 | cite about-plugin 2 | about-plugin 'use mactex' 3 | 4 | # add mactex to the path if its present 5 | MACTEX_PATH=/usr/local/texlive/2009/bin/universal-darwin 6 | if [[ -d $MACTEX_PATH ]]; then 7 | pathmunge $MACTEX_PATH after 8 | fi 9 | unset MACTEX_PATH 10 | -------------------------------------------------------------------------------- /aliases/available/textmate.aliases.bash: -------------------------------------------------------------------------------- 1 | cite 'about-alias' 2 | about-alias 'textmate abbreviations' 3 | 4 | case $OSTYPE in 5 | darwin*) 6 | # Textmate 7 | alias e='mate . &' 8 | alias et='mate app config db lib public script test spec config.ru Gemfile Rakefile README &' 9 | ;; 10 | esac 11 | -------------------------------------------------------------------------------- /plugins/available/git-subrepo.plugin.bash: -------------------------------------------------------------------------------- 1 | # Load git-subrepo if you are using it, and initialize completions 2 | 3 | cite about-plugin 4 | about-plugin 'load git-subrepo if you are using it, and initialize completions' 5 | 6 | [[ -e "${GIT_SUBREPO_ROOT:=~/.git-subrepo}/init" ]] && source "$GIT_SUBREPO_ROOT/init" 7 | -------------------------------------------------------------------------------- /lib/appearance.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # colored grep 4 | alias grep='grep --color=auto' 5 | export GREP_COLOR='1;33' 6 | 7 | # colored ls 8 | export LSCOLORS='Gxfxcxdxdxegedabagacad' 9 | 10 | # Load the theme 11 | if [[ $BASH_IT_THEME ]]; then 12 | source "$BASH_IT/themes/$BASH_IT_THEME/$BASH_IT_THEME.theme.bash" 13 | fi 14 | -------------------------------------------------------------------------------- /completion/available/pip.completion.bash: -------------------------------------------------------------------------------- 1 | 2 | # pip bash completion start 3 | _pip_completion() 4 | { 5 | COMPREPLY=( $( COMP_WORDS="${COMP_WORDS[*]}" \ 6 | COMP_CWORD=$COMP_CWORD \ 7 | PIP_AUTO_COMPLETE=1 $1 ) ) 8 | } 9 | complete -o default -F _pip_completion pip 10 | # pip bash completion end 11 | 12 | -------------------------------------------------------------------------------- /themes/minimal/minimal.theme.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | SCM_THEME_PROMPT_PREFIX="${cyan}(${green}" 4 | SCM_THEME_PROMPT_SUFFIX="${cyan})" 5 | SCM_THEME_PROMPT_DIRTY=" ${red}✗" 6 | SCM_THEME_PROMPT_CLEAN=" ${green}✓" 7 | 8 | prompt() { 9 | PS1="$(scm_prompt_info)${reset_color} ${cyan}\W${reset_color} " 10 | } 11 | 12 | PROMPT_COMMAND=prompt 13 | -------------------------------------------------------------------------------- /completion/available/brew.completion.bash: -------------------------------------------------------------------------------- 1 | if which brew >/dev/null 2>&1; then 2 | if [ -f `brew --prefix`/etc/bash_completion ]; then 3 | . `brew --prefix`/etc/bash_completion 4 | fi 5 | 6 | if [ -f `brew --prefix`/Library/Contributions/brew_bash_completion.sh ]; then 7 | . `brew --prefix`/Library/Contributions/brew_bash_completion.sh 8 | fi 9 | fi 10 | -------------------------------------------------------------------------------- /plugins/available/java.plugin.bash: -------------------------------------------------------------------------------- 1 | cite about-plugin 2 | about-plugin 'Java and JAR helper functions' 3 | 4 | function jar_manifest { 5 | about "extracts the specified JAR file's MANIFEST file and prints it to stdout" 6 | group 'java' 7 | param '1: JAR file to extract the MANIFEST from' 8 | example 'jar_manifest lib/foo.jar' 9 | 10 | unzip -c $1 META-INF/MANIFEST.MF 11 | } 12 | -------------------------------------------------------------------------------- /aliases/available/maven.aliases.bash: -------------------------------------------------------------------------------- 1 | cite 'about-alias' 2 | about-alias 'maven abbreviations' 3 | 4 | alias mci='mvn clean install' 5 | alias mi='mvn install' 6 | alias mrprep='mvn release:prepare' 7 | alias mrperf='mvn release:perform' 8 | alias mrrb='mvn release:rollback' 9 | alias mdep='mvn dependency:tree' 10 | alias mpom='mvn help:effective-pom' 11 | alias mcisk='mci -Dmaven.test.skip=true' 12 | -------------------------------------------------------------------------------- /plugins/available/rbenv.plugin.bash: -------------------------------------------------------------------------------- 1 | # Load rbebv, if you are using it 2 | 3 | cite about-plugin 4 | about-plugin 'load rbenv, if you are using it' 5 | 6 | pathmunge "${HOME}/.rbenv/bin" 7 | 8 | [[ `which rbenv` ]] && eval "$(rbenv init -)" 9 | 10 | # Load the auto-completion script if rbenv was loaded. 11 | [[ -e ~/.rbenv/completions/rbenv.bash ]] && source ~/.rbenv/completions/rbenv.bash 12 | -------------------------------------------------------------------------------- /aliases/available/svn.aliases.bash: -------------------------------------------------------------------------------- 1 | cite 'about-alias' 2 | about-alias 'common svn abbreviations' 3 | 4 | # Aliases 5 | alias svs='svn status' 6 | alias sa='svn add' 7 | alias sci='svn ci -m' 8 | alias sco='svn co' 9 | alias sup='svn up' 10 | alias scu='svn cleanup' 11 | alias sli='svn list' 12 | alias sdel='svn delete' 13 | alias sdif='svn diff' 14 | alias slog='svn log' 15 | alias smv='svn move' 16 | -------------------------------------------------------------------------------- /aliases/available/emacs.aliases.bash: -------------------------------------------------------------------------------- 1 | cite 'about-alias' 2 | about-alias 'emacs editor' 3 | 4 | case $OSTYPE in 5 | linux*) 6 | alias em='emacs' 7 | alias en='emacs -nw' 8 | alias e='emacsclient -n' 9 | alias et='emacsclient -t' 10 | alias ed='emacs --daemon' 11 | alias E='SUDO_EDITOR="emacsclient" sudo -e' 12 | ;; 13 | darwin*) 14 | alias em='open -a emacs' 15 | ;; 16 | esac 17 | -------------------------------------------------------------------------------- /aliases/available/vim.aliases.bash: -------------------------------------------------------------------------------- 1 | cite 'about-alias' 2 | about-alias 'vim abbreviations' 3 | 4 | VIM=$(command -v vim) 5 | GVIM=$(command -v gvim) 6 | MVIM=$(command -v mvim) 7 | 8 | [[ -n $VIM ]] && alias v=$VIM 9 | 10 | case $OSTYPE in 11 | darwin*) 12 | [[ -n $MVIM ]] && alias mvim="mvim --remote-tab" 13 | ;; 14 | *) 15 | [[ -n $GVIM ]] && alias gvim="gvim -b --remote-tab" 16 | ;; 17 | esac 18 | -------------------------------------------------------------------------------- /plugins/available/docker-machine.plugin.bash: -------------------------------------------------------------------------------- 1 | cite about-plugin 2 | about-plugin 'Helpers to get Docker setup correctly for docker-machine' 3 | 4 | # Note, this might need to be different if you use a machine other than 'dev' 5 | if [[ `uname -s` == "Darwin" ]]; then 6 | # check if dev machine is running 7 | docker-machine ls | grep --quiet 'dev.*Running' 8 | if [[ "$?" = "0" ]]; then 9 | eval "$(docker-machine env dev)" 10 | fi 11 | fi 12 | -------------------------------------------------------------------------------- /lib/preview.bash: -------------------------------------------------------------------------------- 1 | if [[ $BASH_PREVIEW ]]; 2 | then 3 | unset BASH_PREVIEW #Prevent infinite looping 4 | echo " 5 | 6 | Previewing Bash-it Themes 7 | 8 | " 9 | 10 | THEMES="$BASH_IT/themes/*/*.theme.bash" 11 | for theme in $THEMES 12 | do 13 | BASH_IT_THEME=${theme%.theme.bash} 14 | BASH_IT_THEME=${BASH_IT_THEME##*/} 15 | echo " 16 | $BASH_IT_THEME" 17 | echo "" | bash --init-file $BASH_IT/bash_it.sh -i 18 | done 19 | fi 20 | -------------------------------------------------------------------------------- /plugins/available/boot2docker.plugin.bash: -------------------------------------------------------------------------------- 1 | cite about-plugin 2 | about-plugin 'Helpers to get Docker setup correctly for boot2docker' 3 | 4 | # Note, this might need to be different if you have an older version 5 | # of boot2docker, or its configured for a different IP 6 | if [[ `uname -s` == "Darwin" ]]; then 7 | export DOCKER_HOST="tcp://192.168.59.103:2376" 8 | export DOCKER_CERT_PATH="~/.boot2docker/certs/boot2docker-vm" 9 | export DOCKER_TLS_VERIFY=1 10 | fi 11 | -------------------------------------------------------------------------------- /lib/history.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Bash History Handling 4 | 5 | shopt -s histappend # append to bash_history if Terminal.app quits 6 | export HISTCONTROL=erasedups # erase duplicates; alternative option: export HISTCONTROL=ignoredups 7 | export HISTSIZE=5000 # resize history size 8 | export AUTOFEATURE=true autotest 9 | 10 | function rh { 11 | history | awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' | sort -rn | head 12 | } 13 | -------------------------------------------------------------------------------- /plugins/available/visual-studio-code.plugin.bash: -------------------------------------------------------------------------------- 1 | cite about-plugin 2 | about-plugin 'Defines the `code` executable for Visual Studio Code on OS X' 3 | 4 | # Based on https://code.visualstudio.com/Docs/editor/setup 5 | if [[ `uname -s` == "Darwin" ]]; then 6 | function code () { 7 | about 'Starts Visual Studio Code in the provided directory' 8 | group 'visual-studio-code' 9 | 10 | VSCODE_CWD="$PWD" open -n -b "com.microsoft.VSCode" --args $* ; 11 | } 12 | fi 13 | -------------------------------------------------------------------------------- /aliases/available/homebrew-cask.aliases.bash: -------------------------------------------------------------------------------- 1 | # Some aliases for Homebrew Cask 2 | 3 | cite 'about-alias' 4 | about-alias 'homebrew-cask abbreviations' 5 | 6 | alias bcup='brew-cask update' 7 | alias bcin='brew-cask install' 8 | alias bcrm='brew-cask uninstall' 9 | alias bczp='brew-cask zap' 10 | alias bccl='brew-cask cleanup' 11 | alias bcsr='brew-cask search' 12 | alias bcls='brew-cask list' 13 | alias bcinf='brew-cask info' 14 | alias bcdr='brew-cask doctor' 15 | alias bced='brew-cask edit' 16 | -------------------------------------------------------------------------------- /test/plugins/ruby.plugin.bats: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bats 2 | 3 | load ../test_helper 4 | load ../../lib/helpers 5 | load ../../lib/composure 6 | load ../../plugins/available/ruby.plugin 7 | 8 | @test "plugins ruby: remove_gem is defined" { 9 | run type remove_gem 10 | assert_line 1 "remove_gem () " 11 | } 12 | 13 | @test "plugins ruby: PATH includes ~/.gem/ruby/bin" { 14 | last_path_entry=$(echo $PATH | tr ":" "\n" | tail -1); 15 | [[ "${last_path_entry}" == "${HOME}"/.gem/ruby/*/bin ]] 16 | } 17 | -------------------------------------------------------------------------------- /plugins/available/xterm.plugin.bash: -------------------------------------------------------------------------------- 1 | cite about-plugin 2 | about-plugin 'automatically set your xterm title with host and location info' 3 | 4 | set_xterm_title () { 5 | local title="$1" 6 | echo -ne "\033]0;$title\007" 7 | } 8 | 9 | 10 | precmd () { 11 | set_xterm_title "${USER}@${HOSTNAME} `dirs -0` $PROMPTCHAR" 12 | } 13 | 14 | preexec () { 15 | set_xterm_title "$1 {`dirs -0`} (${USER}@${HOSTNAME})" 16 | } 17 | 18 | case "$TERM" in 19 | xterm*|rxvt*) preexec_install;; 20 | esac 21 | -------------------------------------------------------------------------------- /aliases/available/homebrew.aliases.bash: -------------------------------------------------------------------------------- 1 | # Some aliases for Homebrew 2 | 3 | cite 'about-alias' 4 | about-alias 'homebrew abbreviations' 5 | 6 | alias bup='brew update && brew upgrade --all' 7 | alias bupc='brew update && brew upgrade --all && brew cleanup' 8 | alias bout='brew outdated' 9 | alias bin='brew install' 10 | alias brm='brew uninstall' 11 | alias bcl='brew cleanup' 12 | alias bls='brew list' 13 | alias bsr='brew search' 14 | alias binf='brew info' 15 | alias bdr='brew doctor' 16 | alias bed='brew edit' 17 | -------------------------------------------------------------------------------- /completion/available/dirs.completion.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Bash completion support for the 'dirs' plugin (commands G, R). 3 | 4 | _dirs-complete() { 5 | local CURRENT_PROMPT="${COMP_WORDS[COMP_CWORD]}" 6 | 7 | # parse all defined shortcuts from ~/.dirs 8 | if [ -r "$HOME/.dirs" ]; then 9 | COMPREPLY=($(compgen -W "$(grep -v '^#' ~/.dirs | sed -e 's/\(.*\)=.*/\1/')" -- ${CURRENT_PROMPT}) ) 10 | fi 11 | 12 | return 0 13 | } 14 | 15 | complete -o default -o nospace -F _dirs-complete G R 16 | -------------------------------------------------------------------------------- /plugins/available/ssh.plugin.bash: -------------------------------------------------------------------------------- 1 | cite about-plugin 2 | about-plugin 'ssh helper functions' 3 | 4 | function add_ssh() { 5 | about 'add entry to ssh config' 6 | param '1: host' 7 | param '2: hostname' 8 | param '3: user' 9 | group 'ssh' 10 | 11 | echo -en "\n\nHost $1\n HostName $2\n User $3\n ServerAliveInterval 30\n ServerAliveCountMax 120" >> ~/.ssh/config 12 | } 13 | 14 | function sshlist() { 15 | about 'list hosts defined in ssh config' 16 | group 'ssh' 17 | 18 | awk '$1 ~ /Host$/ { print $2 }' ~/.ssh/config 19 | } 20 | -------------------------------------------------------------------------------- /plugins/available/subversion.plugin.bash: -------------------------------------------------------------------------------- 1 | cite about-plugin 2 | about-plugin 'svn helper functions' 3 | 4 | rm_svn(){ 5 | about 'remove ".svn" files from directory' 6 | param '1: directory to search for files' 7 | group 'svn' 8 | 9 | if [ -z "$1" ]; then 10 | reference rm_svn 11 | return 12 | fi 13 | find $1 -name .svn -print0 | xargs -0 rm -rf 14 | } 15 | 16 | svn_add(){ 17 | about 'add to svn repo' 18 | group 'svn' 19 | 20 | svn status | grep '^\?' | sed -e 's/? *//' | sed -e 's/ /\ /g' | xargs svn add 21 | } 22 | -------------------------------------------------------------------------------- /plugins/available/pyenv.plugin.bash: -------------------------------------------------------------------------------- 1 | cite about-plugin 2 | about-plugin 'load pyenv, if you are using it' 3 | 4 | export PYENV_ROOT="$HOME/.pyenv" 5 | pathmunge "$PYENV_ROOT/bin" 6 | 7 | [[ `which pyenv` ]] && eval "$(pyenv init -)" 8 | 9 | #Load pyenv virtualenv if the virtualenv plugin is installed. 10 | if pyenv virtualenv-init - &> /dev/null; then 11 | eval "$(pyenv virtualenv-init -)" 12 | fi 13 | 14 | # Load the auto-completion script if pyenv was loaded. 15 | [[ -e $PYENV_ROOT/completions/pyenv.bash ]] && source $PYENV_ROOT/completions/pyenv.bash 16 | -------------------------------------------------------------------------------- /aliases/available/clipboard.aliases.bash: -------------------------------------------------------------------------------- 1 | cite 'about-alias' 2 | about-alias 'pbcopy and pbpaste shortcuts to linux' 3 | 4 | case $OSTYPE in 5 | linux*) 6 | XCLIP=$(command -v xclip) 7 | [[ $XCLIP ]] && alias pbcopy="$XCLIP -selection clipboard" && alias pbpaste="$XCLIP -selection clipboard -o" 8 | ;; 9 | esac 10 | 11 | # to use it just install xclip on your distribution and it would work like: 12 | # $ echo "hello" | pbcopy 13 | # $ pbpaste 14 | # hello 15 | 16 | # very useful for things like: 17 | # cat ~/.ssh/id_rsa.pub | pbcopy 18 | # have fun! 19 | -------------------------------------------------------------------------------- /themes/roderik/roderik.theme.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | export GIT_PS1_SHOWDIRTYSTATE=true 4 | export GIT_PS1_SHOWUNTRACKEDFILES=true 5 | export GIT_PS1_SHOWSTASHSTATE=true 6 | 7 | export PROMPT_DIRTRIM=3 8 | 9 | function prompt_command() { 10 | if [[ ${EUID} == 0 ]] ; then 11 | PS1="[\t]${yellow}[${red}\u@\h ${green}\w${yellow}]${red}$(__git_ps1 "(%s)")${normal}\\$ " 12 | else 13 | PS1="[\t]${yellow}[${cyan}\u@\h ${green}\w${yellow}]${red}$(__git_ps1 "(%s)")${normal}\\$ " 14 | fi 15 | } 16 | 17 | PROMPT_COMMAND=prompt_command; 18 | -------------------------------------------------------------------------------- /plugins/available/ruby.plugin.bash: -------------------------------------------------------------------------------- 1 | cite about-plugin 2 | about-plugin 'ruby and rubygems specific functions and settings' 3 | 4 | # Make commands installed with 'gem install --user-install' available 5 | # ~/.gem/ruby/${RUBY_VERSION}/bin/ 6 | if which ruby >/dev/null && which gem >/dev/null; then 7 | pathmunge "$(ruby -e 'print Gem.user_dir')/bin" after 8 | fi 9 | 10 | function remove_gem { 11 | about 'removes installed gem' 12 | param '1: installed gem name' 13 | group 'ruby' 14 | 15 | gem list | grep $1 | awk '{ print $1; }' | xargs sudo gem uninstall 16 | } 17 | -------------------------------------------------------------------------------- /themes/pete/pete.theme.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | prompt_setter() { 4 | # Save history 5 | history -a 6 | history -c 7 | history -r 8 | PS1="(\t) $(scm_char) [$blue\u$reset_color@$green\H$reset_color] $yellow\w${reset_color}$(scm_prompt_info)$(ruby_version_prompt) $reset_color " 9 | PS2='> ' 10 | PS4='+ ' 11 | } 12 | 13 | PROMPT_COMMAND=prompt_setter 14 | 15 | SCM_THEME_PROMPT_DIRTY=" ✗" 16 | SCM_THEME_PROMPT_CLEAN=" ✓" 17 | SCM_THEME_PROMPT_PREFIX=" (" 18 | SCM_THEME_PROMPT_SUFFIX=")" 19 | RVM_THEME_PROMPT_PREFIX=" (" 20 | RVM_THEME_PROMPT_SUFFIX=")" 21 | -------------------------------------------------------------------------------- /aliases/available/vagrant.aliases.bash: -------------------------------------------------------------------------------- 1 | cite 'about-alias' 2 | about-alias 'vagrant aliases' 3 | 4 | # Aliases 5 | alias vup="vagrant up" 6 | alias vupl="vagrant up 2>&1 | tee vagrant.log" 7 | alias vh="vagrant halt" 8 | alias vs="vagrant suspend" 9 | alias vr="vagrant resume" 10 | alias vrl="vagrant reload" 11 | alias vssh="vagrant ssh" 12 | alias vst="vagrant status" 13 | alias vp="vagrant provision" 14 | alias vdstr="vagrant destroy" 15 | # requires vagrant-list plugin 16 | alias vl="vagrant list" 17 | # requires vagrant-hostmanager plugin 18 | alias vhst="vagrant hostmanager" 19 | -------------------------------------------------------------------------------- /themes/envy/envy.theme.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | SCM_THEME_PROMPT_DIRTY=" ${red}✗" 3 | SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓" 4 | SCM_THEME_PROMPT_PREFIX=" |" 5 | SCM_THEME_PROMPT_SUFFIX="${green}|" 6 | 7 | GIT_THEME_PROMPT_DIRTY=" ${red}✗" 8 | GIT_THEME_PROMPT_CLEAN=" ${bold_green}✓" 9 | GIT_THEME_PROMPT_PREFIX=" ${green}|" 10 | GIT_THEME_PROMPT_SUFFIX="${green}|" 11 | 12 | function prompt_command() { 13 | PS1="\n${yellow}$(ruby_version_prompt) ${purple}\h ${reset_color}in ${green}\w\n${bold_cyan}$(scm_char)${green}$(scm_prompt_info) ${green}→${reset_color} " 14 | } 15 | 16 | PROMPT_COMMAND=prompt_command; 17 | -------------------------------------------------------------------------------- /themes/simple/simple.theme.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # prompt themeing 4 | 5 | #added TITLEBAR for updating the tab and window titles with the pwd 6 | case $TERM in 7 | xterm*) 8 | TITLEBAR="\[\033]0;\w\007\]" 9 | ;; 10 | *) 11 | TITLEBAR="" 12 | ;; 13 | esac 14 | 15 | function prompt_command() { 16 | PS1="${TITLEBAR}${orange}${reset_color}${green}\w${bold_blue}\[\$(scm_prompt_info)\]${reset_color} " 17 | } 18 | 19 | # scm themeing 20 | SCM_THEME_PROMPT_DIRTY=" ✗" 21 | SCM_THEME_PROMPT_CLEAN=" ✓" 22 | SCM_THEME_PROMPT_PREFIX="(" 23 | SCM_THEME_PROMPT_SUFFIX=")" 24 | 25 | PROMPT_COMMAND=prompt_command; 26 | -------------------------------------------------------------------------------- /plugins/available/hg.plugin.bash: -------------------------------------------------------------------------------- 1 | cite about-plugin 2 | about-plugin 'hg helper functions' 3 | 4 | hg_dirty() { 5 | about 'displays dirty status of hg repository' 6 | group 'hg' 7 | 8 | hg status --no-color 2> /dev/null \ 9 | | awk '$1 == "?" { print "?" } $1 != "?" { print "!" }' \ 10 | | sort | uniq | head -c1 11 | } 12 | 13 | hg_in_repo() { 14 | about 'determine if pwd is an hg repo' 15 | group 'hg' 16 | 17 | [[ `hg branch 2> /dev/null` ]] && echo 'on ' 18 | } 19 | 20 | hg_branch() { 21 | about 'display current hg branch' 22 | group 'hg' 23 | 24 | hg branch 2> /dev/null 25 | } 26 | -------------------------------------------------------------------------------- /completion/available/rake.completion.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Bash completion support for Rake, Ruby Make. 3 | 4 | export COMP_WORDBREAKS=${COMP_WORDBREAKS/\:/} 5 | 6 | _rakecomplete() { 7 | if [ -f Rakefile ]; then 8 | recent=`ls -t .rake_tasks~ Rakefile **/*.rake 2> /dev/null | head -n 1` 9 | if [[ $recent != '.rake_tasks~' ]]; then 10 | rake --silent --tasks | cut -d " " -f 2 > .rake_tasks~ 11 | fi 12 | COMPREPLY=($(compgen -W "`cat .rake_tasks~`" -- ${COMP_WORDS[COMP_CWORD]})) 13 | return 0 14 | fi 15 | } 16 | 17 | complete -o default -o nospace -F _rakecomplete rake 18 | -------------------------------------------------------------------------------- /themes/doubletime_multiline_pyonly/doubletime_multiline_pyonly.theme.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | source "$BASH_IT/themes/doubletime/doubletime.theme.bash" 4 | 5 | function prompt_setter() { 6 | # Save history 7 | history -a 8 | history -c 9 | history -r 10 | if [[ -z "$THEME_PROMPT_CLOCK_FORMAT" ]] 11 | then 12 | clock="\t" 13 | else 14 | clock=$THEME_PROMPT_CLOCK_FORMAT 15 | fi 16 | PS1=" 17 | $clock $(scm_char) [$THEME_PROMPT_HOST_COLOR\u@${THEME_PROMPT_HOST}$reset_color] $(virtualenv_prompt) 18 | \w 19 | $(doubletime_scm_prompt)$reset_color $ " 20 | PS2='> ' 21 | PS4='+ ' 22 | } 23 | 24 | PROMPT_COMMAND=prompt_setter 25 | -------------------------------------------------------------------------------- /themes/doubletime_multiline/doubletime_multiline.theme.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | source "$BASH_IT/themes/doubletime/doubletime.theme.bash" 4 | 5 | function prompt_setter() { 6 | # Save history 7 | history -a 8 | history -c 9 | history -r 10 | if [[ -z "$THEME_PROMPT_CLOCK_FORMAT" ]] 11 | then 12 | clock="\t" 13 | else 14 | clock=$THEME_PROMPT_CLOCK_FORMAT 15 | fi 16 | PS1=" 17 | $clock $(scm_char) [$THEME_PROMPT_HOST_COLOR\u@${THEME_PROMPT_HOST}$reset_color] $(virtualenv_prompt)$(ruby_version_prompt) 18 | \w 19 | $(doubletime_scm_prompt)$reset_color $ " 20 | PS2='> ' 21 | PS4='+ ' 22 | } 23 | 24 | PROMPT_COMMAND=prompt_setter 25 | -------------------------------------------------------------------------------- /themes/duru/duru.theme.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | SCM_THEME_PROMPT_PREFIX="${cyan} on ${green}" 4 | SCM_THEME_PROMPT_SUFFIX="" 5 | SCM_THEME_PROMPT_DIRTY=" ${red}with changes" 6 | SCM_THEME_PROMPT_CLEAN="" 7 | 8 | venv() { 9 | if [ ! -z "$VIRTUAL_ENV" ] 10 | then 11 | local env=$VIRTUAL_ENV 12 | echo "${gray} in ${orange}${env##*/} " 13 | fi 14 | } 15 | 16 | last_two_dirs() { 17 | pwd|rev|awk -F / '{print $1,$2}'|rev|sed s_\ _/_|sed "s|$(sed 's,\/,,'<<<$HOME)|~|g" 18 | } 19 | 20 | prompt() { 21 | PS1="${yellow}# ${reset_color}$(last_two_dirs)$(scm_prompt_info)${reset_color}$(venv)${reset_color} ${cyan}\n> ${reset_color}" 22 | } 23 | 24 | PROMPT_COMMAND=prompt 25 | -------------------------------------------------------------------------------- /themes/standard/standard.theme.bash: -------------------------------------------------------------------------------- 1 | # scm themeing 2 | SCM_THEME_PROMPT_DIRTY="×" 3 | SCM_THEME_PROMPT_CLEAN="✓" 4 | SCM_THEME_PROMPT_PREFIX="" 5 | SCM_THEME_PROMPT_SUFFIX="" 6 | 7 | # TODO: need a check for OS before adding this to the prompt 8 | # ${debian_chroot:+($debian_chroot)} 9 | 10 | #added TITLEBAR for updating the tab and window titles with the pwd 11 | case $TERM in 12 | xterm*) 13 | TITLEBAR='\[\033]0;\w\007\]' 14 | ;; 15 | *) 16 | TITLEBAR="" 17 | ;; 18 | esac 19 | 20 | function prompt_command() { 21 | PROMPT='${green}\u${normal}@${green}\h${normal}:${blue}\w${normal}${red}$(prompt_char)$(git_prompt_info)${normal}\$ ' 22 | } 23 | 24 | PROMPT_COMMAND=prompt_command; 25 | -------------------------------------------------------------------------------- /aliases/available/rails.aliases.bash: -------------------------------------------------------------------------------- 1 | cite 'about-alias' 2 | about-alias 'rails abbreviations' 3 | 4 | # Rails Commands 5 | alias r='rails' 6 | alias rg='rails g' 7 | alias rs='rails s' 8 | alias rc='rails c' 9 | alias rn='rails new' 10 | alias rb='rails dbconsole' 11 | alias rp='rails plugin' 12 | alias ra='rails application' 13 | alias rd='rails destroy' 14 | alias dbm='rake db:migrate' 15 | 16 | alias ss='script/server' 17 | alias ts="thin start" # thin server 18 | alias sc='script/console' 19 | alias restartapp='touch tmp/restart.txt' 20 | alias restart='touch tmp/restart.txt' # restart passenger 21 | alias devlog='tail -f log/development.log' 22 | alias taild='tail -f log/development.log' # tail dev log 23 | -------------------------------------------------------------------------------- /themes/tylenol/tylenol.theme.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Based on 'bobby' theme with the addition of virtualenv_prompt 4 | # 5 | 6 | SCM_THEME_PROMPT_DIRTY=" ${red}✗" 7 | SCM_THEME_PROMPT_CLEAN=" ${green}✓" 8 | SCM_THEME_PROMPT_PREFIX=" ${yellow}|${reset_color}" 9 | SCM_THEME_PROMPT_SUFFIX="${yellow}|" 10 | 11 | RVM_THEME_PROMPT_PREFIX="|" 12 | RVM_THEME_PROMPT_SUFFIX="|" 13 | VIRTUALENV_THEME_PROMPT_PREFIX='|' 14 | VIRTUALENV_THEME_PROMPT_SUFFIX='|' 15 | 16 | function prompt_command() { 17 | PS1="\n${green}$(virtualenv_prompt)${red}$(ruby_version_prompt) ${reset_color}\h ${orange}in ${reset_color}\w\n${yellow}$(scm_char)$(scm_prompt_info) ${yellow}→${white} " 18 | } 19 | 20 | PROMPT_COMMAND=prompt_command; 21 | -------------------------------------------------------------------------------- /themes/sirup/sirup.theme.bash: -------------------------------------------------------------------------------- 1 | # For unstaged(*) and staged(+) values next to branch name in __git_ps1 2 | GIT_PS1_SHOWDIRTYSTATE="enabled" 3 | 4 | function rvm_version_prompt { 5 | local gemset=$(echo $GEM_HOME | awk -F'@' '{print $2}') 6 | 7 | [ "$gemset" != "" ] && gemset="@$gemset" 8 | local version=$(echo $MY_RUBY_HOME | awk -F'-' '{print $2}') 9 | 10 | [ "$version" == "1.9.2" ] && version="" 11 | 12 | local full="$version$gemset" 13 | 14 | [ "$full" != "" ] && echo "$full" 15 | } 16 | 17 | function prompt_command() { 18 | # Check http://github.com/Sirupsen/dotfiles for screenshot 19 | PS1="$blue\W/$bold_blue$(rvm_version_prompt)$bold_green$(__git_ps1 " (%s)") ${normal}$ " 20 | } 21 | 22 | PROMPT_COMMAND=prompt_command; 23 | -------------------------------------------------------------------------------- /plugins/available/extract.plugin.bash: -------------------------------------------------------------------------------- 1 | cite about-plugin 2 | about-plugin 'one command to extract them all...' 3 | extract () { 4 | if [ $# -ne 1 ] 5 | then 6 | echo "Error: No file specified." 7 | return 1 8 | fi 9 | if [ -f $1 ] ; then 10 | case $1 in 11 | *.tar.bz2) tar xvjf $1 ;; 12 | *.tar.gz) tar xvzf $1 ;; 13 | *.bz2) bunzip2 $1 ;; 14 | *.rar) unrar x $1 ;; 15 | *.gz) gunzip $1 ;; 16 | *.tar) tar xvf $1 ;; 17 | *.tbz2) tar xvjf $1 ;; 18 | *.tgz) tar xvzf $1 ;; 19 | *.zip) unzip $1 ;; 20 | *.Z) uncompress $1 ;; 21 | *.7z) 7z x $1 ;; 22 | *) echo "'$1' cannot be extracted via extract" ;; 23 | esac 24 | else 25 | echo "'$1' is not a valid file" 26 | fi 27 | } 28 | -------------------------------------------------------------------------------- /themes/n0qorg/n0qorg.theme.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # n0qorg theme by Florian Baumann 3 | 4 | ## look-a-like 5 | # host directory (branch*)» 6 | # for example: 7 | # ananas ~/Code/bash-it/themes (master*)» 8 | function prompt_command() { 9 | PS1="${bold_blue}[$(hostname)]${normal} \w${normal} ${bold_white}[$(git_prompt_info)]${normal}» " 10 | } 11 | 12 | PROMPT_COMMAND=prompt_command; 13 | 14 | ## git-theme 15 | # feel free to change git chars. 16 | GIT_THEME_PROMPT_DIRTY="${bold_blue}*${bold_white}" 17 | GIT_THEME_PROMPT_CLEAN="" 18 | GIT_THEME_PROMPT_PREFIX="${bold_blue}(${bold_white}" 19 | GIT_THEME_PROMPT_SUFFIX="${bold_blue})" 20 | 21 | ## alternate chars 22 | # 23 | SCM_THEME_PROMPT_DIRTY="*" 24 | SCM_THEME_PROMPT_CLEAN="" 25 | SCM_THEME_PROMPT_PREFIX="(" 26 | SCM_THEME_PROMPT_SUFFIX=")" 27 | -------------------------------------------------------------------------------- /aliases/available/heroku.aliases.bash: -------------------------------------------------------------------------------- 1 | cite 'about-alias' 2 | about-alias 'heroku task abbreviations' 3 | 4 | # heroku 5 | alias h='heroku' 6 | alias hl='heroku list' 7 | alias hi='heroku info' 8 | alias ho='heroku open' 9 | 10 | # dynos and workers 11 | alias hd='heroku dynos' 12 | alias hw='heroku workers' 13 | 14 | # rake console 15 | alias hr='heroku rake' 16 | alias hcon='heroku console' 17 | 18 | # new and restart 19 | alias hnew='heroku create' 20 | alias hrestart='heroku restart' 21 | 22 | # logs 23 | alias hlog='heroku logs' 24 | alias hlogs='heroku logs' 25 | 26 | # maint 27 | alias hon='heroku maintenance:on' 28 | alias hoff='heroku maintenance:off' 29 | 30 | # heroku configs 31 | alias hc='heroku config' 32 | alias hca='heroku config:add' 33 | alias hcr='heroku config:remove' 34 | alias hcc='heroku config:clear' 35 | -------------------------------------------------------------------------------- /plugins/available/todo.plugin.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # you may override any of the exported variables below in your .bash_profile 4 | 5 | if [ -z "$TODO_DIR" ]; then 6 | export TODO_DIR=$BASH_IT/custom # store todo items in user's custom dir, ignored by git 7 | fi 8 | if [ -z "$TODOTXT_DEFAULT_ACTION" ]; then 9 | export TODOTXT_DEFAULT_ACTION=ls # typing 't' by itself will list current todos 10 | fi 11 | if [ -z "$TODO_SRC_DIR" ]; then 12 | export TODO_SRC_DIR=$BASH_IT/plugins/available/todo 13 | fi 14 | 15 | # respect ENV var set in .bash_profile, default is 't' 16 | alias $TODO='$TODO_SRC_DIR/todo.sh -d $TODO_SRC_DIR/todo.cfg' 17 | 18 | pathmunge $TODO_SRC_DIR after 19 | 20 | source $TODO_SRC_DIR/todo_completion # bash completion for todo.sh 21 | complete -F _todo $TODO # enable completion for 't' alias 22 | -------------------------------------------------------------------------------- /completion/available/gulp.completion.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Borrowed from grunt-cli 3 | # http://gruntjs.com/ 4 | # 5 | # Copyright (c) 2012 Tyler Kellen, contributors 6 | # Licensed under the MIT license. 7 | # https://github.com/gruntjs/grunt/blob/master/LICENSE-MIT 8 | # Usage: 9 | # 10 | # To enable bash completion for gulp, add the following line (minus the 11 | # leading #, which is the bash comment character) to your ~/.bashrc file: 12 | # 13 | # eval "$(gulp --completion=bash)" 14 | # Enable bash autocompletion. 15 | function _gulp_completions() { 16 | # The currently-being-completed word. 17 | local cur="${COMP_WORDS[COMP_CWORD]}" 18 | #Grab tasks 19 | local compls=$(gulp --tasks-simple) 20 | # Tell complete what stuff to show. 21 | COMPREPLY=($(compgen -W "$compls" -- "$cur")) 22 | } 23 | complete -o default -F _gulp_completions gulp 24 | -------------------------------------------------------------------------------- /plugins/available/rvm.plugin.bash: -------------------------------------------------------------------------------- 1 | # Load RVM, if you are using it 2 | 3 | cite about-plugin 4 | about-plugin 'load rvm, if you are using it' 5 | 6 | [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" 7 | 8 | # Check to make sure that RVM is actually loaded before adding 9 | # the customizations to it. 10 | if [ "$rvm_path" ] 11 | then 12 | # Load the auto-completion script if RVM was loaded. 13 | [[ -r $rvm_path/scripts/completion ]] && . $rvm_path/scripts/completion 14 | 15 | switch () { 16 | rvm $1 17 | local v=$(rvm_version) 18 | rvm wrapper $1 textmate 19 | echo "Switch to Ruby version: "$v 20 | } 21 | 22 | rvm_default () { 23 | rvm --default $1 24 | rvm wrapper $1 textmate 25 | } 26 | 27 | function rvm_version () { 28 | ruby --version 29 | } 30 | 31 | fi 32 | -------------------------------------------------------------------------------- /themes/bobby-python/bobby-python.theme.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | SCM_THEME_PROMPT_DIRTY=" ${red}✗" 3 | SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓" 4 | SCM_THEME_PROMPT_PREFIX=" |" 5 | SCM_THEME_PROMPT_SUFFIX="${green}|" 6 | 7 | GIT_THEME_PROMPT_DIRTY=" ${red}✗" 8 | GIT_THEME_PROMPT_CLEAN=" ${bold_green}✓" 9 | GIT_THEME_PROMPT_PREFIX=" ${green}|" 10 | GIT_THEME_PROMPT_SUFFIX="${green}|" 11 | 12 | CONDAENV_THEME_PROMPT_SUFFIX="|" 13 | 14 | function prompt_command() { 15 | #PS1="${bold_cyan}$(scm_char)${green}$(scm_prompt_info)${purple}$(ruby_version_prompt) ${yellow}\h ${reset_color}in ${green}\w ${reset_color}\n${green}→${reset_color} " 16 | PS1="\n${yellow}$(python_version_prompt) ${purple}\h ${reset_color}in ${green}\w\n${bold_cyan}$(scm_char)${green}$(scm_prompt_info) ${green}→${reset_color} " 17 | } 18 | 19 | PROMPT_COMMAND=prompt_command; 20 | -------------------------------------------------------------------------------- /themes/bobby/bobby.theme.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | SCM_THEME_PROMPT_DIRTY=" ${red}✗" 3 | SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓" 4 | SCM_THEME_PROMPT_PREFIX=" |" 5 | SCM_THEME_PROMPT_SUFFIX="${green}|" 6 | 7 | GIT_THEME_PROMPT_DIRTY=" ${red}✗" 8 | GIT_THEME_PROMPT_CLEAN=" ${bold_green}✓" 9 | GIT_THEME_PROMPT_PREFIX=" ${green}|" 10 | GIT_THEME_PROMPT_SUFFIX="${green}|" 11 | 12 | RVM_THEME_PROMPT_PREFIX="|" 13 | RVM_THEME_PROMPT_SUFFIX="|" 14 | 15 | function prompt_command() { 16 | #PS1="${bold_cyan}$(scm_char)${green}$(scm_prompt_info)${purple}$(ruby_version_prompt) ${yellow}\h ${reset_color}in ${green}\w ${reset_color}\n${green}→${reset_color} " 17 | PS1="\n$(battery_char) $(clock_char) ${yellow}$(ruby_version_prompt) ${purple}\h ${reset_color}in ${green}\w\n${bold_cyan}$(scm_char)${green}$(scm_prompt_info) ${green}→${reset_color} " 18 | } 19 | 20 | PROMPT_COMMAND=prompt_command; 21 | -------------------------------------------------------------------------------- /plugins/available/projects.plugin.bash: -------------------------------------------------------------------------------- 1 | cite about-plugin 2 | about-plugin 'add "export PROJECT_PATHS=~/projects:~/intertrode/projects" to navigate quickly to your project directories with `pj` and `pjo`' 3 | 4 | function pj { 5 | about 'navigate quickly to your various project directories' 6 | group 'projects' 7 | 8 | if [ -n "$PROJECT_PATHS" ]; then 9 | local cmd 10 | 11 | if [ "$1" == "open" ]; then 12 | shift 13 | cmd="$EDITOR" 14 | fi 15 | 16 | cmd="${cmd:-cd}" 17 | 18 | if [ -n "$1" ]; then 19 | for i in ${PROJECT_PATHS//:/$'\n'}; do 20 | if [ -d "$i"/"$1" ]; then 21 | $cmd "$i"/"$1" 22 | return 23 | fi 24 | done 25 | fi 26 | fi 27 | 28 | echo "No such project '$1'" 29 | } 30 | 31 | alias pjo="pj open" 32 | -------------------------------------------------------------------------------- /completion/available/capistrano.completion.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Bash completion support for Capistrano. 3 | 4 | export COMP_WORDBREAKS=${COMP_WORDBREAKS/\:/} 5 | 6 | _capcomplete() { 7 | if [ -f Capfile ]; then 8 | recent=`ls -t .cap_tasks~ Capfile **/*.cap 2> /dev/null | head -n 1` 9 | if [[ $recent != '.cap_tasks~' ]]; then 10 | cap --version | grep 'Capistrano v2.' > /dev/null 11 | if [ $? -eq 0 ]; then 12 | # Capistrano 2.x 13 | cap --tool --verbose --tasks | cut -d " " -f 2 > .cap_tasks~ 14 | else 15 | # Capistrano 3.x 16 | cap --all --tasks | cut -d " " -f 2 > .cap_tasks~ 17 | fi 18 | fi 19 | COMPREPLY=($(compgen -W "`cat .cap_tasks~`" -- ${COMP_WORDS[COMP_CWORD]})) 20 | return 0 21 | fi 22 | } 23 | 24 | complete -o default -o nospace -F _capcomplete cap 25 | -------------------------------------------------------------------------------- /aliases/available/apt.aliases.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # -binaryanomaly 4 | 5 | cite 'about-alias' 6 | about-alias 'Apt and dpkg aliases for Ubuntu and Debian distros.' 7 | 8 | # set apt aliases 9 | function _set_pkg_aliases() 10 | { 11 | if [ -x $(which apt) ]; then 12 | alias apts='sudo apt-cache search' 13 | alias aptshow='sudo apt-cache show' 14 | alias aptinst='sudo apt-get install -V' 15 | alias aptupd='sudo apt-get update' 16 | alias aptupg='sudo apt-get dist-upgrade -V && sudo apt-get autoremove' 17 | alias aptupgd='sudo apt-get update && sudo apt-get dist-upgrade -V && sudo apt-get autoremove' 18 | alias aptrm='sudo apt-get remove' 19 | alias aptpurge='sudo apt-get remove --purge' 20 | 21 | alias chkup='/usr/lib/update-notifier/apt-check -p --human-readable' 22 | alias chkboot='cat /var/run/reboot-required' 23 | 24 | alias pkgfiles='dpkg --listfiles' 25 | fi 26 | } 27 | 28 | _set_pkg_aliases 29 | -------------------------------------------------------------------------------- /plugins/available/virtualenv.plugin.bash: -------------------------------------------------------------------------------- 1 | # make sure virtualenvwrapper is enabled if available 2 | 3 | cite about-plugin 4 | about-plugin 'virtualenvwrapper helper functions' 5 | 6 | [[ `which virtualenvwrapper.sh` ]] && . virtualenvwrapper.sh 7 | 8 | 9 | function mkvenv { 10 | about 'create a new virtualenv for this directory' 11 | group 'virtualenv' 12 | 13 | cwd=`basename \`pwd\`` 14 | mkvirtualenv --distribute $cwd 15 | } 16 | 17 | 18 | function mkvbranch { 19 | about 'create a new virtualenv for the current branch' 20 | group 'virtualenv' 21 | 22 | mkvirtualenv --distribute "$(basename `pwd`)@$SCM_BRANCH" 23 | } 24 | 25 | function wovbranch { 26 | about 'sets workon branch' 27 | group 'virtualenv' 28 | 29 | workon "$(basename `pwd`)@$SCM_BRANCH" 30 | } 31 | 32 | function wovenv { 33 | about 'works on the virtualenv for this directory' 34 | group 'virtualenv' 35 | 36 | workon "$(basename `pwd`)" 37 | } 38 | -------------------------------------------------------------------------------- /plugins/available/z_autoenv.plugin.bash: -------------------------------------------------------------------------------- 1 | cite about-plugin 2 | about-plugin 'source into environment when cding to directories' 3 | 4 | if [[ -n "${ZSH_VERSION}" ]] 5 | then __array_offset=0 6 | else __array_offset=1 7 | fi 8 | 9 | autoenv_init() 10 | { 11 | typeset target home _file 12 | typeset -a _files 13 | target=$1 14 | home="$(dirname "$HOME")" 15 | 16 | _files=( $( 17 | while [[ "$PWD" != "/" && "$PWD" != "$home" ]] 18 | do 19 | _file="$PWD/.env" 20 | if [[ -e "${_file}" ]] 21 | then echo "${_file}" 22 | fi 23 | builtin cd .. 24 | done 25 | ) ) 26 | 27 | _file=${#_files[@]} 28 | while (( _file > 0 )) 29 | do 30 | source "${_files[_file-__array_offset]}" 31 | : $(( _file -= 1 )) 32 | done 33 | } 34 | 35 | cd() 36 | { 37 | if builtin cd "$@" 38 | then 39 | autoenv_init 40 | return 0 41 | else 42 | echo "else?" 43 | return $? 44 | fi 45 | } 46 | -------------------------------------------------------------------------------- /themes/rainbowbrite/rainbowbrite.theme.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # based off of n0qorg 4 | # looks like, if you're in a git repo: 5 | # ± ~/path/to (branch ✓) $ 6 | # in glorious red / blue / yellow color scheme 7 | 8 | prompt_setter() { 9 | # Save history 10 | history -a 11 | history -c 12 | history -r 13 | # displays user@server in purple 14 | # PS1="$red$(scm_char) $purple\u@\h$reset_color:$blue\w$yellow$(scm_prompt_info)$(ruby_version_prompt) $black\$$reset_color " 15 | # no user@server 16 | PS1="$red$(scm_char) $blue\w$yellow$(scm_prompt_info)$(ruby_version_prompt) $black\$$reset_color " 17 | PS2='> ' 18 | PS4='+ ' 19 | } 20 | 21 | PROMPT_COMMAND=prompt_setter 22 | 23 | SCM_NONE_CHAR='·' 24 | SCM_THEME_PROMPT_DIRTY=" ${red}✗" 25 | SCM_THEME_PROMPT_CLEAN=" ${green}✓" 26 | SCM_THEME_PROMPT_PREFIX=" (" 27 | SCM_THEME_PROMPT_SUFFIX="${yellow})" 28 | RVM_THEME_PROMPT_PREFIX=" (" 29 | RVM_THEME_PROMPT_SUFFIX=")" 30 | -------------------------------------------------------------------------------- /plugins/available/python.plugin.bash: -------------------------------------------------------------------------------- 1 | cite about-plugin 2 | about-plugin 'alias "shttp" to SimpleHTTPServer' 3 | 4 | if [ $(uname) = "Linux" ] 5 | then 6 | alias shttp='python2 -m SimpleHTTPServer' 7 | else 8 | alias shttp='python -m SimpleHTTPServer' 9 | fi 10 | 11 | function pyedit() { 12 | about 'opens python module in your EDITOR' 13 | param '1: python module to open' 14 | example '$ pyedit requests' 15 | group 'python' 16 | 17 | xpyc=`python -c "import sys; stdout = sys.stdout; sys.stdout = sys.stderr; import $1; stdout.write($1.__file__)"` 18 | 19 | if [ "$xpyc" == "" ]; then 20 | echo "Python module $1 not found" 21 | return -1 22 | 23 | elif [[ $xpyc == *__init__.py* ]]; then 24 | xpydir=`dirname $xpyc`; 25 | echo "$EDITOR $xpydir"; 26 | $EDITOR "$xpydir"; 27 | else 28 | echo "$EDITOR ${xpyc%.*}.py"; 29 | $EDITOR "${xpyc%.*}.py"; 30 | fi 31 | } 32 | -------------------------------------------------------------------------------- /plugins/available/less-pretty-cat.plugin.bash: -------------------------------------------------------------------------------- 1 | cite about-plugin 2 | about-plugin 'pygmentize instead of cat to terminal if possible' 3 | 4 | if $(command -v pygmentize &> /dev/null) ; then 5 | # get the full paths to binaries 6 | CAT_BIN=$(which cat) 7 | LESS_BIN=$(which less) 8 | 9 | # pigmentize cat and less outputs 10 | function cat() 11 | { 12 | about 'runs either pygmentize or cat on each file passed in' 13 | param '*: files to concatenate (as normally passed to cat)' 14 | example 'cat mysite/manage.py dir/text-file.txt' 15 | for var; 16 | do 17 | pygmentize "$var" 2>/dev/null || "$CAT_BIN" "$var"; 18 | done 19 | } 20 | 21 | function less() 22 | { 23 | about 'it pigments the file passed in and passes it to less for pagination' 24 | param '$1: the file to paginate with less' 25 | example 'less mysite/manage.py' 26 | pygmentize "$*" | "$LESS_BIN" -R 27 | } 28 | fi 29 | -------------------------------------------------------------------------------- /themes/brunton/brunton.theme.bash: -------------------------------------------------------------------------------- 1 | SCM_THEME_PROMPT_PREFIX="" 2 | SCM_THEME_PROMPT_SUFFIX="" 3 | 4 | SCM_THEME_PROMPT_DIRTY=" ${bold_red}✗${normal}" 5 | SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓${normal}" 6 | SCM_GIT_CHAR="${bold_green}±${normal}" 7 | SCM_SVN_CHAR="${bold_cyan}⑆${normal}" 8 | SCM_HG_CHAR="${bold_red}☿${normal}" 9 | 10 | is_vim_shell() { 11 | if [ ! -z "$VIMRUNTIME" ] 12 | then 13 | echo "[${cyan}vim shell${normal}]" 14 | fi 15 | } 16 | 17 | scm_prompt() { 18 | CHAR=$(scm_char) 19 | if [ $CHAR = $SCM_NONE_CHAR ] 20 | then 21 | return 22 | else 23 | echo " $(scm_char) (${white}$(scm_prompt_info)${normal})" 24 | fi 25 | } 26 | 27 | prompt() { 28 | PS1="${white}${background_blue} \u${normal}${background_blue}@${red}${background_blue}\h ${blue}${background_white} \t ${reset_color}${normal} $(battery_charge) 29 | ${bold_black}${background_white} \w ${normal}$(scm_prompt)$(is_vim_shell) 30 | ${white}>${normal} " 31 | 32 | } 33 | 34 | PROMPT_COMMAND=prompt 35 | -------------------------------------------------------------------------------- /plugins/available/explain.plugin.bash: -------------------------------------------------------------------------------- 1 | cite about-plugin 2 | about-plugin 'mankier.com explain function to explain other commands' 3 | 4 | explain () { 5 | about 'explain any bash command via mankier.com manpage API' 6 | param '1: Name of the command to explain' 7 | example '$ explain # interactive mode. Type commands to explain in REPL' 8 | example '$ explain 'cmd -o | ...' # one quoted command to explain it.' 9 | group 'explain' 10 | 11 | if [ "$#" -eq 0 ]; then 12 | while read -p "Command: " cmd; do 13 | curl -Gs "https://www.mankier.com/api/explain/?cols="$(tput cols) --data-urlencode "q=$cmd" 14 | done 15 | echo "Bye!" 16 | elif [ "$#" -eq 1 ]; then 17 | curl -Gs "https://www.mankier.com/api/explain/?cols="$(tput cols) --data-urlencode "q=$1" 18 | else 19 | echo "Usage" 20 | echo "explain interactive mode." 21 | echo "explain 'cmd -o | ...' one quoted command to explain it." 22 | fi 23 | } 24 | 25 | -------------------------------------------------------------------------------- /template/bash_profile.template.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Path to the bash it configuration 4 | export BASH_IT="{{BASH_IT}}" 5 | 6 | # Lock and Load a custom theme file 7 | # location /.bash_it/themes/ 8 | export BASH_IT_THEME='bobby' 9 | 10 | # Your place for hosting Git repos. I use this for private repos. 11 | export GIT_HOSTING='git@git.domain.com' 12 | 13 | # Don't check mail when opening terminal. 14 | unset MAILCHECK 15 | 16 | # Change this to your console based IRC client of choice. 17 | export IRC_CLIENT='irssi' 18 | 19 | # Set this to the command you use for todo.txt-cli 20 | export TODO="t" 21 | 22 | # Set this to false to turn off version control status checking within the prompt for all themes 23 | export SCM_CHECK=true 24 | 25 | # Set vcprompt executable path for scm advance info in prompt (demula theme) 26 | # https://github.com/xvzf/vcprompt 27 | #export VCPROMPT_EXECUTABLE=~/.vcprompt/bin/vcprompt 28 | 29 | # Load Bash It 30 | source $BASH_IT/bash_it.sh 31 | -------------------------------------------------------------------------------- /themes/luan/luan.theme.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | SCM_THEME_PROMPT_DIRTY=" ${red}✗" 3 | SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓" 4 | SCM_THEME_PROMPT_PREFIX="(${yellow}" 5 | SCM_THEME_PROMPT_SUFFIX="${normal})" 6 | 7 | GIT_THEME_PROMPT_DIRTY=" ${red}✗" 8 | GIT_THEME_PROMPT_CLEAN=" ${bold_green}✓" 9 | GIT_THEME_PROMPT_PREFIX="(${yellow}" 10 | GIT_THEME_PROMPT_SUFFIX="${normal})" 11 | 12 | RVM_THEME_PROMPT_PREFIX="" 13 | RVM_THEME_PROMPT_SUFFIX="" 14 | 15 | function prompt_command() { 16 | dtime="${yellow}\T${normal}" 17 | user_host="${green}\u@${cyan}\h${normal}" 18 | current_dir="${bold_blue}\w${normal}" 19 | rvm_ruby="${bold_red}$(ruby_version_prompt)${normal}" 20 | git_branch="$(scm_prompt_info)${normal}" 21 | prompt="${bold_green}\$${normal} " 22 | arrow="${bold_white}▶${normal} " 23 | prompt="${bold_green}\$${normal} " 24 | 25 | PS1="${dtime} ${user_host}:${current_dir} ${rvm_ruby} ${git_branch} 26 | $arrow $prompt" 27 | } 28 | 29 | PROMPT_COMMAND=prompt_command; 30 | -------------------------------------------------------------------------------- /completion/available/test_kitchen.completion.bash: -------------------------------------------------------------------------------- 1 | __kitchen_instance_list () { 2 | # cache to .kitchen.list.yml 3 | if [[ .kitchen.yml -nt .kitchen.list.yml || .kitchen.local.yml -nt .kitchen.list.yml ]]; then 4 | # update list if config has updated 5 | kitchen list --bare > .kitchen.list.yml 6 | fi 7 | cat .kitchen.list.yml 8 | } 9 | 10 | __kitchen_options () { 11 | cur="${COMP_WORDS[COMP_CWORD]}" 12 | prev="${COMP_WORDS[COMP_CWORD-1]}" 13 | COMPREPLY=() 14 | 15 | case $prev in 16 | converge|create|destroy|diagnose|list|login|setup|test|verify) 17 | COMPREPLY=( $(compgen -W "$(__kitchen_instance_list)" -- ${cur} )) 18 | return 0 19 | ;; 20 | driver) 21 | COMPREPLY=( $(compgen -W "create discover help" -- ${cur} )) 22 | return 0 23 | ;; 24 | *) 25 | COMPREPLY=( $(compgen -W "console converge create destroy driver help init list login setup test verify version" -- ${cur} )) 26 | return 0 27 | ;; 28 | esac 29 | } 30 | complete -F __kitchen_options kitchen 31 | 32 | -------------------------------------------------------------------------------- /themes/bakke/bakke.theme.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | SCM_THEME_PROMPT_DIRTY=" ${red}✗" 3 | SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓" 4 | SCM_THEME_PROMPT_PREFIX=" |" 5 | SCM_THEME_PROMPT_SUFFIX="${green}|" 6 | 7 | GIT_THEME_PROMPT_DIRTY=" ${red}✗" 8 | GIT_THEME_PROMPT_CLEAN=" ${bold_green}✓" 9 | GIT_THEME_PROMPT_PREFIX=" ${green}|" 10 | GIT_THEME_PROMPT_SUFFIX="${green}|" 11 | 12 | RVM_THEME_PROMPT_PREFIX="|" 13 | RVM_THEME_PROMPT_SUFFIX="|" 14 | 15 | function prompt_command() { 16 | #PS1="${bold_cyan}$(scm_char)${green}$(scm_prompt_info)${purple}$(ruby_version_prompt) ${yellow}\h ${reset_color}in ${green}\w ${reset_color}\n${green}→${reset_color} " 17 | #PS1="\n${purple}\h: ${reset_color} ${green}\w\n${bold_cyan}$(scm_char)${green}$(scm_prompt_info) ${green}→${reset_color} " 18 | #PS1="\n${cyan}\h: ${reset_color} ${yellow}\w\n${red}$(scm_char)${red}$(scm_prompt_info) ${green}→${reset_color} " 19 | PS1="\n${cyan}\h: ${reset_color} ${yellow}\w ${green}$(scm_prompt_info)\n${reset_color}→ " 20 | } 21 | 22 | PROMPT_COMMAND=prompt_command; 23 | -------------------------------------------------------------------------------- /themes/emperor/emperor.theme.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | SCM_THEME_PROMPT_DIRTY=" ${red}✗" 3 | SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓" 4 | SCM_THEME_PROMPT_PREFIX=" |" 5 | SCM_THEME_PROMPT_SUFFIX="${green}|" 6 | 7 | GIT_THEME_PROMPT_DIRTY=" ${red}✗" 8 | GIT_THEME_PROMPT_CLEAN=" ${bold_green}✓" 9 | GIT_THEME_PROMPT_PREFIX=" ${green}|" 10 | GIT_THEME_PROMPT_SUFFIX="${green}|" 11 | 12 | RVM_THEME_PROMPT_PREFIX="|" 13 | RVM_THEME_PROMPT_SUFFIX="|" 14 | 15 | function get_hour_color { 16 | hour_color=$red 17 | min=$(date +%M) 18 | if [ "$min" -lt "15" ]; then 19 | hour_color=$white 20 | elif [ "$min" -lt "30" ]; then 21 | hour_color=$green 22 | elif [ "$min" -lt "45" ]; then 23 | hour_color=$yellow 24 | else 25 | hour_color=$red 26 | fi 27 | echo "$hour_color" 28 | } 29 | 30 | function prompt_command() { 31 | PS1="\n$(get_hour_color)$(date +%H) ${purple}\h ${reset_color}in ${prompt_color}\w\n${bold_cyan}$(scm_char)${green}$(scm_prompt_info) ${green}→${reset_color} " 32 | } 33 | 34 | PROMPT_COMMAND=prompt_command; 35 | -------------------------------------------------------------------------------- /themes/axon/axon.theme.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | function get_hour_color { 4 | hour_color=$red 5 | min=$(date +%M) 6 | if [ "$min" -lt "15" ]; then 7 | hour_color=$white 8 | elif [ "$min" -lt "30" ]; then 9 | hour_color=$green 10 | elif [ "$min" -lt "45" ]; then 11 | hour_color=$yellow 12 | else 13 | hour_color=$red 14 | fi 15 | echo "$hour_color" 16 | } 17 | 18 | 19 | PROMPT_COMMAND='printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/\~}"' 20 | PS1="[\u@\h \W]\\$ " 21 | 22 | PS1="$(get_hour_color)$(date +%H) ${bold_red}\h${reset_color} ${prompt_color}\W \\$\[\e[0;37m\] " 23 | 24 | # Turn on parallel history 25 | shopt -s histappend 26 | history -a 27 | # Turn on checkwinsize 28 | shopt -s checkwinsize 29 | [ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ " 30 | pathmunge () { 31 | case ":${PATH}:" in 32 | *:"$1":*) 33 | ;; 34 | *) 35 | if [ "$2" = "after" ] ; then 36 | PATH=$PATH:$1 37 | else 38 | PATH=$1:$PATH 39 | fi 40 | esac 41 | } 42 | 43 | unset -f pathmunge 44 | -------------------------------------------------------------------------------- /uninstall.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | if [ -z "$BASH_IT" ]; 3 | then 4 | BASH_IT="$HOME/.bash_it" 5 | fi 6 | 7 | case $OSTYPE in 8 | darwin*) 9 | CONFIG_FILE=.bash_profile 10 | ;; 11 | *) 12 | CONFIG_FILE=.bashrc 13 | ;; 14 | esac 15 | 16 | BACKUP_FILE=$CONFIG_FILE.bak 17 | 18 | if [ ! -e "$HOME/$BACKUP_FILE" ]; then 19 | echo -e "\033[0;33mBackup file "$HOME/$BACKUP_FILE" not found.\033[0m" >&2 20 | 21 | test -w "$HOME/$CONFIG_FILE" && 22 | mv "$HOME/$CONFIG_FILE" "$HOME/$CONFIG_FILE.uninstall" && 23 | echo -e "\033[0;32mMoved your $HOME/$CONFIG_FILE to $HOME/$CONFIG_FILE.uninstall.\033[0m" 24 | else 25 | test -w "$HOME/$BACKUP_FILE" && 26 | cp -a "$HOME/$BACKUP_FILE" "$HOME/$CONFIG_FILE" && 27 | rm "$HOME/$BACKUP_FILE" && 28 | echo -e "\033[0;32mYour original $CONFIG_FILE has been restored.\033[0m" 29 | fi 30 | 31 | echo "" 32 | echo -e "\033[0;32mUninstallation finished successfully! Sorry to see you go!\033[0m" 33 | echo "" 34 | echo "Final steps to complete the uninstallation:" 35 | echo " -> Remove the $BASH_IT folder" 36 | echo " -> Open a new shell/tab/terminal" 37 | -------------------------------------------------------------------------------- /completion/available/projects.completion.bash: -------------------------------------------------------------------------------- 1 | _pj() { 2 | [ -z "$PROJECT_PATHS" ] && return 3 | shift 4 | [ "$1" == "open" ] && shift 5 | 6 | local cur prev words cword 7 | _init_completion || return 8 | 9 | local IFS=$'\n' i j k 10 | 11 | compopt -o filenames 12 | 13 | local -r mark_dirs=$(_rl_enabled mark-directories && echo y) 14 | local -r mark_symdirs=$(_rl_enabled mark-symlinked-directories && echo y) 15 | 16 | for i in ${PROJECT_PATHS//:/$'\n'}; do 17 | # create an array of matched subdirs 18 | k="${#COMPREPLY[@]}" 19 | for j in $( compgen -d $i/$cur ); do 20 | if [[ ( $mark_symdirs && -h $j || $mark_dirs && ! -h $j ) && ! -d ${j#$i/} ]]; then 21 | j+="/" 22 | fi 23 | COMPREPLY[k++]=${j#$i/} 24 | done 25 | done 26 | 27 | if [[ ${#COMPREPLY[@]} -eq 1 ]]; then 28 | i=${COMPREPLY[0]} 29 | if [[ "$i" == "$cur" && $i != "*/" ]]; then 30 | COMPREPLY[0]="${i}/" 31 | fi 32 | fi 33 | 34 | return 0 35 | } 36 | 37 | complete -F _pj -o nospace pj 38 | 39 | -------------------------------------------------------------------------------- /completion/available/todo.completion.bash: -------------------------------------------------------------------------------- 1 | _todo() 2 | { 3 | local cur prev opts 4 | COMPREPLY=() 5 | cur="${COMP_WORDS[COMP_CWORD]}" 6 | prev="${COMP_WORDS[COMP_CWORD-1]}" 7 | 8 | COMMANDS="add a addto addm append app archive command del \ 9 | rm depri dp do help list ls listall lsa listcon \ 10 | lsc listfile lf listpri lsp listproj lsproj move \ 11 | mv prepend prep pri p replace report" 12 | 13 | # Add custom commands from add-ons, if installed. 14 | COMMANDS="$COMMANDS $('ls' ${TODO_ACTIONS_DIR:-"$HOME/.todo.actions.d"}/ 2>/dev/null)" 15 | 16 | OPTS="-@ -@@ -+ -++ -d -f -h -p -P -PP -a -n -t -v -vv -V -x" 17 | 18 | if [ $COMP_CWORD -eq 1 ]; then 19 | completions="$COMMANDS $OPTS" 20 | else 21 | case "${prev}" in 22 | -*) completions="$COMMANDS $OPTS";; 23 | *) return 0;; 24 | esac 25 | fi 26 | 27 | COMPREPLY=( $( compgen -W "$completions" -- $cur )) 28 | return 0 29 | } 30 | 31 | complete -F _todo todo.sh 32 | # If you define an alias (e.g. "t") to todo.sh, you need to explicitly enable 33 | # completion for it, too: 34 | complete -F _todo t 35 | -------------------------------------------------------------------------------- /plugins/available/gif.plugin.bash: -------------------------------------------------------------------------------- 1 | cite about-plugin 2 | about-plugin 'gif helper functions' 3 | 4 | # From https://gist.github.com/SlexAxton/4989674#comment-1199058 5 | # Requirements (Mac OS X using Homebrew): brew install ffmpeg gifsicle imagemagick 6 | function gifify { 7 | about 'Converts a .mov file into an into an animated GIF.' 8 | group 'gif' 9 | param '1: MOV file name' 10 | param '2: max width in pixels (optional)' 11 | example '$ gifify foo.mov' 12 | example '$ gifify foo.mov 600' 13 | 14 | if [ -z "$1" ]; then 15 | echo "$(tput setaf 1)No input file given. Example: gifify example.mov [max width (pixels)]$(tput sgr 0)" 16 | return 1 17 | fi 18 | 19 | output_file="${1%.*}.gif" 20 | 21 | echo "$(tput setaf 2)Creating $output_file...$(tput sgr 0)" 22 | 23 | if [ ! -z "$2" ]; then 24 | maxsize="-vf scale=$2:-1" 25 | else 26 | maxsize="" 27 | fi 28 | 29 | ffmpeg -loglevel panic -i $1 $maxsize -r 10 -vcodec png gifify-tmp-%05d.png 30 | convert +dither -layers Optimize gifify-tmp-*.png GIF:- | gifsicle --no-warnings --colors 256 --delay=10 --loop --optimize=3 --multifile - > $output_file 31 | rm gifify-tmp-*.png 32 | 33 | echo "$(tput setaf 2)Done.$(tput sgr 0)" 34 | } 35 | -------------------------------------------------------------------------------- /themes/tonka/tonka.theme.bash: -------------------------------------------------------------------------------- 1 | prompt_setter() { 2 | 3 | # Named "Tonka" because of the colour scheme 4 | local WHITE="\[\033[1;37m\]" 5 | local LIGHT_BLUE="\[\033[1;34m\]" 6 | local YELLOW="\[\033[1;33m\]" 7 | local NO_COLOUR="\[\033[0m\]" 8 | 9 | case $TERM in 10 | xterm*|rxvt*) 11 | TITLEBAR='\[\033]0;\u@\h:\w\007\]' 12 | ;; 13 | *) 14 | TITLEBAR="" 15 | ;; 16 | esac 17 | 18 | PS1="$TITLEBAR\ 19 | $YELLOW-$LIGHT_BLUE-(\ 20 | $YELLOW\u$LIGHT_BLUE@$YELLOW\h\ 21 | $LIGHT_BLUE)-(\ 22 | $YELLOW\$PWD\ 23 | $LIGHT_BLUE)-$YELLOW-\ 24 | \n\ 25 | $YELLOW-$LIGHT_BLUE-(\ 26 | $YELLOW\$(date +%H%M)$LIGHT_BLUE:$YELLOW\$(date \"+%a,%d %b %y\")\ 27 | $LIGHT_BLUE:$WHITE\\$ $LIGHT_BLUE)-$YELLOW-$NO_COLOUR " 28 | 29 | PS2="$LIGHT_BLUE-$YELLOW-$YELLOW-$NO_COLOUR " 30 | 31 | } 32 | 33 | PROMPT_COMMAND=prompt_setter 34 | 35 | export PS3=">> " 36 | 37 | LS_COLORS='no=00:fi=00:di=00;33:ln=01;36:pi=40;34:so=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:*.deb=01;31:*.jpg=01;35:*.gif=01;35:*.bmp=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.mpg=01;37:*.avi=01;37:*.gl=01;37:*.dl=01;37:'; 38 | 39 | export LS_COLORS 40 | -------------------------------------------------------------------------------- /completion/available/gem.completion.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Completion for gem 3 | 4 | _installcomp() { 5 | if [ -z "$REMOTE_GEMS" ] 6 | then 7 | REMOTE_GEMS=( $(gem list --remote --no-versions | tr '\n' ' ') ) 8 | fi 9 | 10 | local cur=${COMP_WORDS[COMP_CWORD]} 11 | COMPREPLY=( $(compgen -W "${REMOTE_GEMS[*]}" -- $cur) ) 12 | } 13 | 14 | _uninstallcomp() { 15 | if [ -z "$LOCAL_GEMS" ] 16 | then 17 | LOCAL_GEMS=( $(gem list --no-versions | sed 's/\*\*\* LOCAL GEMS \*\*\*//' | tr '\n' ' ') ) 18 | fi 19 | 20 | local cur=${COMP_WORDS[COMP_CWORD]} 21 | COMPREPLY=( $(compgen -W "${LOCAL_GEMS[*]}" -- $cur) ) 22 | } 23 | 24 | _gem() { 25 | local cur=${COMP_WORDS[COMP_CWORD]} 26 | local prev=${COMP_WORDS[COMP_CWORD-1]} 27 | case $prev in 28 | install) 29 | _installcomp 30 | return 0 31 | ;; 32 | uninstall) 33 | _uninstallcomp 34 | return 0 35 | ;; 36 | esac 37 | local commands=(build cert check cleanup contents dependency environment fetch generate_index help install list lock outdated owner pristine push query rdoc search server sources specification stale uninstall unpack update which) 38 | COMPREPLY=( $(compgen -W "${commands[*]}" -- $cur) ) 39 | } 40 | 41 | complete -F _gem gem 42 | -------------------------------------------------------------------------------- /aliases/available/jitsu.aliases.bash: -------------------------------------------------------------------------------- 1 | cite 'about-alias' 2 | about-alias 'jitsu task abbreviations' 3 | 4 | # jitsu 5 | alias j='jitsu' 6 | alias jl='jitsu login' 7 | alias jo='jitsu logout' 8 | 9 | # deploy and update 10 | alias jd='jitsu apps deploy' 11 | alias ju='jitsu apps update' 12 | 13 | # new and start, restart, stop 14 | alias jn='jitsu apps create' 15 | alias js='jitsu apps start' 16 | alias jr='jitsu apps restart' 17 | alias jx='jitsu apps stop' 18 | 19 | # logs 20 | alias jll='jitsu logs' 21 | alias jlog='jitsu logs' 22 | alias jlogs='jitsu logs' 23 | 24 | # env 25 | alias je='jitsu env' 26 | alias jel='jitsu env list' 27 | alias jes='jitsu env set' 28 | alias jeg='jitsu env get' 29 | alias jed='jitsu env delete' 30 | alias jec='jitsu env clear' 31 | alias jesv='jitsu env save' 32 | alias jeld='jitsu env load' 33 | 34 | # configuration 35 | alias jc='jitsu conf' 36 | alias jcl='jitsu config list' 37 | alias jcs='jitsu config set' 38 | alias jcg='jitsu config get' 39 | alias jcd='jitsu config delete' 40 | 41 | # list and install, view 42 | alias jls='jitsu list' 43 | alias jin='jitsu install' 44 | alias jv='jitsu apps view' 45 | 46 | # Database, Snapshots and Tokens 47 | alias jdb='jitsu databases' 48 | alias jss='jitsu snapshots' 49 | alias jto='jitsu tokens' 50 | -------------------------------------------------------------------------------- /themes/modern/modern.theme.bash: -------------------------------------------------------------------------------- 1 | SCM_THEME_PROMPT_PREFIX="" 2 | SCM_THEME_PROMPT_SUFFIX="" 3 | 4 | SCM_THEME_PROMPT_DIRTY=" ${bold_red}✗${normal}" 5 | SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓${normal}" 6 | SCM_GIT_CHAR="${bold_green}±${normal}" 7 | SCM_SVN_CHAR="${bold_cyan}⑆${normal}" 8 | SCM_HG_CHAR="${bold_red}☿${normal}" 9 | 10 | case $TERM in 11 | xterm*) 12 | TITLEBAR="\[\033]0;\w\007\]" 13 | ;; 14 | *) 15 | TITLEBAR="" 16 | ;; 17 | esac 18 | 19 | PS3=">> " 20 | 21 | is_vim_shell() { 22 | if [ ! -z "$VIMRUNTIME" ] 23 | then 24 | echo "[${cyan}vim shell${normal}]" 25 | fi 26 | } 27 | 28 | modern_scm_prompt() { 29 | CHAR=$(scm_char) 30 | if [ $CHAR = $SCM_NONE_CHAR ] 31 | then 32 | return 33 | else 34 | echo "[$(scm_char)][$(scm_prompt_info)]" 35 | fi 36 | } 37 | 38 | prompt() { 39 | if [ $? -ne 0 ] 40 | then 41 | # Yes, the indenting on these is weird, but it has to be like 42 | # this otherwise it won't display properly. 43 | 44 | PS1="${TITLEBAR}${bold_red}┌─${reset_color}$(modern_scm_prompt)[${cyan}\W${normal}][$(battery_charge)]$(is_vim_shell) 45 | ${bold_red}└─▪${normal} " 46 | else 47 | PS1="${TITLEBAR}┌─$(modern_scm_prompt)[${cyan}\W${normal}][$(battery_charge)]$(is_vim_shell) 48 | └─▪ " 49 | fi 50 | } 51 | 52 | PS2="└─▪ " 53 | 54 | 55 | 56 | PROMPT_COMMAND=prompt 57 | -------------------------------------------------------------------------------- /themes/axin/axin.theme.bash: -------------------------------------------------------------------------------- 1 | # Axin Bash Prompt, inspired by theme "Sexy" and "Bobby" 2 | # thanks to them 3 | 4 | if [[ $COLORTERM = gnome-* && $TERM = xterm ]] && infocmp gnome-256color >/dev/null 2>&1; then export TERM=gnome-256color 5 | elif [[ $TERM != dumb ]] && infocmp xterm-256color >/dev/null 2>&1; then export TERM=xterm-256color 6 | fi 7 | 8 | if tput setaf 1 &> /dev/null; then 9 | if [[ $(tput colors) -ge 256 ]] 2>/dev/null; then 10 | MAGENTA=$(tput setaf 9) 11 | ORANGE=$(tput setaf 172) 12 | GREEN=$(tput setaf 190) 13 | PURPLE=$(tput setaf 141) 14 | WHITE=$(tput setaf 0) 15 | else 16 | MAGENTA=$(tput setaf 5) 17 | ORANGE=$(tput setaf 4) 18 | GREEN=$(tput setaf 2) 19 | PURPLE=$(tput setaf 1) 20 | WHITE=$(tput setaf 7) 21 | fi 22 | BOLD=$(tput bold) 23 | RESET=$(tput sgr0) 24 | else 25 | MAGENTA="\033[1;31m" 26 | ORANGE="\033[1;33m" 27 | GREEN="\033[1;32m" 28 | PURPLE="\033[1;35m" 29 | WHITE="\033[1;37m" 30 | BOLD="" 31 | RESET="\033[m" 32 | fi 33 | 34 | function prompt_command() { 35 | PS1="\[${BOLD}${MAGENTA}\]\u \[$WHITE\]@ \[$ORANGE\]\h \[$WHITE\]in \[$GREEN\]\w\[$WHITE\]\[$SCM_THEME_PROMPT_PREFIX\]${white}\t \[$PURPLE\]\$(scm_prompt_info) \n\$ \[$RESET\]" 36 | } 37 | 38 | PROMPT_COMMAND=prompt_command 39 | -------------------------------------------------------------------------------- /aliases/available/docker.aliases.bash: -------------------------------------------------------------------------------- 1 | cite 'about-alias' 2 | about-alias 'docker abbreviations' 3 | 4 | alias dklc='docker ps -l' # List last Docker container 5 | alias dklcid='docker ps -l -q' # List last Docker container ID 6 | alias dklcip='docker inspect -f "{{.NetworkSettings.IPAddress}}" $(docker ps -l -q)' # Get IP of last Docker container 7 | alias dkps='docker ps' # List running Docker containers 8 | alias dkpsa='docker ps -a' # List all Docker containers 9 | alias dki='docker images' # List Docker images 10 | alias dkrmac='docker rm $(docker ps -a -q)' # Delete all Docker containers 11 | alias dkrmlc='docker-remove-most-recent-container' # Delete most recent (i.e., last) Docker container 12 | alias dkrmui='docker images -q -f dangling=true |xargs -r docker rmi' # Delete all untagged Docker images 13 | alias dkrmli='docker-remove-most-recent-image' # Delete most recent (i.e., last) Docker image 14 | alias dkrmi='docker-remove-images' # Delete images for supplied IDs or all if no IDs are passed as arguments 15 | alias dkideps='docker-image-dependencies' # Output a graph of image dependencies using Graphiz 16 | alias dkre='docker-runtime-environment' # List environmental variables of the supplied image ID 17 | alias dkelc='docker exec -it `dklcid` bash' # Enter last container (works with Docker 1.3 and above) 18 | -------------------------------------------------------------------------------- /plugins/available/javascript.plugin.bash: -------------------------------------------------------------------------------- 1 | # The install directory is hard-coded. TODO: allow the directory to be specified on the command line. 2 | 3 | cite about-plugin 4 | about-plugin 'download jquery files into current project' 5 | 6 | [[ -z "$JQUERY_VERSION_NUMBER" ]] && JQUERY_VERSION_NUMBER="1.6.1" 7 | [[ -z "$JQUERY_UI_VERSION_NUMBER" ]] && JQUERY_UI_VERSION_NUMBER="1.8.13" 8 | 9 | function rails_jquery { 10 | about 'download rails.js into public/javascripts' 11 | group 'javascript' 12 | 13 | curl -o public/javascripts/rails.js http://github.com/rails/jquery-ujs/raw/master/src/rails.js 14 | } 15 | 16 | function jquery_install { 17 | about 'download jquery.js into public/javascripts' 18 | group 'javascript' 19 | 20 | if [ -z "$1" ] 21 | then 22 | version=$JQUERY_VERSION_NUMBER 23 | else 24 | version="$1" 25 | fi 26 | curl -o public/javascripts/jquery.js "http://ajax.googleapis.com/ajax/libs/jquery/$version/jquery.min.js" 27 | } 28 | 29 | function jquery_ui_install { 30 | about 'download jquery_us.js into public/javascripts' 31 | group 'javascript' 32 | 33 | if [ -z "$1" ] 34 | then 35 | version=$JQUERY_UI_VERSION_NUMBER 36 | else 37 | version="$1" 38 | fi 39 | 40 | curl -o public/javascripts/jquery_ui.js "http://ajax.googleapis.com/ajax/libs/jqueryui/$version/jquery-ui.min.js" 41 | } 42 | -------------------------------------------------------------------------------- /themes/clean/clean.theme.bash: -------------------------------------------------------------------------------- 1 | # git theming 2 | ZSH_THEME_GIT_PROMPT_PREFIX="${bold_blue}(${yellow}%B" 3 | ZSH_THEME_GIT_PROMPT_SUFFIX="%b${bold_blue})${reset_color} " 4 | ZSH_THEME_GIT_PROMPT_CLEAN="" 5 | ZSH_THEME_GIT_PROMPT_DIRTY="${bold_red}✗" 6 | 7 | 8 | # LS colors, made with http://geoff.greer.fm/lscolors/ 9 | export LSCOLORS="Gxfxcxdxbxegedabagacad" 10 | export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:' 11 | 12 | function prompt_command() { 13 | 14 | if [ "$(whoami)" = root ]; then no_color=$red; else no_color=$white; fi 15 | 16 | PS1="${no_color}\u${reset_color}:${blue}\W/${reset_color} \[\$(scm_prompt_info)\]$ " 17 | RPROMPT='[\t]' 18 | } 19 | 20 | PROMPT_COMMAND=prompt_command; 21 | -------------------------------------------------------------------------------- /themes/modern-t/modern-t.theme.bash: -------------------------------------------------------------------------------- 1 | SCM_THEME_PROMPT_PREFIX="" 2 | SCM_THEME_PROMPT_SUFFIX="" 3 | 4 | SCM_THEME_PROMPT_DIRTY=" ${bold_red}✗${normal}" 5 | SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓${normal}" 6 | SCM_GIT_CHAR="${bold_green}±${normal}" 7 | SCM_SVN_CHAR="${bold_cyan}⑆${normal}" 8 | SCM_HG_CHAR="${bold_red}☿${normal}" 9 | 10 | case $TERM in 11 | xterm*) 12 | TITLEBAR="\[\033]0;\w\007\]" 13 | ;; 14 | *) 15 | TITLEBAR="" 16 | ;; 17 | esac 18 | 19 | PS3=">> " 20 | 21 | is_vim_shell() { 22 | if [ ! -z "$VIMRUNTIME" ] 23 | then 24 | echo "[${cyan}vim shell${normal}]" 25 | fi 26 | } 27 | 28 | modern_scm_prompt() { 29 | CHAR=$(scm_char) 30 | if [ $CHAR = $SCM_NONE_CHAR ] 31 | then 32 | return 33 | else 34 | echo "[$(scm_char)][$(scm_prompt_info)]" 35 | fi 36 | } 37 | 38 | prompt() { 39 | if [ $? -ne 0 ] 40 | then 41 | # Yes, the indenting on these is weird, but it has to be like 42 | # this otherwise it won't display properly. 43 | 44 | PS1="${TITLEBAR}${bold_red}┌─[${cyan}$(t | wc -l | sed -e's/ *//')${reset_color}]${reset_color}$(modern_scm_prompt)[${cyan}\W${normal}]$(is_vim_shell) 45 | ${bold_red}└─▪${normal} " 46 | else 47 | PS1="${TITLEBAR}┌─[${cyan}$(t | wc -l | sed -e's/ *//')${reset_color}]$(modern_scm_prompt)[${cyan}\W${normal}]$(is_vim_shell) 48 | └─▪ " 49 | fi 50 | } 51 | 52 | PS2="└─▪ " 53 | 54 | 55 | 56 | PROMPT_COMMAND=prompt 57 | -------------------------------------------------------------------------------- /completion/available/ssh.completion.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Bash completion support for ssh. 3 | 4 | export COMP_WORDBREAKS=${COMP_WORDBREAKS/\:/} 5 | 6 | _sshcomplete() { 7 | local CURRENT_PROMPT="${COMP_WORDS[COMP_CWORD]}" 8 | if [[ ${CURRENT_PROMPT} == *@* ]] ; then 9 | local OPTIONS="-P ${CURRENT_PROMPT/@*/}@ -- ${CURRENT_PROMPT/*@/}" 10 | else 11 | local OPTIONS=" -- ${CURRENT_PROMPT}" 12 | fi 13 | 14 | 15 | # parse all defined hosts from .ssh/config 16 | if [ -r "$HOME/.ssh/config" ]; then 17 | COMPREPLY=($(compgen -W "$(grep ^Host "$HOME/.ssh/config" | awk '{print $2}' )" ${OPTIONS}) ) 18 | fi 19 | 20 | # parse all hosts found in .ssh/known_hosts 21 | if [ -r "$HOME/.ssh/known_hosts" ]; then 22 | if grep -v -q -e '^ ssh-rsa' "$HOME/.ssh/known_hosts" ; then 23 | COMPREPLY=( ${COMPREPLY[@]} $(compgen -W "$( awk '{print $1}' "$HOME/.ssh/known_hosts" | grep -v ^\| | cut -d, -f 1 | sed -e 's/\[//g' | sed -e 's/\]//g' | cut -d: -f1 | grep -v ssh-rsa)" ${OPTIONS}) ) 24 | fi 25 | fi 26 | 27 | # parse hosts defined in /etc/hosts 28 | if [ -r /etc/hosts ]; then 29 | COMPREPLY=( ${COMPREPLY[@]} $(compgen -W "$( grep -v '^[[:space:]]*$' /etc/hosts | grep -v '^#' | awk '{print $2}' )" ${OPTIONS}) ) 30 | fi 31 | 32 | return 0 33 | } 34 | 35 | complete -o default -o nospace -F _sshcomplete ssh 36 | 37 | -------------------------------------------------------------------------------- /themes/mbriggs/mbriggs.theme.bash: -------------------------------------------------------------------------------- 1 | # ------------------------------------------------------------------# 2 | # FILE: mbriggs.zsh-theme # 3 | # BY: Matt Briggs (matt@mattbriggs.net) # 4 | # BASED ON: smt by Stephen Tudor (stephen@tudorstudio.com) # 5 | # ------------------------------------------------------------------# 6 | 7 | SCM_THEME_PROMPT_DIRTY="${red}⚡${reset_color}" 8 | SCM_THEME_PROMPT_AHEAD="${red}!${reset_color}" 9 | SCM_THEME_PROMPT_CLEAN="${green}✓${reset_color}" 10 | SCM_THEME_PROMPT_PREFIX=" " 11 | SCM_THEME_PROMPT_SUFFIX="" 12 | GIT_SHA_PREFIX=" ${yellow}" 13 | GIT_SHA_SUFFIX="${reset_color}" 14 | 15 | function git_short_sha() { 16 | SHA=$(git rev-parse --short HEAD 2> /dev/null) && echo "$GIT_SHA_PREFIX$SHA$GIT_SHA_SUFFIX" 17 | } 18 | 19 | function prompt() { 20 | local return_status="" 21 | local ruby="${red}$(ruby_version_prompt)${reset_color}" 22 | local user_host="${green}\h${reset_color}" 23 | local current_path="\w" 24 | local n_commands="\!" 25 | local git_branch="$(git_short_sha)$(scm_prompt_info)" 26 | local prompt_symbol='λ' 27 | local open='(' 28 | local close=')' 29 | local prompt_char=' \$ ' 30 | 31 | PS1="\n${n_commands} ${user_host} ${prompt_symbol} ${ruby} ${open}${current_path}${git_branch}${close}${return_status}\n${prompt_char}" 32 | } 33 | 34 | PROMPT_COMMAND=prompt -------------------------------------------------------------------------------- /test/plugins/base.plugin.bats: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bats 2 | 3 | load ../test_helper 4 | load ../../lib/composure 5 | load ../../plugins/available/base.plugin 6 | 7 | @test 'plugins base: ips()' { 8 | if [[ $CI ]]; then 9 | skip 'ifconfig probably requires sudo on TravisCI' 10 | fi 11 | 12 | declare -r localhost='127.0.0.1' 13 | run ips 14 | assert_success 15 | assert_line $localhost 16 | } 17 | 18 | @test 'plugins base: myip()' { 19 | if [[ ! $SLOW_TESTS ]]; then 20 | skip 'myip is slow - run only with SLOW_TESTS=true' 21 | fi 22 | 23 | run myip 24 | assert_success 25 | declare -r mask_ip=$(echo $output | tr -s '[0-9]' '?') 26 | [[ $mask_ip == 'Your public IP is: ?.?.?.?' ]] 27 | } 28 | 29 | @test 'plugins base: pickfrom()' { 30 | stub_file="${BASH_IT_ROOT}/stub_file" 31 | printf "l1\nl2\nl3" > $stub_file 32 | run pickfrom $stub_file 33 | assert_success 34 | [[ $output == l? ]] 35 | } 36 | 37 | @test 'plugins base: mkcd()' { 38 | cd "${BASH_IT_ROOT}" 39 | run mkcd -dir_with_dash 40 | assert_success 41 | } 42 | 43 | @test 'plugins base: lsgrep()' { 44 | for i in 1 2 3; do mkdir -p "${BASH_IT_TEST_DIR}/${i}"; done 45 | cd $BASH_IT_TEST_DIR 46 | run lsgrep 2 47 | assert_success 48 | assert_equal 2 $output 49 | } 50 | 51 | @test 'plugins base: buf()' { 52 | declare -r file="${BASH_IT_ROOT}/file" 53 | touch $file 54 | run buf $file 55 | [[ -e ${file}_$(date +%Y%m%d_%H%M%S) ]] 56 | } 57 | -------------------------------------------------------------------------------- /themes/nwinkler/nwinkler.theme.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Two line prompt showing the following information: 4 | # (time) SCM [username@hostname] pwd (SCM branch SCM status) 5 | # → 6 | # 7 | # Example: 8 | # (14:00:26) ± [foo@bar] ~/.bash_it (master ✓) 9 | # → 10 | # 11 | # The arrow on the second line is showing the exit status of the last command: 12 | # * Green: 0 exit status 13 | # * Red: non-zero exit status 14 | # 15 | # The exit code functionality currently doesn't work if you are using the 'fasd' plugin, 16 | # since 'fasd' is messing with the $PROMPT_COMMAND 17 | 18 | 19 | PROMPT_END_CLEAN="${green}→${reset_color}" 20 | PROMPT_END_DIRTY="${red}→${reset_color}" 21 | 22 | function prompt_end() { 23 | echo -e "$PROMPT_END" 24 | } 25 | 26 | prompt_setter() { 27 | local exit_status=$? 28 | if [[ $exit_status -eq 0 ]]; then PROMPT_END=$PROMPT_END_CLEAN 29 | else PROMPT_END=$PROMPT_END_DIRTY 30 | fi 31 | # Save history 32 | history -a 33 | history -c 34 | history -r 35 | PS1="(\t) $(scm_char) [${blue}\u${reset_color}@${green}\H${reset_color}] ${yellow}\w${reset_color}$(scm_prompt_info) ${reset_color}\n$(prompt_end) " 36 | PS2='> ' 37 | PS4='+ ' 38 | } 39 | 40 | PROMPT_COMMAND=prompt_setter 41 | 42 | SCM_THEME_PROMPT_DIRTY=" ${bold_red}✗${normal}" 43 | SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓${normal}" 44 | SCM_THEME_PROMPT_PREFIX=" (" 45 | SCM_THEME_PROMPT_SUFFIX=")" 46 | RVM_THEME_PROMPT_PREFIX=" (" 47 | RVM_THEME_PROMPT_SUFFIX=")" 48 | -------------------------------------------------------------------------------- /completion/available/drush.completion.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # bash completion support for Drush: 4 | # https://github.com/drush-ops/drush 5 | # 6 | # Originally from: 7 | # http://github.com/drush-ops/drush/blob/master/drush.complete.sh 8 | 9 | # Ensure drush is available. 10 | which drush &> /dev/null || alias drush &> /dev/null || return 11 | 12 | __drush_ps1() { 13 | f="${TMPDIR:-/tmp/}/drush-env/drush-drupal-site-$$" 14 | if [ -f $f ] 15 | then 16 | __DRUPAL_SITE=$(cat "$f") 17 | else 18 | __DRUPAL_SITE="$DRUPAL_SITE" 19 | fi 20 | 21 | [[ -n "$__DRUPAL_SITE" ]] && printf "${1:- (%s)}" "$__DRUPAL_SITE" 22 | } 23 | 24 | # Completion function, uses the "drush complete" command to retrieve 25 | # completions for a specific command line COMP_WORDS. 26 | _drush_completion() { 27 | # Set IFS to newline (locally), since we only use newline separators, and 28 | # need to retain spaces (or not) after completions. 29 | local IFS=$'\n' 30 | # The '< /dev/null' is a work around for a bug in php libedit stdin handling. 31 | # Note that libedit in place of libreadline in some distributions. See: 32 | # https://bugs.launchpad.net/ubuntu/+source/php5/+bug/322214 33 | COMPREPLY=( $(drush --early=includes/complete.inc "${COMP_WORDS[@]}" < /dev/null 2> /dev/null) ) 34 | } 35 | 36 | # Register our completion function. We include common short aliases for Drush. 37 | complete -o bashdefault -o default -o nospace -F _drush_completion d dr drush drush5 drush6 drush6 drush.php 38 | -------------------------------------------------------------------------------- /aliases/available/general.aliases.bash: -------------------------------------------------------------------------------- 1 | cite about-alias 2 | about-alias 'general aliases' 3 | 4 | # List directory contents 5 | alias sl=ls 6 | alias ls='ls -G' # Compact view, show colors 7 | alias la='ls -AF' # Compact view, show hidden 8 | alias ll='ls -al' 9 | alias l='ls -a' 10 | alias l1='ls -1' 11 | 12 | alias _="sudo" 13 | 14 | if [ $(uname) = "Linux" ] 15 | then 16 | alias ls="ls --color=auto" 17 | fi 18 | which gshuf &> /dev/null 19 | if [ $? -eq 0 ] 20 | then 21 | alias shuf=gshuf 22 | fi 23 | 24 | alias c='clear' 25 | alias k='clear' 26 | alias cls='clear' 27 | 28 | alias edit="$EDITOR" 29 | alias pager="$PAGER" 30 | 31 | alias q='exit' 32 | 33 | alias irc="$IRC_CLIENT" 34 | 35 | alias rb='ruby' 36 | 37 | # Pianobar can be found here: http://github.com/PromyLOPh/pianobar/ 38 | 39 | alias piano='pianobar' 40 | 41 | alias ..='cd ..' # Go up one directory 42 | alias ...='cd ../..' # Go up two directories 43 | alias ....='cd ../../..' # Go up three directories 44 | alias -- -='cd -' # Go back 45 | 46 | # Shell History 47 | alias h='history' 48 | 49 | # Tree 50 | if [ ! -x "$(which tree 2>/dev/null)" ] 51 | then 52 | alias tree="find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'" 53 | fi 54 | 55 | # Directory 56 | alias md='mkdir -p' 57 | alias rd='rmdir' 58 | 59 | # Display whatever file is regular file or folder 60 | catt() { 61 | for i in "$@"; do 62 | if [ -d "$i" ]; then 63 | ls "$i" 64 | else 65 | cat "$i" 66 | fi 67 | done 68 | } -------------------------------------------------------------------------------- /completion/available/bundler.completion.bash: -------------------------------------------------------------------------------- 1 | #! bash 2 | # bash completion for the `bundle` command. 3 | # 4 | # Copyright (c) 2011-2013 Daniel Luz . 5 | # Distributed under the MIT license. 6 | # http://mernen.com/projects/completion-ruby 7 | # 8 | # To use, source this file on bash: 9 | # . completion-bundle 10 | 11 | __bundle() { 12 | local cur=$2 13 | local prev=$3 14 | local bundle_command 15 | __bundle_get_command 16 | COMPREPLY=() 17 | 18 | local options 19 | if [[ $cur = -* ]]; then 20 | options="--no-color --verbose" 21 | if [[ -z $bundle_command ]]; then 22 | options="$options --version --help" 23 | fi 24 | else 25 | if [[ -z $bundle_command || $bundle_command = help ]]; then 26 | options="help install update package exec config check list show 27 | console open viz init gem" 28 | fi 29 | fi 30 | COMPREPLY=($(compgen -W "$options" -- "$cur")) 31 | } 32 | 33 | __bundle_get_command() { 34 | local i 35 | for ((i=1; i < $COMP_CWORD; ++i)); do 36 | local arg=${COMP_WORDS[$i]} 37 | 38 | case $arg in 39 | [^-]*) 40 | bundle_command=$arg 41 | return;; 42 | --version) 43 | # command-killer 44 | bundle_command=- 45 | return;; 46 | --help) 47 | bundle_command=help 48 | return;; 49 | esac 50 | done 51 | } 52 | 53 | 54 | complete -F __bundle -o bashdefault -o default bundle 55 | # vim: ai ft=sh sw=4 sts=2 et 56 | -------------------------------------------------------------------------------- /completion/available/maven.completion.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Bash Maven completion 3 | 4 | _mvn() 5 | { 6 | local cmds cur colonprefixes 7 | cmds="clean validate compile test package integration-test \ 8 | verify install deploy test-compile site generate-sources \ 9 | process-sources generate-resources process-resources \ 10 | eclipse:eclipse eclipse:add-maven-repo eclipse:clean \ 11 | idea:idea -DartifactId= -DgroupId= -Dmaven.test.skip=true \ 12 | -Declipse.workspace= -DarchetypeArtifactId= \ 13 | netbeans-freeform:generate-netbeans-project \ 14 | tomcat:run tomcat:run-war tomcat:deploy jboss-as:deploy \ 15 | versions:display-dependency-updates \ 16 | versions:display-plugin-updates dependency:analyze \ 17 | dependency:analyze-dep-mgt dependency:resolve \ 18 | dependency:sources dependency:tree release:prepare \ 19 | release:rollback release:perform --batch-mode" 20 | 21 | COMPREPLY=() 22 | cur=${COMP_WORDS[COMP_CWORD]} 23 | # Work-around bash_completion issue where bash interprets a colon 24 | # as a separator. 25 | # Work-around borrowed from the darcs work-around for the same 26 | # issue. 27 | colonprefixes=${cur%"${cur##*:}"} 28 | COMPREPLY=( $(compgen -W '$cmds' -- $cur)) 29 | local i=${#COMPREPLY[*]} 30 | while [ $((--i)) -ge 0 ]; do 31 | COMPREPLY[$i]=${COMPREPLY[$i]#"$colonprefixes"} 32 | done 33 | 34 | return 0 35 | } && 36 | complete -F _mvn mvn -------------------------------------------------------------------------------- /plugins/available/nginx.plugin.bash: -------------------------------------------------------------------------------- 1 | cite about-plugin 2 | about-plugin 'manage your nginx service' 3 | 4 | export NGINX_PATH='/opt/nginx' 5 | pathmunge $NGINX_PATH/sbin after 6 | 7 | function nginx_reload() { 8 | about 'reload your nginx config' 9 | group 'nginx' 10 | 11 | FILE="${NGINX_PATH}/logs/nginx.pid" 12 | if [ -e $FILE ]; then 13 | echo "Reloading NGINX..." 14 | PID=`cat $NGINX_PATH/logs/nginx.pid` 15 | sudo kill -HUP $PID 16 | else 17 | echo "Nginx pid file not found" 18 | return 0 19 | fi 20 | } 21 | 22 | function nginx_stop() { 23 | about 'stop nginx' 24 | group 'nginx' 25 | 26 | FILE="${NGINX_PATH}/logs/nginx.pid" 27 | if [ -e $FILE ]; then 28 | echo "Stopping NGINX..." 29 | PID=`cat $NGINX_PATH/logs/nginx.pid` 30 | sudo kill -INT $PID 31 | else 32 | echo "Nginx pid file not found" 33 | return 0 34 | fi 35 | } 36 | 37 | function nginx_start() { 38 | about 'start nginx' 39 | group 'nginx' 40 | 41 | FILE="${NGINX_PATH}/sbin/nginx" 42 | if [ -e $FILE ]; then 43 | echo "Starting NGINX..." 44 | sudo $NGINX_PATH/sbin/nginx 45 | else 46 | echo "Couldn't start nginx" 47 | fi 48 | } 49 | 50 | function nginx_restart() { 51 | about 'restart nginx' 52 | group 'nginx' 53 | 54 | FILE="${NGINX_PATH}/logs/nginx.pid" 55 | if [ -e $FILE ]; then 56 | echo "Stopping NGINX..." 57 | PID=`cat $NGINX_PATH/logs/nginx.pid` 58 | sudo kill -INT $PID 59 | sleep 1 60 | echo "Starting NGINX..." 61 | sudo $NGINX_PATH/sbin/nginx 62 | else 63 | echo "Nginx pid file not found" 64 | return 0 65 | fi 66 | } 67 | -------------------------------------------------------------------------------- /themes/sexy/sexy.theme.bash: -------------------------------------------------------------------------------- 1 | # Sexy Bash Prompt, inspired by "Extravagant Zsh Prompt" 2 | # Screenshot: http://cloud.gf3.ca/M5rG 3 | # A big thanks to \amethyst on Freenode 4 | 5 | if [[ $COLORTERM = gnome-* && $TERM = xterm ]] && infocmp gnome-256color >/dev/null 2>&1; then export TERM=gnome-256color 6 | elif [[ $TERM != dumb ]] && infocmp xterm-256color >/dev/null 2>&1; then export TERM=xterm-256color 7 | fi 8 | 9 | if tput setaf 1 &> /dev/null; then 10 | if [[ $(tput colors) -ge 256 ]] 2>/dev/null; then 11 | MAGENTA=$(tput setaf 9) 12 | ORANGE=$(tput setaf 172) 13 | GREEN=$(tput setaf 190) 14 | PURPLE=$(tput setaf 141) 15 | WHITE=$(tput setaf 0) 16 | else 17 | MAGENTA=$(tput setaf 5) 18 | ORANGE=$(tput setaf 4) 19 | GREEN=$(tput setaf 2) 20 | PURPLE=$(tput setaf 1) 21 | WHITE=$(tput setaf 7) 22 | fi 23 | BOLD=$(tput bold) 24 | RESET=$(tput sgr0) 25 | else 26 | MAGENTA="\033[1;31m" 27 | ORANGE="\033[1;33m" 28 | GREEN="\033[1;32m" 29 | PURPLE="\033[1;35m" 30 | WHITE="\033[1;37m" 31 | BOLD="" 32 | RESET="\033[m" 33 | fi 34 | 35 | parse_git_dirty () { 36 | [[ $(git status 2> /dev/null | tail -n1 | cut -c 1-17) != "nothing to commit" ]] && echo "*" 37 | } 38 | parse_git_branch () { 39 | git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1$(parse_git_dirty)/" 40 | } 41 | 42 | function prompt_command() { 43 | 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\]" 44 | } 45 | 46 | PROMPT_COMMAND=prompt_command 47 | -------------------------------------------------------------------------------- /themes/zitron/zitron.theme.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # zitron theme by Florian Baumann 3 | 4 | ## git-theme 5 | # feel free to change git chars. 6 | GIT_THEME_PROMPT_DIRTY="${bold_yellow}*${normal}" 7 | GIT_THEME_PROMPT_CLEAN="" 8 | GIT_THEME_PROMPT_PREFIX="" 9 | GIT_THEME_PROMPT_SUFFIX="" 10 | 11 | ## ls colors 12 | # thanks a lot to http://geoff.greer.fm/lscolors/ 13 | export LSCOLORS="Gxfxcxdxbxegedabagacad" 14 | export LS_COLORS="no=00:fi=00:di=01;33: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:*.svgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=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;34:*.svg=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:" 15 | 16 | function prompt_command() { 17 | ## look-a-like 18 | # user:host:pwd git-branch(*)$ 19 | # for example: 20 | # noqqe:deathstar:themes master*$ 21 | PS1="${no_color}\u:$(hostname)${normal}:${bold_yellow}\W/${normal} $(git_prompt_info)${reset_color}$ " 22 | } 23 | 24 | PROMPT_COMMAND=prompt_command; 25 | -------------------------------------------------------------------------------- /completion/available/grunt.completion.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # grunt-cli 4 | # http://gruntjs.com/ 5 | # 6 | # Copyright (c) 2012 Tyler Kellen, contributors 7 | # Licensed under the MIT license. 8 | # https://github.com/gruntjs/grunt/blob/master/LICENSE-MIT 9 | 10 | # Usage: 11 | # 12 | # To enable bash completion for grunt, add the following line (minus the 13 | # leading #, which is the bash comment character) to your ~/.bashrc file: 14 | # 15 | # eval "$(grunt --completion=bash)" 16 | 17 | # Search the current directory and all parent directories for a gruntfile. 18 | function _grunt_gruntfile() { 19 | local curpath="$PWD" 20 | while [[ "$curpath" ]]; do 21 | for gruntfile in "$curpath/"{G,g}runtfile.{js,coffee}; do 22 | if [[ -e "$gruntfile" ]]; then 23 | echo "$gruntfile" 24 | return 25 | fi 26 | done 27 | curpath="${curpath%/*}" 28 | done 29 | return 1 30 | } 31 | 32 | # Enable bash autocompletion. 33 | function _grunt_completions() { 34 | # The currently-being-completed word. 35 | local cur="${COMP_WORDS[COMP_CWORD]}" 36 | # The current gruntfile, if it exists. 37 | local gruntfile="$(_grunt_gruntfile)" 38 | # The current grunt version, available tasks, options, etc. 39 | local gruntinfo="$(grunt --version --verbose 2>/dev/null)" 40 | # Options and tasks. 41 | local opts="$(echo "$gruntinfo" | awk '/Available options: / {$1=$2=""; print $0}')" 42 | local compls="$(echo "$gruntinfo" | awk '/Available tasks: / {$1=$2=""; print $0}')" 43 | # Only add -- or - options if the user has started typing - 44 | [[ "$cur" == -* ]] && compls="$compls $opts" 45 | # Tell complete what stuff to show. 46 | COMPREPLY=($(compgen -W "$compls" -- "$cur")) 47 | } 48 | 49 | complete -o default -F _grunt_completions grunt 50 | -------------------------------------------------------------------------------- /plugins/available/browser.plugin.bash: -------------------------------------------------------------------------------- 1 | # based on https://gist.github.com/318247 2 | 3 | cite about-plugin 4 | about-plugin 'render commandline output in your browser' 5 | 6 | function browser() { 7 | about 'pipe html to a browser' 8 | example '$ echo "

hi mom!

" | browser' 9 | example '$ ron -5 man/rip.5.ron | browser' 10 | group 'browser' 11 | 12 | if [ -t 0 ]; then 13 | if [ -n "$1" ]; then 14 | open $1 15 | else 16 | reference browser 17 | fi 18 | 19 | else 20 | f="/tmp/browser.$RANDOM.html" 21 | cat /dev/stdin > $f 22 | open $f 23 | fi 24 | } 25 | 26 | 27 | function wmate() { 28 | about 'pipe hot spicy interwebs into textmate and cleanup!' 29 | example '$ wmate google.com' 30 | group 'browser' 31 | 32 | if [ -t 0 ]; then 33 | if [ -n "$1" ]; then 34 | wget -qO- $1 | /usr/bin/mate 35 | 36 | TIDY=`/usr/bin/osascript << EOT 37 | tell application "TextMate" 38 | activate 39 | end tell 40 | 41 | tell application "System Events" 42 | tell process "TextMate" 43 | tell menu bar 1 44 | tell menu bar item "Bundles" 45 | tell menu "Bundles" 46 | tell menu item "HTML" 47 | tell menu "HTML" 48 | click menu item "Tidy" 49 | end tell 50 | end tell 51 | end tell 52 | end tell 53 | end tell 54 | end tell 55 | end tell 56 | EOT` 57 | 58 | else 59 | reference wmate 60 | fi 61 | fi 62 | } 63 | 64 | function raw() { 65 | about 'write wget into a temp file and pump it into your browser' 66 | example '$ raw google.com' 67 | group 'browser' 68 | 69 | if [ -t 0 ]; then 70 | if [ -n "$1" ]; then 71 | wget -qO- $1 | browser 72 | else 73 | reference raw 74 | fi 75 | fi 76 | } 77 | -------------------------------------------------------------------------------- /themes/iterate/iterate.theme.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | SCM_GIT_CHAR="± " 3 | SCM_HG_CHAR="☿ " 4 | SCM_SVN_CHAR="⑆ " 5 | SCM_NONE_CHAR="" 6 | SCM_THEME_PROMPT_DIRTY=" ${red}✗" 7 | SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓" 8 | SCM_THEME_PROMPT_PREFIX="|" 9 | SCM_THEME_PROMPT_SUFFIX="${green}| " 10 | SCM_GIT_AHEAD_CHAR="${green}+" 11 | SCM_GIT_BEHIND_CHAR="${red}-" 12 | 13 | GIT_THEME_PROMPT_DIRTY=" ${bold_red}✗" 14 | GIT_THEME_PROMPT_CLEAN=" ${bold_green}✓" 15 | GIT_THEME_PROMPT_PREFIX="${cyan}|" 16 | GIT_THEME_PROMPT_SUFFIX="${cyan}| " 17 | 18 | RVM_THEME_PROMPT_PREFIX="|" 19 | RVM_THEME_PROMPT_SUFFIX="| " 20 | 21 | VIRTUALENV_THEME_PROMPT_PREFIX="|" 22 | VIRTUALENV_THEME_PROMPT_SUFFIX="| " 23 | 24 | RBENV_THEME_PROMPT_PREFIX="|" 25 | RBENV_THEME_PROMPT_SUFFIX="| " 26 | 27 | RBFU_THEME_PROMPT_PREFIX="|" 28 | RBFU_THEME_PROMPT_SUFFIX="| " 29 | 30 | function rvm_version_prompt { 31 | if which rvm &> /dev/null; then 32 | rvm_current=$(rvm tools identifier) || return 33 | rvm_default=$(rvm strings default) || return 34 | [ "$rvm_current" != "$rvm_default" ] && ( echo -e "$RVM_THEME_PROMPT_PREFIX$rvm_current$RVM_THEME_PROMPT_SUFFIX" ) 35 | fi 36 | } 37 | 38 | function git_prompt_info { 39 | git_prompt_vars 40 | echo -e "$SCM_PREFIX$SCM_BRANCH$SCM_STATE$SCM_GIT_AHEAD$SCM_GIT_BEHIND$SCM_GIT_STASH$SCM_SUFFIX" 41 | } 42 | 43 | LAST_PROMPT_INFO="" 44 | function prompt_command() { 45 | local prompt_info="\n${bold_cyan}$(scm_char)${yellow}$(ruby_version_prompt)${green}\w $(scm_prompt_info)" 46 | if [ "$LAST_PROMPT_INFO" = "$prompt_info" ]; then 47 | prompt_info="" 48 | else 49 | LAST_PROMPT_INFO="$prompt_info" 50 | fi 51 | local wrap_char="" 52 | [[ ${#prompt_info} -gt $(($COLUMNS/1)) ]] && wrap_char="\n" 53 | PS1="${prompt_info}${green}${wrap_char}→${reset_color} " 54 | } 55 | 56 | PROMPT_COMMAND=prompt_command; 57 | -------------------------------------------------------------------------------- /completion/available/homesick.completion.bash: -------------------------------------------------------------------------------- 1 | # Bash completion script for homesick 2 | # 3 | # The homebrew bash completion script was used as inspiration. 4 | # Originally from https://github.com/liborw/homesick-completion 5 | 6 | _homesick_complete() 7 | { 8 | local cur="${COMP_WORDS[COMP_CWORD]}" 9 | local options="--skip --force --pretend --quiet" 10 | local actions="cd clone commit destroy diff generate help list open pull push rc show_path status symlink track unlink version" 11 | local repos=$(\ls ~/.homesick/repos) 12 | 13 | # Subcommand list 14 | [[ ${COMP_CWORD} -eq 1 ]] && { 15 | COMPREPLY=( $(compgen -W "${options} ${actions}" -- ${cur}) ) 16 | return 17 | } 18 | 19 | # Find the first non-switch word 20 | local prev_index=1 21 | local prev="${COMP_WORDS[prev_index]}" 22 | while [[ $prev == -* ]]; do 23 | prev_index=$((++prev_index)) 24 | prev="${COMP_WORDS[prev_index]}" 25 | done 26 | 27 | # Find the number of non-"--" commands 28 | local num=0 29 | for word in ${COMP_WORDS[@]} 30 | do 31 | if [[ $word != -* ]]; then 32 | num=$((++num)) 33 | fi 34 | done 35 | 36 | case "$prev" in 37 | # Commands that take a castle 38 | cd|commit|destroy|diff|open|pull|push|rc|show_path|status|symlink|unlink) 39 | COMPREPLY=( $(compgen -W "${repos}" -- ${cur}) ) 40 | return 41 | ;; 42 | # Commands that take command 43 | help) 44 | COMPREPLY=( $(compgen -W "${actions}" -- ${cur}) ) 45 | return 46 | ;; 47 | # Track command take file and repo 48 | track) 49 | if [[ "$num" -eq 2 ]]; then 50 | COMPREPLY=( $(compgen -X -f ${cur}) ) 51 | elif [[ "$num" -ge 3 ]]; then 52 | COMPREPLY=( $(compgen -W "${repos}" -- ${cur}) ) 53 | fi 54 | return 55 | ;; 56 | esac 57 | } 58 | 59 | complete -o bashdefault -o default -F _homesick_complete homesick 60 | 61 | -------------------------------------------------------------------------------- /themes/pure/pure.theme.bash: -------------------------------------------------------------------------------- 1 | # scm theming 2 | SCM_THEME_PROMPT_PREFIX="|" 3 | SCM_THEME_PROMPT_SUFFIX="" 4 | 5 | SCM_THEME_PROMPT_DIRTY=" ${bold_red}✗${normal}" 6 | SCM_THEME_PROMPT_CLEAN=" ${green}✓${normal}" 7 | SCM_GIT_CHAR="${green}±${normal}" 8 | SCM_SVN_CHAR="${bold_cyan}⑆${normal}" 9 | SCM_HG_CHAR="${bold_red}☿${normal}" 10 | 11 | ### TODO: openSUSE has already colors enabled, check if those differs from stock 12 | # LS colors, made with http://geoff.greer.fm/lscolors/ 13 | # export LSCOLORS="Gxfxcxdxbxegedabagacad" 14 | # export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:' 15 | 16 | scm_prompt() { 17 | CHAR=$(scm_char) 18 | if [ $CHAR = $SCM_NONE_CHAR ] 19 | then 20 | return 21 | else 22 | echo "[$(scm_char)$(scm_prompt_info)]" 23 | fi 24 | } 25 | 26 | pure_prompt() { 27 | ps_host="${bold_blue}\h${normal}"; 28 | ps_user="${green}\u${normal}"; 29 | ps_user_mark="${green} $ ${normal}"; 30 | ps_root="${red}\u${red}"; 31 | ps_root_mark="${red} # ${normal}" 32 | ps_path="${yellow}\w${normal}"; 33 | 34 | # make it work 35 | case $(id -u) in 36 | 0) PS1="$ps_root@$ps_host$(scm_prompt):$ps_path$ps_root_mark" 37 | ;; 38 | *) PS1="$ps_user@$ps_host$(scm_prompt):$ps_path$ps_user_mark" 39 | ;; 40 | esac 41 | } 42 | 43 | PROMPT_COMMAND=pure_prompt; 44 | -------------------------------------------------------------------------------- /completion/available/gradle.completion.bash: -------------------------------------------------------------------------------- 1 | function __gradle { 2 | local cur=${COMP_WORDS[COMP_CWORD]} 3 | local tasks='' 4 | local cache_dir="$HOME/.gradle/completion_cache" 5 | 6 | case $OSTYPE in 7 | darwin*) 8 | local checksum_command="find . -name build.gradle -print0 | xargs -0 md5 -q | md5 -q" 9 | local parsing_command="gradle --console=plain --quiet tasks | grep -v Rules | sed -nE -e 's/^([a-zA-Z]+)($| - .+)/\1/p'" 10 | ;; 11 | *) 12 | local checksum_command="find . -name build.gradle -print0 | xargs -0 md5sum | md5sum | cut -d ' ' -f 1" 13 | local parsing_command="gradle --console=plain --quiet tasks | grep -v Rules | sed -nr -e 's/^([a-zA-Z]+)($| - .+)/\1/p'" 14 | ;; 15 | esac 16 | 17 | mkdir -p "${cache_dir}" 18 | 19 | local gradle_files_checksum='no_cache_file' 20 | if [[ -f build.gradle ]]; then 21 | gradle_files_checksum="$(eval "${checksum_command}")" 22 | if [[ -f "${cache_dir}/${gradle_files_checksum}" ]]; then 23 | newest_gradle_file="$(find . -type f -name build.gradle -newer "${cache_dir}/${gradle_files_checksum}")" 24 | if [ -n "${newest_gradle_file}" ]; then 25 | tasks="$(eval "${parsing_command}")" 26 | [[ -n "${tasks}" ]] && echo "${tasks}" > "${cache_dir}/${gradle_files_checksum}" 27 | else 28 | tasks="$(cat "${cache_dir}/${gradle_files_checksum}")" 29 | touch "${cache_dir}/${gradle_files_checksum}" 30 | fi 31 | else 32 | tasks="$(eval "${parsing_command}")" 33 | [[ -n "${tasks}" ]] && echo "${tasks}" > "${cache_dir}/${gradle_files_checksum}" 34 | fi 35 | else 36 | tasks="$(eval "${parsing_command}")" 37 | [[ -n "${tasks}" ]] && echo "${tasks}" > "${cache_dir}/${gradle_files_checksum}" 38 | fi 39 | COMPREPLY=( $(compgen -W "${tasks}" -- "${cur}") ) 40 | } 41 | 42 | function __clear_gradle_cache { 43 | local cache_dir="$HOME/.gradle/completion_cache" 44 | [[ -d "${cache_dir}" ]] && find "${cache_dir}" -type f -mtime +7 -exec rm -f {} \; 45 | } 46 | 47 | __clear_gradle_cache 48 | 49 | complete -F __gradle gradle 50 | complete -F __gradle gradlew 51 | complete -F __gradle ./gradlew 52 | -------------------------------------------------------------------------------- /themes/zork/zork.theme.bash: -------------------------------------------------------------------------------- 1 | SCM_THEME_PROMPT_PREFIX="" 2 | SCM_THEME_PROMPT_SUFFIX="" 3 | 4 | SCM_THEME_PROMPT_DIRTY=" ${bold_red}✗${normal}" 5 | SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓${normal}" 6 | SCM_GIT_CHAR="${bold_green}±${normal}" 7 | SCM_SVN_CHAR="${bold_cyan}⑆${normal}" 8 | SCM_HG_CHAR="${bold_red}☿${normal}" 9 | 10 | #Mysql Prompt 11 | export MYSQL_PS1="(\u@\h) [\d]> " 12 | 13 | case $TERM in 14 | xterm*) 15 | TITLEBAR="\[\033]0;\w\007\]" 16 | ;; 17 | *) 18 | TITLEBAR="" 19 | ;; 20 | esac 21 | 22 | PS3=">> " 23 | 24 | __my_rvm_ruby_version() { 25 | local gemset=$(echo $GEM_HOME | awk -F'@' '{print $2}') 26 | [ "$gemset" != "" ] && gemset="@$gemset" 27 | local version=$(echo $MY_RUBY_HOME | awk -F'-' '{print $2}') 28 | local full="$version$gemset" 29 | [ "$full" != "" ] && echo "[$full]" 30 | } 31 | 32 | is_vim_shell() { 33 | if [ ! -z "$VIMRUNTIME" ] 34 | then 35 | echo "[${cyan}vim shell${normal}]" 36 | fi 37 | } 38 | 39 | modern_scm_prompt() { 40 | CHAR=$(scm_char) 41 | if [ $CHAR = $SCM_NONE_CHAR ] 42 | then 43 | return 44 | else 45 | echo "[$(scm_char)][$(scm_prompt_info)]" 46 | fi 47 | } 48 | 49 | prompt() { 50 | 51 | case $HOSTNAME in 52 | "zork"* ) my_ps_host="${green}\h${normal}"; 53 | ;; 54 | "pandora") my_ps_host="${red}\h${normal}"; 55 | ;; 56 | * ) my_ps_host="${green}\h${normal}"; 57 | ;; 58 | esac 59 | 60 | my_ps_user="\[\033[01;32m\]\u\[\033[00m\]"; 61 | my_ps_root="\[\033[01;31m\]\u\[\033[00m\]"; 62 | my_ps_path="\[\033[01;36m\]\w\[\033[00m\]"; 63 | 64 | # nice prompt 65 | case "`id -u`" in 66 | 0) PS1="${TITLEBAR}┌─[$my_ps_root][$my_ps_host]$(modern_scm_prompt)$(__my_rvm_ruby_version)[${cyan}\w${normal}]$(is_vim_shell) 67 | └─▪ " 68 | ;; 69 | *) PS1="${TITLEBAR}┌─[$my_ps_user][$my_ps_host]$(modern_scm_prompt)$(__my_rvm_ruby_version)[${cyan}\w${normal}]$(is_vim_shell) 70 | └─▪ " 71 | ;; 72 | esac 73 | } 74 | 75 | PS2="└─▪ " 76 | 77 | 78 | 79 | PROMPT_COMMAND=prompt 80 | -------------------------------------------------------------------------------- /plugins/available/docker.plugin.bash: -------------------------------------------------------------------------------- 1 | cite about-plugin 2 | about-plugin 'Helpers to more easily work with Docker' 3 | 4 | function docker-remove-most-recent-container() { 5 | about 'attempt to remove the most recent container from docker ps -a' 6 | group 'docker' 7 | docker ps -a | head -2 | tail -1 | awk '{print $NF}' | xargs docker rm 8 | } 9 | 10 | function docker-remove-most-recent-image() { 11 | about 'attempt to remove the most recent image from docker images' 12 | group 'docker' 13 | docker images | head -2 | tail -1 | awk '{print $3}' | xargs docker rmi 14 | } 15 | 16 | function docker-enter() { 17 | about 'enter the specified docker container using bash' 18 | group 'docker' 19 | param '1: Name of the container to enter' 20 | example 'docker-enter oracle-xe' 21 | 22 | docker exec -it "$@" /bin/bash; 23 | } 24 | 25 | function docker-remove-images() { 26 | about 'attempt to remove images with supplied tags or all if no tags are supplied' 27 | group 'docker' 28 | if [ -z "$1" ]; then 29 | docker rmi $(docker images -q) 30 | else 31 | DOCKER_IMAGES="" 32 | for IMAGE_ID in $@; do DOCKER_IMAGES="$DOCKER_IMAGES\|$IMAGE_ID"; done 33 | # Find the image IDs for the supplied tags 34 | ID_ARRAY=($(docker images | grep "${DOCKER_IMAGES:2}" | awk {'print $3'})) 35 | # Strip out duplicate IDs before attempting to remove the image(s) 36 | docker rmi $(echo ${ID_ARRAY[@]} | tr ' ' '\n' | sort -u | tr '\n' ' ') 37 | fi 38 | } 39 | 40 | function docker-image-dependencies() { 41 | about 'attempt to create a Graphiz image of the supplied image ID dependencies' 42 | group 'docker' 43 | if hash dot 2>/dev/null; then 44 | OUT=$(mktemp -t docker-viz-XXXX.png) 45 | docker images -viz | dot -Tpng > $OUT 46 | case $OSTYPE in 47 | linux*) 48 | xdg-open $OUT 49 | ;; 50 | darwin*) 51 | open $OUT 52 | ;; 53 | esac 54 | else 55 | >&2 echo "Can't show dependencies; Graphiz is not installed" 56 | fi 57 | } 58 | 59 | function docker-runtime-environment() { 60 | about 'attempt to list the environmental variables of the supplied image ID' 61 | group 'docker' 62 | docker run "$@" env 63 | } 64 | -------------------------------------------------------------------------------- /test/test_helper.bash: -------------------------------------------------------------------------------- 1 | unset BASH_IT_THEME 2 | unset GIT_HOSTING 3 | unset NGINX_PATH 4 | unset IRC_CLIENT 5 | unset TODO 6 | unset SCM_CHECK 7 | 8 | BASH_IT_TEST_DIR="${BATS_TMPDIR}/.bash_it" 9 | 10 | # guard against executing this block twice due to bats internals 11 | if [ "$BASH_IT_ROOT" != "${BASH_IT_TEST_DIR}/root" ]; then 12 | export BASH_IT_ROOT="${BASH_IT_TEST_DIR}/root" 13 | export BASH_IT=$BASH_IT_TEST_DIR 14 | fi 15 | 16 | setup() { 17 | mkdir -p -- "${BASH_IT_ROOT}" 18 | } 19 | 20 | teardown() { 21 | rm -rf "${BASH_IT_TEST_DIR}" 22 | } 23 | 24 | assert() { 25 | if ! "$@"; then 26 | flunk "failed: $@" 27 | fi 28 | } 29 | 30 | flunk() { 31 | { if [ "$#" -eq 0 ]; then cat - 32 | else echo "$@" 33 | fi 34 | } | sed "s:${BASH_IT_TEST_DIR}:TEST_DIR:g" >&2 35 | return 1 36 | } 37 | 38 | assert_success() { 39 | if [ "$status" -ne 0 ]; then 40 | flunk "command failed with exit status $status" 41 | elif [ "$#" -gt 0 ]; then 42 | assert_output "$1" 43 | fi 44 | } 45 | 46 | assert_failure() { 47 | if [ "$status" -eq 0 ]; then 48 | flunk "expected failed exit status" 49 | elif [ "$#" -gt 0 ]; then 50 | assert_output "$1" 51 | fi 52 | } 53 | 54 | assert_equal() { 55 | if [ "$1" != "$2" ]; then 56 | { echo "expected: $1" 57 | echo "actual: $2" 58 | } | flunk 59 | fi 60 | } 61 | 62 | assert_output() { 63 | local expected 64 | if [ $# -eq 0 ]; then expected="$(cat -)" 65 | else expected="$1" 66 | fi 67 | assert_equal "$expected" "$output" 68 | } 69 | 70 | assert_line() { 71 | if [ "$1" -ge 0 ] 2>/dev/null; then 72 | assert_equal "$2" "${lines[$1]}" 73 | else 74 | local line 75 | for line in "${lines[@]}"; do 76 | if [ "$line" = "$1" ]; then return 0; fi 77 | done 78 | flunk "expected line \`$1'" 79 | fi 80 | } 81 | 82 | refute_line() { 83 | if [ "$1" -ge 0 ] 2>/dev/null; then 84 | local num_lines="${#lines[@]}" 85 | if [ "$1" -lt "$num_lines" ]; then 86 | flunk "output has $num_lines lines" 87 | fi 88 | else 89 | local line 90 | for line in "${lines[@]}"; do 91 | if [ "$line" = "$1" ]; then 92 | flunk "expected to not find line \`$line'" 93 | fi 94 | done 95 | fi 96 | } 97 | -------------------------------------------------------------------------------- /aliases/available/osx.aliases.bash: -------------------------------------------------------------------------------- 1 | cite 'about-alias' 2 | about-alias 'osx-specific aliases' 3 | 4 | # Desktop Programs 5 | alias fireworks="open -a '/Applications/Adobe Fireworks CS3/Adobe Fireworks CS3.app'" 6 | alias photoshop="open -a '/Applications/Adobe Photoshop CS3/Adobe Photoshop.app'" 7 | alias preview="open -a '$PREVIEW'" 8 | alias xcode="open -a '/Applications/XCode.app'" 9 | alias filemerge="open -a '/Developer/Applications/Utilities/FileMerge.app'" 10 | alias safari="open -a safari" 11 | alias firefox="open -a firefox" 12 | alias chrome="open -a google\ chrome" 13 | alias chromium="open -a chromium" 14 | alias dashcode="open -a dashcode" 15 | alias f='open -a Finder ' 16 | alias fh='open -a Finder .' 17 | alias textedit='open -a TextEdit' 18 | alias hex='open -a "Hex Fiend"' 19 | alias skype='open -a Skype' 20 | alias mou='open -a Mou' 21 | 22 | if [ -s /usr/bin/firefox ] ; then 23 | unalias firefox 24 | fi 25 | 26 | # Requires growlnotify, which can be found in the Growl DMG under "Extras" 27 | alias grnot='growlnotify -s -t Terminal -m "Done"' 28 | 29 | # Get rid of those pesky .DS_Store files recursively 30 | alias dsclean='find . -type f -name .DS_Store -delete' 31 | 32 | # Track who is listening to your iTunes music 33 | alias whotunes='lsof -r 2 -n -P -F n -c iTunes -a -i TCP@`hostname`:3689' 34 | 35 | # Flush your dns cache 36 | alias flush='dscacheutil -flushcache' 37 | 38 | # Show/hide hidden files (for Mac OS X Mavericks) 39 | alias showhidden="defaults write com.apple.finder AppleShowAllFiles TRUE" 40 | alias hidehidden="defaults write com.apple.finder AppleShowAllFiles FALSE" 41 | 42 | # From http://apple.stackexchange.com/questions/110343/copy-last-command-in-terminal 43 | alias copyLastCmd='fc -ln -1 | awk '\''{$1=$1}1'\'' ORS='\'''\'' | pbcopy' 44 | 45 | # Use Finder's Quick Look on a file (^C or space to close) 46 | alias ql='qlmanage -p 2>/dev/null' 47 | 48 | # Mute/Unmute the system volume. Plays nice with all other volume settings. 49 | alias mute="osascript -e 'set volume output muted true'" 50 | alias unmute="osascript -e 'set volume output muted false'" 51 | 52 | # Pin to the tail of long commands for an audible alert after long processes 53 | ## curl http://downloads.com/hugefile.zip; lmk 54 | alias lmk="say 'Process complete.'" -------------------------------------------------------------------------------- /plugins/available/postgres.plugin.bash: -------------------------------------------------------------------------------- 1 | cite about-plugin 2 | about-plugin 'postgres helper functions' 3 | 4 | 5 | export PGVERSION=`pg_config --version | awk '{print $2}'` 6 | export POSTGRES_BIN=`pg_config --bindir` 7 | COMMON_PGDATA_PATHS=("/usr/local/var/postgres" "/var/pgsql" "/Library/Server/PostgreSQL/Data") 8 | for possible in "${COMMON_PGDATA_PATHS[@]}" 9 | do 10 | : 11 | if [ -f "$possible/pg_hba.conf" ] 12 | then 13 | # echo "PGDATA: $possible" 14 | export PGDATA=$possible 15 | fi 16 | done 17 | 18 | 19 | 20 | 21 | 22 | function postgres_start { 23 | about 'Starts PostgresSQL server' 24 | group 'postgres' 25 | 26 | echo 'Starting PostgresSQL Server....'; 27 | $POSTGRES_BIN/pg_ctl -D $PGDATA -l $PGDATA/logfile start 28 | } 29 | 30 | function postgres_stop { 31 | about 'Steps PostgresSQL server' 32 | group 'postgres' 33 | 34 | echo 'Stopping PostgresSQL Server....'; 35 | $POSTGRES_BIN/pg_ctl -D $PGDATA -l $PGDATA/logfile stop -s -m fast 36 | } 37 | 38 | function postgres_status { 39 | about 'Returns status of PostgresSQL server' 40 | group 'postgres' 41 | 42 | # $POSTGRES_BIN/pg_ctl -D $PGDATA status 43 | if [[ $(is_postgres_running) == "no server running" ]] 44 | then 45 | echo "Postgres service [STOPPED]" 46 | else 47 | echo "Postgres service [RUNNING]" 48 | fi 49 | } 50 | 51 | 52 | function is_postgres_running { 53 | $POSTGRES_BIN/pg_ctl -D $PGDATA status | egrep -o "no server running" 54 | } 55 | 56 | 57 | function postgres_restart { 58 | about 'Restarts status of PostgresSQL server' 59 | group 'postgres' 60 | 61 | echo 'Restarting Postgres....'; 62 | $POSTGRES_BIN/pg_ctl -D $PGDATA restart 63 | } 64 | 65 | function postgres_logfile { 66 | about 'View the last 500 lines from logfile' 67 | group 'postgres' 68 | 69 | tail -500 $PGDATA/logfile | less 70 | } 71 | 72 | function postgres_serverlog { 73 | about 'View the last 500 lines from server.log' 74 | group 'postgres' 75 | 76 | tail -500 $PGDATA/server.log | less 77 | } 78 | 79 | 80 | # function postgres_syslog { 81 | # about 'View the last 500 lines from syslog' 82 | # group 'postgres' 83 | # 84 | # tail -500 $PGDATA/pg_log/`ls -Art $PGDATA/pg_log | tail -n 1` | less 85 | # } 86 | # 87 | 88 | -------------------------------------------------------------------------------- /aliases/available/laravel.aliases.bash: -------------------------------------------------------------------------------- 1 | cite 'about-alias' 2 | about-alias 'laravel artisan abbreviations' 3 | 4 | # A list of useful laravel aliases 5 | 6 | # asset 7 | alias a:apub='php artisan asset:publish' 8 | 9 | # auth 10 | alias a:remclear='php artisan auth:clear-reminders' 11 | alias a:remcontroller='php artisan auth:reminders-controller' 12 | alias a:remtable='php artisan auth:reminders-table' 13 | 14 | # cache 15 | alias a:cacheclear='php artisan cache:clear' 16 | 17 | # command 18 | alias a:command='php artisan command:make' 19 | 20 | # config 21 | alias a:confpub='php artisan config:publish' 22 | 23 | # controller 24 | alias a:controller='php artisan controller:make' 25 | 26 | # db 27 | alias a:seed='php artisan db:seed' 28 | 29 | # key 30 | alias a:key='php artisan key:generate' 31 | 32 | # migrate 33 | alias a:migrate='php artisan migrate' 34 | alias a:mig='a:migrate' 35 | alias a:miginstall='php artisan migrate:install' 36 | alias a:migmake='php artisan migrate:make' 37 | alias a:migcreate='php artisan migrate:create' 38 | alias a:migpublish='php artisan migrate:publish' 39 | alias a:migrefresh='php artisan migrate:refresh' 40 | alias a:migreset='php artisan migrate:reset' 41 | alias a:migrollback='php artisan migrate:rollback' 42 | alias a:rollback='a:migrollback' 43 | 44 | # queue 45 | alias a:qfailed='php artisan queue:failed' 46 | alias a:qfailedtable='php artisan queue:failed-table' 47 | alias a:qflush='php artisan queue:flush' 48 | alias a:qforget='php artisan queue:forget' 49 | alias a:qlisten='php artisan queue:listen' 50 | alias a:qretry='php artisan queue:retry' 51 | alias a:qsubscribe='php artisan queue:subscribe' 52 | alias a:qwork='php artisan queue:work' 53 | 54 | # session 55 | alias a:stable='php artisan session:table' 56 | 57 | # view 58 | alias a:vpub='php artisan view:publish' 59 | 60 | # misc 61 | alias a:='php artisan' 62 | alias a:changes='php artisan changes' 63 | alias a:down='php artisan down' 64 | alias a:env='php artisan env' 65 | alias a:help='php artisan help' 66 | alias a:list='php artisan list' 67 | alias a:optimize='php artisan optimize' 68 | alias a:routes='php artisan routes' 69 | alias a:serve='php artisan serve' 70 | alias a:tail='php artisan tail' 71 | alias a:tinker='php artisan tinker' 72 | alias a:up='php artisan up' 73 | alias a:work='php artisan workbench' 74 | -------------------------------------------------------------------------------- /themes/slick/slick.theme.bash: -------------------------------------------------------------------------------- 1 | SCM_THEME_PROMPT_PREFIX="" 2 | SCM_THEME_PROMPT_SUFFIX="" 3 | 4 | SCM_THEME_PROMPT_DIRTY=" ${bold_red}✗${normal}" 5 | SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓${normal}" 6 | SCM_GIT_CHAR="${bold_cyan}±${normal}" 7 | SCM_SVN_CHAR="${bold_green}⑆${normal}" 8 | SCM_HG_CHAR="${bold_red}☿${normal}" 9 | 10 | #Mysql Prompt 11 | export MYSQL_PS1="(\u@\h) [\d]> " 12 | 13 | case $TERM in 14 | xterm*) 15 | TITLEBAR="\[\033]0;\w\007\]" 16 | ;; 17 | *) 18 | TITLEBAR="" 19 | ;; 20 | esac 21 | 22 | PS3=">> " 23 | 24 | __my_rvm_ruby_version() { 25 | local gemset=$(echo $GEM_HOME | awk -F'@' '{print $2}') 26 | [ "$gemset" != "" ] && gemset="@$gemset" 27 | local version=$(echo $MY_RUBY_HOME | awk -F'-' '{print $2}') 28 | local full="$version$gemset" 29 | [ "$full" != "" ] && echo "[$full]" 30 | } 31 | 32 | __my_venv_prompt() { 33 | if [ ! -z "$VIRTUAL_ENV" ] 34 | then 35 | echo "[${blue}@${normal}${VIRTUAL_ENV##*/}]" 36 | fi 37 | } 38 | 39 | is_vim_shell() { 40 | if [ ! -z "$VIMRUNTIME" ] 41 | then 42 | echo "[${cyan}vim shell${normal}]" 43 | fi 44 | } 45 | 46 | modern_scm_prompt() { 47 | CHAR=$(scm_char) 48 | if [ $CHAR = $SCM_NONE_CHAR ] 49 | then 50 | return 51 | else 52 | echo "[$(scm_char)][$(scm_prompt_info)]" 53 | fi 54 | } 55 | 56 | prompt() { 57 | 58 | case $HOSTNAME in 59 | "clappy"* ) my_ps_host="${green}\h${normal}"; 60 | ;; 61 | "icekernel") my_ps_host="${red}\h${normal}"; 62 | ;; 63 | * ) my_ps_host="${green}\h${normal}"; 64 | ;; 65 | esac 66 | 67 | my_ps_user="\[\033[01;32m\]\u\[\033[00m\]"; 68 | my_ps_root="\[\033[01;31m\]\u\[\033[00m\]"; 69 | my_ps_path="\[\033[01;36m\]\w\[\033[00m\]"; 70 | 71 | # nice prompt 72 | case "`id -u`" in 73 | 0) PS1="${TITLEBAR}[$my_ps_root][$my_ps_host]$(modern_scm_prompt)$(__my_rvm_ruby_version)[${cyan}\w${normal}]$(is_vim_shell) 74 | $ " 75 | ;; 76 | *) PS1="${TITLEBAR}[$my_ps_user][$my_ps_host]$(modern_scm_prompt)$(__my_rvm_ruby_version)$(__my_venv_prompt)[${cyan}\w${normal}]$(is_vim_shell) 77 | $ " 78 | ;; 79 | esac 80 | } 81 | 82 | PS2="> " 83 | 84 | 85 | 86 | PROMPT_COMMAND=prompt 87 | -------------------------------------------------------------------------------- /bash_it.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Initialize Bash It 3 | 4 | # Reload Library 5 | case $OSTYPE in 6 | darwin*) 7 | alias reload='source ~/.bash_profile' 8 | ;; 9 | *) 10 | alias reload='source ~/.bashrc' 11 | ;; 12 | esac 13 | 14 | # Only set $BASH_IT if it's not already set 15 | if [ -z "$BASH_IT" ]; 16 | then 17 | # Setting $BASH to maintain backwards compatibility 18 | # TODO: warn users that they should upgrade their .bash_profile 19 | export BASH_IT=$BASH 20 | export BASH=`bash -c 'echo $BASH'` 21 | fi 22 | 23 | # For backwards compatibility, look in old BASH_THEME location 24 | if [ -z "$BASH_IT_THEME" ]; 25 | then 26 | # TODO: warn users that they should upgrade their .bash_profile 27 | export BASH_IT_THEME="$BASH_THEME"; 28 | unset $BASH_THEME; 29 | fi 30 | 31 | # Load composure first, so we support function metadata 32 | source "${BASH_IT}/lib/composure.bash" 33 | 34 | # support 'plumbing' metadata 35 | cite _about _param _example _group _author _version 36 | 37 | # Load colors first so they can be use in base theme 38 | source "${BASH_IT}/themes/colors.theme.bash" 39 | source "${BASH_IT}/themes/base.theme.bash" 40 | 41 | # library 42 | LIB="${BASH_IT}/lib/*.bash" 43 | for config_file in $LIB 44 | do 45 | source $config_file 46 | done 47 | 48 | # Load enabled aliases, completion, plugins 49 | for file_type in "aliases" "completion" "plugins" 50 | do 51 | _load_bash_it_files $file_type 52 | done 53 | 54 | # Load custom aliases, completion, plugins 55 | for file_type in "aliases" "completion" "plugins" 56 | do 57 | if [ -e "${BASH_IT}/${file_type}/custom.${file_type}.bash" ] 58 | then 59 | source "${BASH_IT}/${file_type}/custom.${file_type}.bash" 60 | fi 61 | done 62 | 63 | # Custom 64 | CUSTOM="${BASH_IT}/custom/*.bash" 65 | for config_file in $CUSTOM 66 | do 67 | if [ -e "${config_file}" ]; then 68 | source $config_file 69 | fi 70 | done 71 | 72 | unset config_file 73 | if [[ $PROMPT ]]; then 74 | export PS1="\["$PROMPT"\]" 75 | fi 76 | 77 | # Adding Support for other OSes 78 | PREVIEW="less" 79 | [ -s /usr/bin/gloobus-preview ] && PREVIEW="gloobus-preview" 80 | [ -s /Applications/Preview.app ] && PREVIEW="/Applications/Preview.app" 81 | 82 | # Load all the Jekyll stuff 83 | 84 | if [ -e "$HOME/.jekyllconfig" ] 85 | then 86 | . "$HOME/.jekyllconfig" 87 | fi 88 | -------------------------------------------------------------------------------- /themes/cupcake/cupcake.theme.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Emoji-based theme to display source control management and 4 | # virtual environment info beside the ordinary bash prompt. 5 | 6 | # Theme inspired by: 7 | # - Naming your Terminal tabs in OSX Lion - http://thelucid.com/2012/01/04/naming-your-terminal-tabs-in-osx-lion/ 8 | # - Bash_it sexy theme 9 | 10 | # Demo: 11 | # ┌ⓔ virtualenv 💁user @ 💻 host in 📁directory on 🌿branch {1} ↑1 ↓1 +1 •1 ⌀1 ✗ 12 | # └❯ cd .bash-it/themes/cupcake 13 | 14 | # virtualenv prompts 15 | VIRTUALENV_CHAR="ⓔ " 16 | VIRTUALENV_THEME_PROMPT_PREFIX="" 17 | VIRTUALENV_THEME_PROMPT_SUFFIX="" 18 | 19 | # SCM prompts 20 | SCM_NONE_CHAR="" 21 | SCM_GIT_CHAR="[±] " 22 | SCM_GIT_BEHIND_CHAR="${red}↓${normal}" 23 | SCM_GIT_AHEAD_CHAR="${bold_green}↑${normal}" 24 | SCM_GIT_UNTRACKED_CHAR="⌀" 25 | SCM_GIT_UNSTAGED_CHAR="${bold_yellow}•${normal}" 26 | SCM_GIT_STAGED_CHAR="${bold_green}+${normal}" 27 | 28 | SCM_THEME_PROMPT_DIRTY="" 29 | SCM_THEME_PROMPT_CLEAN="" 30 | SCM_THEME_PROMPT_PREFIX="" 31 | SCM_THEME_PROMPT_SUFFIX="" 32 | 33 | # Git status prompts 34 | GIT_THEME_PROMPT_DIRTY=" ${red}✗${normal}" 35 | GIT_THEME_PROMPT_CLEAN=" ${bold_green}✓${normal}" 36 | GIT_THEME_PROMPT_PREFIX="" 37 | GIT_THEME_PROMPT_SUFFIX="" 38 | 39 | # ICONS ======================================================================= 40 | 41 | icon_start="┌" 42 | icon_user="💁 " 43 | icon_host=" @ 💻 " 44 | icon_directory=" in 📁 " 45 | icon_branch="🌿" 46 | icon_end="└❯ " 47 | 48 | # extra spaces ensure legiblity in prompt 49 | 50 | # FUNCTIONS =================================================================== 51 | 52 | # Display virtual environment info 53 | function virtualenv_prompt { 54 | if [[ -n "$VIRTUAL_ENV" ]]; then 55 | virtualenv=`basename "$VIRTUAL_ENV"` 56 | echo -e "$VIRTUALENV_CHAR$virtualenv " 57 | fi 58 | } 59 | 60 | # Rename tab 61 | function tabname { 62 | printf "\e]1;$1\a" 63 | } 64 | 65 | # Rename window 66 | function winname { 67 | printf "\e]2;$1\a" 68 | } 69 | 70 | # PROMPT OUTPUT =============================================================== 71 | 72 | # Displays the current prompt 73 | function prompt_command() { 74 | PS1="\n${icon_start}$(virtualenv_prompt)${icon_user}${bold_red}\u${normal}${icon_host}${bold_cyan}\h${normal}${icon_directory}${bold_purple}\W${normal}\$([[ -n \$(git branch 2> /dev/null) ]] && echo \" on ${icon_branch} \")${white}$(scm_prompt_info)${normal}\n${icon_end}" 75 | PS2="${icon_end}" 76 | } 77 | 78 | # Runs prompt (this bypasses bash_it $PROMPT setting) 79 | PROMPT_COMMAND=prompt_command 80 | -------------------------------------------------------------------------------- /aliases/available/git.aliases.bash: -------------------------------------------------------------------------------- 1 | cite 'about-alias' 2 | about-alias 'common git abbreviations' 3 | 4 | # Aliases 5 | alias gcl='git clone' 6 | alias ga='git add' 7 | alias gall='git add -A' 8 | alias gf='git fetch --all --prune --verbose' 9 | alias gft='git fetch --all --prune --tags --verbose' 10 | alias gus='git reset HEAD' 11 | alias gm="git merge" 12 | alias g='git' 13 | alias get='git' 14 | alias gst='git status' 15 | alias gs='git status' 16 | alias gss='git status -s' 17 | alias gsu='git submodule update --init --recursive' 18 | alias gl='git pull' 19 | alias gpr='git pull --rebase' 20 | alias gpp='git pull && git push' 21 | alias gup='git fetch && git rebase' 22 | alias gp='git push' 23 | alias gpo='git push origin' 24 | alias gpu='git push --set-upstream' 25 | alias gpom='git push origin master' 26 | alias gdv='git diff -w "$@" | vim -R -' 27 | alias gc='git commit -v' 28 | alias gca='git commit -v -a' 29 | alias gcm='git commit -v -m' 30 | alias gci='git commit --interactive' 31 | alias gb='git branch' 32 | alias gba='git branch -a' 33 | alias gbt='git branch --track' 34 | alias gcount='git shortlog -sn' 35 | alias gcp='git cherry-pick' 36 | alias gco='git checkout' 37 | alias gcb='git checkout -b' 38 | alias gct='git checkout --track' 39 | alias gexport='git archive --format zip --output' 40 | alias gdel='git branch -D' 41 | alias gmu='git fetch origin -v; git fetch upstream -v; git merge upstream/master' 42 | alias gll='git log --graph --pretty=oneline --abbrev-commit' 43 | alias gg="git log --graph --pretty=format:'%C(bold)%h%Creset%C(yellow)%d%Creset %s %C(yellow)%an %C(cyan)%cr%Creset' --abbrev-commit --date=relative" 44 | alias ggs="gg --stat" 45 | alias gsl="git shortlog -sn" 46 | alias gw="git whatchanged" 47 | alias gt="git tag" 48 | alias gta="git tag -a" 49 | alias gtd="git tag -d" 50 | alias gtl="git tag -l" 51 | # From http://blogs.atlassian.com/2014/10/advanced-git-aliases/ 52 | # Show commits since last pull 53 | alias gnew="git log HEAD@{1}..HEAD@{0}" 54 | # Add uncommitted and unstaged changes to the last commit 55 | alias gcaa="git commit -a --amend -C HEAD" 56 | 57 | case $OSTYPE in 58 | darwin*) 59 | alias gtls="git tag -l | gsort -V" 60 | ;; 61 | *) 62 | alias gtls='git tag -l | sort -V' 63 | ;; 64 | esac 65 | 66 | if [ -z "$EDITOR" ]; then 67 | case $OSTYPE in 68 | linux*) 69 | alias gd='git diff | vim -R -' 70 | ;; 71 | darwin*) 72 | alias gd='git diff | mate' 73 | ;; 74 | *) 75 | alias gd='git diff' 76 | ;; 77 | esac 78 | else 79 | alias gd="git diff | $EDITOR" 80 | fi 81 | -------------------------------------------------------------------------------- /completion/available/django.completion.bash: -------------------------------------------------------------------------------- 1 | # ######################################################################### 2 | # This bash script adds tab-completion feature to django-admin.py and 3 | # manage.py. 4 | # 5 | # Testing it out without installing 6 | # ================================= 7 | # 8 | # To test out the completion without "installing" this, just run this file 9 | # directly, like so: 10 | # 11 | # . ~/path/to/django_bash_completion 12 | # 13 | # Note: There's a dot ('.') at the beginning of that command. 14 | # 15 | # After you do that, tab completion will immediately be made available in your 16 | # current Bash shell. But it won't be available next time you log in. 17 | # 18 | # Installing 19 | # ========== 20 | # 21 | # To install this, point to this file from your .bash_profile, like so: 22 | # 23 | # . ~/path/to/django_bash_completion 24 | # 25 | # Do the same in your .bashrc if .bashrc doesn't invoke .bash_profile. 26 | # 27 | # Settings will take effect the next time you log in. 28 | # 29 | # Uninstalling 30 | # ============ 31 | # 32 | # To uninstall, just remove the line from your .bash_profile and .bashrc. 33 | 34 | _django_completion() 35 | { 36 | COMPREPLY=( $( COMP_WORDS="${COMP_WORDS[*]}" \ 37 | COMP_CWORD=$COMP_CWORD \ 38 | DJANGO_AUTO_COMPLETE=1 $1 ) ) 39 | } 40 | complete -F _django_completion -o default django-admin.py manage.py django-admin 41 | 42 | _python_django_completion() 43 | { 44 | if [[ ${COMP_CWORD} -ge 2 ]]; then 45 | PYTHON_EXE=$( basename -- ${COMP_WORDS[0]} ) 46 | echo $PYTHON_EXE | egrep "python([2-9]\.[0-9])?" >/dev/null 2>&1 47 | if [[ $? == 0 ]]; then 48 | PYTHON_SCRIPT=$( basename -- ${COMP_WORDS[1]} ) 49 | echo $PYTHON_SCRIPT | egrep "manage\.py|django-admin(\.py)?" >/dev/null 2>&1 50 | if [[ $? == 0 ]]; then 51 | COMPREPLY=( $( COMP_WORDS="${COMP_WORDS[*]:1}" \ 52 | COMP_CWORD=$(( COMP_CWORD-1 )) \ 53 | DJANGO_AUTO_COMPLETE=1 ${COMP_WORDS[*]} ) ) 54 | fi 55 | fi 56 | fi 57 | } 58 | 59 | # Support for multiple interpreters. 60 | unset pythons 61 | if command -v whereis &>/dev/null; then 62 | python_interpreters=$(whereis python | cut -d " " -f 2-) 63 | for python in $python_interpreters; do 64 | pythons="${pythons} $(basename -- $python)" 65 | done 66 | pythons=$(echo $pythons | tr " " "\n" | sort -u | tr "\n" " ") 67 | else 68 | pythons=python 69 | fi 70 | 71 | complete -F _python_django_completion -o default $pythons 72 | 73 | -------------------------------------------------------------------------------- /themes/doubletime/doubletime.theme.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | SCM_THEME_PROMPT_DIRTY='' 3 | SCM_THEME_PROMPT_CLEAN='' 4 | SCM_GIT_CHAR="${bold_cyan}±${normal}" 5 | SCM_SVN_CHAR="${bold_cyan}⑆${normal}" 6 | SCM_HG_CHAR="${bold_red}☿${normal}" 7 | SCM_THEME_PROMPT_PREFIX="" 8 | SCM_THEME_PROMPT_SUFFIX="" 9 | if [ ! -z $RVM_THEME_PROMPT_COLOR ]; then 10 | RVM_THEME_PROMPT_COLOR=$(eval echo $`echo ${RVM_THEME_PROMPT_COLOR}`); 11 | else 12 | RVM_THEME_PROMPT_COLOR="${red}" 13 | fi 14 | RVM_THEME_PROMPT_PREFIX="(${RVM_THEME_PROMPT_COLOR}rb${normal}: " 15 | RVM_THEME_PROMPT_SUFFIX=") " 16 | if [ ! -z $VIRTUALENV_THEME_PROMPT_COLOR ]; then 17 | VIRTUALENV_THEME_PROMPT_COLOR=$(eval echo $`echo ${VIRTUALENV_THEME_PROMPT_COLOR}`); 18 | else 19 | VIRTUALENV_THEME_PROMPT_COLOR="${green}" 20 | fi 21 | VIRTUALENV_THEME_PROMPT_PREFIX="(${VIRTUALENV_THEME_PROMPT_COLOR}py${normal}: " 22 | VIRTUALENV_THEME_PROMPT_SUFFIX=") " 23 | 24 | if [ ! -z $THEME_PROMPT_HOST_COLOR ]; then 25 | THEME_PROMPT_HOST_COLOR=$(eval echo $`echo ${THEME_PROMPT_HOST_COLOR}`); 26 | else 27 | THEME_PROMPT_HOST_COLOR="$blue" 28 | fi 29 | 30 | doubletime_scm_prompt() { 31 | CHAR=$(scm_char) 32 | if [ $CHAR = $SCM_NONE_CHAR ]; then 33 | return 34 | elif [ $CHAR = $SCM_GIT_CHAR ]; then 35 | echo "$(git_prompt_status)" 36 | else 37 | echo "[$(scm_prompt_info)]" 38 | fi 39 | } 40 | 41 | function prompt_setter() { 42 | # Save history 43 | history -a 44 | history -c 45 | history -r 46 | if [[ -z "$THEME_PROMPT_CLOCK_FORMAT" ]] 47 | then 48 | clock="\t" 49 | else 50 | clock=$THEME_PROMPT_CLOCK_FORMAT 51 | fi 52 | PS1=" 53 | $clock $(scm_char) [$THEME_PROMPT_HOST_COLOR\u@${THEME_PROMPT_HOST}$reset_color] $(virtualenv_prompt)$(ruby_version_prompt)\w 54 | $(doubletime_scm_prompt)$reset_color $ " 55 | PS2='> ' 56 | PS4='+ ' 57 | } 58 | 59 | PROMPT_COMMAND=prompt_setter 60 | 61 | git_prompt_status() { 62 | local git_status_output 63 | git_status_output=$(git status 2> /dev/null ) 64 | if [ -n "$(echo $git_status_output | grep 'Changes not staged')" ]; then 65 | git_status="${bold_red}$(scm_prompt_info) ✗" 66 | elif [ -n "$(echo $git_status_output | grep 'Changes to be committed')" ]; then 67 | git_status="${bold_yellow}$(scm_prompt_info) ^" 68 | elif [ -n "$(echo $git_status_output | grep 'Untracked files')" ]; then 69 | git_status="${bold_cyan}$(scm_prompt_info) +" 70 | elif [ -n "$(echo $git_status_output | grep 'nothing to commit')" ]; then 71 | git_status="${bold_green}$(scm_prompt_info) ${green}✓" 72 | else 73 | git_status="$(scm_prompt_info)" 74 | fi 75 | echo "[$git_status${normal}]" 76 | 77 | } 78 | -------------------------------------------------------------------------------- /plugins/available/todo/todo.cfg: -------------------------------------------------------------------------------- 1 | # === EDIT FILE LOCATIONS BELOW === 2 | 3 | # Your todo/done/report.txt locations 4 | export TODO_FILE="$TODO_DIR/todo.txt" 5 | export DONE_FILE="$TODO_DIR/done.txt" 6 | export REPORT_FILE="$TODO_DIR/report.txt" 7 | 8 | # You can customize your actions directory location 9 | #export TODO_ACTIONS_DIR="$HOME/.todo.actions.d" 10 | 11 | # == EDIT FILE LOCATIONS ABOVE === 12 | 13 | # === COLOR MAP === 14 | 15 | ## Text coloring and formatting is done by inserting ANSI escape codes. 16 | ## If you have re-mapped your color codes, or use the todo.txt 17 | ## output in another output system (like Conky), you may need to 18 | ## over-ride by uncommenting and editing these defaults. 19 | ## If you change any of these here, you also need to uncomment 20 | ## the defaults in the COLORS section below. Otherwise, todo.txt 21 | ## will still use the defaults! 22 | 23 | # export BLACK='\\033[0;30m' 24 | # export RED='\\033[0;31m' 25 | # export GREEN='\\033[0;32m' 26 | # export BROWN='\\033[0;33m' 27 | # export BLUE='\\033[0;34m' 28 | # export PURPLE='\\033[0;35m' 29 | # export CYAN='\\033[0;36m' 30 | # export LIGHT_GREY='\\033[0;37m' 31 | # export DARK_GREY='\\033[1;30m' 32 | # export LIGHT_RED='\\033[1;31m' 33 | # export LIGHT_GREEN='\\033[1;32m' 34 | # export YELLOW='\\033[1;33m' 35 | # export LIGHT_BLUE='\\033[1;34m' 36 | # export LIGHT_PURPLE='\\033[1;35m' 37 | # export LIGHT_CYAN='\\033[1;36m' 38 | # export WHITE='\\033[1;37m' 39 | # export DEFAULT='\\033[0m' 40 | 41 | # === COLORS === 42 | 43 | ## Uncomment and edit to override these defaults. 44 | ## Reference the constants from the color map above, 45 | ## or use $NONE to disable highlighting. 46 | # 47 | # Priorities can be any upper-case letter. 48 | # A,B,C are highlighted; you can add coloring for more. 49 | # 50 | # export PRI_A=$YELLOW # color for A priority 51 | # export PRI_B=$GREEN # color for B priority 52 | # export PRI_C=$LIGHT_BLUE # color for C priority 53 | # export PRI_D=... # define your own 54 | # export PRI_X=$WHITE # color unless explicitly defined 55 | 56 | # There is highlighting for tasks that have been done, 57 | # but haven't been archived yet. 58 | # 59 | # export COLOR_DONE=$LIGHT_GREY 60 | 61 | # === BEHAVIOR === 62 | 63 | ## customize list output 64 | # 65 | # TODOTXT_SORT_COMMAND will filter after line numbers are 66 | # inserted, but before colorization, and before hiding of 67 | # priority, context, and project. 68 | # 69 | # export TODOTXT_SORT_COMMAND='env LC_COLLATE=C sort -f -k2' 70 | 71 | # TODOTXT_FINAL_FILTER will filter list output after colorization, 72 | # priority hiding, context hiding, and project hiding. That is, 73 | # just before the list output is displayed. 74 | # 75 | # export TODOTXT_FINAL_FILTER='cat' 76 | -------------------------------------------------------------------------------- /plugins/available/osx.plugin.bash: -------------------------------------------------------------------------------- 1 | cite about-plugin 2 | about-plugin 'osx-specific functions' 3 | 4 | # OS X: Open new tabs in same directory 5 | if [ $(uname) = "Darwin" ]; then 6 | if type update_terminal_cwd > /dev/null 2>&1 ; then 7 | if ! [[ $PROMPT_COMMAND =~ (^|;)update_terminal_cwd($|;) ]] ; then 8 | export PROMPT_COMMAND="update_terminal_cwd;$PROMPT_COMMAND" 9 | fi 10 | fi 11 | fi 12 | 13 | function tab() { 14 | about 'opens a new terminal tab' 15 | group 'osx' 16 | 17 | osascript 2>/dev/null </dev/null 2>&1; then 5 | export TERM=gnome-256color 6 | elif infocmp xterm-256color >/dev/null 2>&1; then 7 | export TERM=xterm-256color 8 | fi 9 | 10 | 11 | # Detect whether a rebbot is required 12 | function show_reboot_required() { 13 | if [ ! -z "$_bf_prompt_reboot_info" ]; then 14 | if [ -f /var/run/reboot-required ]; then 15 | printf "Reboot required!" 16 | fi 17 | fi 18 | } 19 | 20 | 21 | # Set different host color for local and remote sessions 22 | function set_host_color() { 23 | # Detect if connection is through SSH 24 | if [[ ! -z $SSH_CLIENT ]]; then 25 | printf "${lime_yellow}" 26 | else 27 | printf "${light_orange}" 28 | fi 29 | } 30 | 31 | 32 | # Set different username color for users and root 33 | function set_user_color() { 34 | case $(id -u) in 35 | 0) 36 | printf "${red}" 37 | ;; 38 | *) 39 | printf "${cyan}" 40 | ;; 41 | esac 42 | } 43 | 44 | 45 | scm_prompt() { 46 | CHAR=$(scm_char) 47 | if [ $CHAR = $SCM_NONE_CHAR ] 48 | then 49 | return 50 | else 51 | echo "[$(scm_char)$(scm_prompt_info)]" 52 | fi 53 | } 54 | 55 | 56 | 57 | # Define custom colors we need 58 | # non-printable bytes in PS1 need to be contained within \[ \]. 59 | # Otherwise, bash will count them in the length of the prompt 60 | function set_custom_colors() { 61 | dark_grey="\[$(tput setaf 8)\]" 62 | light_grey="\[$(tput setaf 248)\]" 63 | 64 | light_orange="\[$(tput setaf 172)\]" 65 | bright_yellow="\[$(tput setaf 220)\]" 66 | lime_yellow="\[$(tput setaf 190)\]" 67 | 68 | powder_blue="\[$(tput setaf 153)\]" 69 | } 70 | 71 | 72 | function prompt_command() { 73 | ps_reboot="${bright_yellow}$(show_reboot_required)${normal}\n" 74 | ps_time="${dark_grey}\t${normal}\n" 75 | 76 | ps_username="$(set_user_color)\u${normal}" 77 | ps_uh_separator="${dark_grey}@${normal}" 78 | ps_hostname="$(set_host_color)\h${normal}" 79 | 80 | ps_path="${yellow}\w${normal}" 81 | ps_scm_prompt="${light_grey}$(scm_prompt)" 82 | 83 | ps_user_mark="${normal} ${normal}" 84 | ps_user_input="${normal}" 85 | 86 | # Set prompt 87 | PS1="$ps_reboot$ps_time$ps_username$ps_uh_separator$ps_hostname $ps_path $ps_scm_prompt$ps_user_mark$ps_user_input" 88 | } 89 | 90 | 91 | 92 | # Initialize custom colors 93 | set_custom_colors 94 | 95 | # scm theming 96 | SCM_THEME_PROMPT_PREFIX="" 97 | SCM_THEME_PROMPT_SUFFIX="" 98 | 99 | SCM_THEME_PROMPT_DIRTY=" ${bold_red}✗${light_grey}" 100 | SCM_THEME_PROMPT_CLEAN=" ${green}✓${light_grey}" 101 | SCM_GIT_CHAR="${green}±${light_grey}" 102 | SCM_SVN_CHAR="${bold_cyan}⑆${light_grey}" 103 | SCM_HG_CHAR="${bold_red}☿${light_grey}" 104 | 105 | PROMPT_COMMAND=prompt_command; 106 | -------------------------------------------------------------------------------- /plugins/available/dirs.plugin.bash: -------------------------------------------------------------------------------- 1 | # Directory stack navigation: 2 | # 3 | # Add to stack with: pu /path/to/directory 4 | # Delete current dir from stack with: po 5 | # Show stack with: d 6 | # Jump to location by number. 7 | 8 | cite about-plugin 9 | about-plugin 'directory stack navigation' 10 | 11 | # Show directory stack 12 | alias d="dirs -v -l" 13 | 14 | # Change to location in stack bu number 15 | alias 1="pushd" 16 | alias 2="pushd +2" 17 | alias 3="pushd +3" 18 | alias 4="pushd +4" 19 | alias 5="pushd +5" 20 | alias 6="pushd +6" 21 | alias 7="pushd +7" 22 | alias 8="pushd +8" 23 | alias 9="pushd +9" 24 | 25 | # Clone this location 26 | alias pc="pushd \$(pwd)" 27 | 28 | # Push new location 29 | alias pu="pushd" 30 | 31 | # Pop current location 32 | alias po="popd" 33 | 34 | function dirs-help() { 35 | about 'directory navigation alias usage' 36 | group 'dirs' 37 | 38 | echo "Directory Navigation Alias Usage" 39 | echo 40 | echo "Use the power of directory stacking to move" 41 | echo "between several locations with ease." 42 | echo 43 | echo "d : Show directory stack." 44 | echo "po : Remove current location from stack." 45 | echo "pc : Adds current location to stack." 46 | echo "pu : Adds given location to stack." 47 | echo "1 : Chance to stack location 1." 48 | echo "2 : Chance to stack location 2." 49 | echo "3 : Chance to stack location 3." 50 | echo "4 : Chance to stack location 4." 51 | echo "5 : Chance to stack location 5." 52 | echo "6 : Chance to stack location 6." 53 | echo "7 : Chance to stack location 7." 54 | echo "8 : Chance to stack location 8." 55 | echo "9 : Chance to stack location 9." 56 | } 57 | 58 | # ADD BOOKMARKing functionality 59 | # usage: 60 | 61 | if [ ! -f ~/.dirs ]; then # if doesn't exist, create it 62 | touch ~/.dirs 63 | else 64 | source ~/.dirs 65 | fi 66 | 67 | alias L='cat ~/.dirs' 68 | 69 | # goes to distination dir otherwise, stay in the dir 70 | G () { 71 | about 'goes to destination dir' 72 | param '1: directory' 73 | example '$ G ..' 74 | group 'dirs' 75 | 76 | cd "${1:-$(pwd)}" ; 77 | } 78 | 79 | S () { 80 | about 'save a bookmark' 81 | param '1: bookmark name' 82 | example '$ S mybkmrk' 83 | group 'dirs' 84 | 85 | [[ $# -eq 1 ]] || { echo "${FUNCNAME[0]} function requires 1 argument"; return 1; } 86 | 87 | sed "/$@/d" ~/.dirs > ~/.dirs1; 88 | \mv ~/.dirs1 ~/.dirs; 89 | echo "$@"=\"`pwd`\" >> ~/.dirs; 90 | source ~/.dirs ; 91 | } 92 | 93 | R () { 94 | about 'remove a bookmark' 95 | param '1: bookmark name' 96 | example '$ R mybkmrk' 97 | group 'dirs' 98 | 99 | [[ $# -eq 1 ]] || { echo "${FUNCNAME[0]} function requires 1 argument"; return 1; } 100 | 101 | sed "/$@/d" ~/.dirs > ~/.dirs1; 102 | \mv ~/.dirs1 ~/.dirs; 103 | } 104 | 105 | alias U='source ~/.dirs' # Update BOOKMARK stack 106 | # set the bash option so that no '$' is required when using the above facility 107 | shopt -s cdable_vars 108 | -------------------------------------------------------------------------------- /themes/rjorgenson/rjorgenson.theme.bash: -------------------------------------------------------------------------------- 1 | # port of zork theme 2 | 3 | # set colors for use throughout the prompt 4 | # i like things consistent 5 | BRACKET_COLOR=${blue} 6 | STRING_COLOR=${green} 7 | 8 | SCM_THEME_PROMPT_PREFIX="" 9 | SCM_THEME_PROMPT_SUFFIX="" 10 | 11 | SCM_THEME_PROMPT_DIRTY=" ${bold_red}✗${normal}" 12 | SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓${normal}" 13 | SCM_GIT_CHAR="${STRING_COLOR}±${normal}" 14 | SCM_SVN_CHAR="${bold_cyan}⑆${normal}" 15 | SCM_HG_CHAR="${bold_red}☿${normal}" 16 | 17 | #Mysql Prompt 18 | export MYSQL_PS1="(\u@\h) [\d]> " 19 | 20 | case $TERM in 21 | xterm*) 22 | TITLEBAR="\[\033]0;\w\007\]" 23 | ;; 24 | *) 25 | TITLEBAR="" 26 | ;; 27 | esac 28 | 29 | PS3=">> " 30 | 31 | __my_rvm_ruby_version() { 32 | local gemset=$(echo $GEM_HOME | awk -F'@' '{print $2}') 33 | [ "$gemset" != "" ] && gemset="@$gemset" 34 | local version=$(echo $MY_RUBY_HOME | awk -F'-' '{print $2}') 35 | local full="$version$gemset" 36 | [ "$full" != "" ] && echo "${BRACKET_COLOR}[${STRING_COLOR}$full${BRACKET_COLOR}]${normal}" 37 | } 38 | 39 | is_vim_shell() { 40 | if [ ! -z "$VIMRUNTIME" ] 41 | then 42 | echo "${BRACKET_COLOR}[${STRING_COLOR}vim shell${BRACKET_COLOR}]${normal}" 43 | fi 44 | } 45 | 46 | function is_integer() { # helper function for todo-txt-count 47 | [ "$1" -eq "$1" ] > /dev/null 2>&1 48 | return $? 49 | } 50 | 51 | todo_txt_count() { 52 | if `hash todo.sh 2>&-`; then # is todo.sh installed 53 | count=`todo.sh ls | egrep "TODO: [0-9]+ of ([0-9]+) tasks shown" | awk '{ print $4 }'` 54 | if is_integer $count; then # did we get a sane answer back 55 | echo "${BRACKET_COLOR}[${STRING_COLOR}T:$count${BRACKET_COLOR}]$normal" 56 | fi 57 | fi 58 | } 59 | 60 | modern_scm_prompt() { 61 | CHAR=$(scm_char) 62 | if [ $CHAR = $SCM_NONE_CHAR ] 63 | then 64 | return 65 | else 66 | echo "${BRACKET_COLOR}[${CHAR}${BRACKET_COLOR}][${STRING_COLOR}$(scm_prompt_info)${BRACKET_COLOR}]$normal" 67 | fi 68 | } 69 | 70 | my_prompt_char() { 71 | if [[ $OSTYPE =~ "darwin" ]]; then 72 | echo "${BRACKET_COLOR}➞ ${normal}" 73 | else 74 | echo "${BRACKET_COLOR}➞ ${normal}" 75 | fi 76 | } 77 | 78 | prompt() { 79 | 80 | my_ps_host="${STRING_COLOR}\h${normal}"; 81 | my_ps_user="${STRING_COLOR}\u${normal}"; 82 | my_ps_root="${bold_red}\u${normal}"; 83 | my_ps_path="${STRING_COLOR}\w${normal}"; 84 | 85 | # nice prompt 86 | case "`id -u`" in 87 | 0) PS1="${TITLEBAR}${BRACKET_COLOR}┌─[$my_ps_root${BRACKET_COLOR}][$my_ps_host${BRACKET_COLOR}]$(modern_scm_prompt)$(__my_rvm_ruby_version)${BRACKET_COLOR}[${STRING_COLOR}\w${BRACKET_COLOR}]$(is_vim_shell) 88 | ${BRACKET_COLOR}└─$(my_prompt_char)${normal}" 89 | ;; 90 | *) PS1="${TITLEBAR}${BRACKET_COLOR}┌─[$my_ps_user${BRACKET_COLOR}][$my_ps_host${BRACKET_COLOR}]$(modern_scm_prompt)$(__my_rvm_ruby_version)${BRACKET_COLOR}[${STRING_COLOR}\w${BRACKET_COLOR}]$(is_vim_shell) 91 | ${BRACKET_COLOR}└─$(todo_txt_count)$(my_prompt_char)" 92 | ;; 93 | esac 94 | } 95 | 96 | PS2="└─$(my_prompt_char)" 97 | 98 | 99 | 100 | PROMPT_COMMAND=prompt 101 | -------------------------------------------------------------------------------- /themes/powerline-naked/powerline-naked.theme.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | THEME_PROMPT_SEPARATOR="" 4 | 5 | SHELL_SSH_CHAR=" " 6 | SHELL_THEME_PROMPT_COLOR=32 7 | SHELL_SSH_THEME_PROMPT_COLOR=208 8 | 9 | VIRTUALENV_CHAR="ⓔ " 10 | VIRTUALENV_THEME_PROMPT_COLOR=35 11 | 12 | SCM_NONE_CHAR="" 13 | SCM_GIT_CHAR=" " 14 | 15 | SCM_THEME_PROMPT_CLEAN="" 16 | SCM_THEME_PROMPT_DIRTY="" 17 | 18 | SCM_THEME_PROMPT_COLOR=238 19 | SCM_THEME_PROMPT_CLEAN_COLOR=231 20 | SCM_THEME_PROMPT_DIRTY_COLOR=196 21 | SCM_THEME_PROMPT_STAGED_COLOR=220 22 | SCM_THEME_PROMPT_UNSTAGED_COLOR=166 23 | 24 | CWD_THEME_PROMPT_COLOR=240 25 | 26 | LAST_STATUS_THEME_PROMPT_COLOR=124 27 | 28 | function set_rgb_color { 29 | if [[ "${1}" != "-" ]]; then 30 | fg="38;5;${1}" 31 | fi 32 | if [[ "${2}" != "-" ]]; then 33 | bg="48;5;${2}" 34 | [[ -n "${fg}" ]] && bg=";${bg}" 35 | fi 36 | echo -e "\[\033[${fg}${bg}m\]" 37 | } 38 | 39 | function powerline_shell_prompt { 40 | if [[ -n "${SSH_CLIENT}" ]]; then 41 | SHELL_PROMPT="${bold_white} ${SHELL_SSH_CHAR}\u@\h ${normal}" 42 | else 43 | SHELL_PROMPT="${bold_white} \u ${normal}" 44 | fi 45 | } 46 | 47 | function powerline_virtualenv_prompt { 48 | local environ="" 49 | 50 | if [[ -n "$CONDA_DEFAULT_ENV" ]]; then 51 | environ="conda: $CONDA_DEFAULT_ENV" 52 | elif [[ -n "$VIRTUAL_ENV" ]]; then 53 | environ=$(basename "$VIRTUAL_ENV") 54 | fi 55 | 56 | if [[ -n "$environ" ]]; then 57 | VIRTUALENV_PROMPT="${THEME_PROMPT_SEPARATOR}$(set_rgb_color ${VIRTUALENV_THEME_PROMPT_COLOR} -) ${VIRTUALENV_CHAR}$environ ${normal}" 58 | else 59 | VIRTUALENV_PROMPT="" 60 | fi 61 | } 62 | 63 | function powerline_scm_prompt { 64 | scm_prompt_vars 65 | 66 | if [[ "${SCM_NONE_CHAR}" != "${SCM_CHAR}" ]]; then 67 | if [[ "${SCM_DIRTY}" -eq 3 ]]; then 68 | SCM_PROMPT="$(set_rgb_color ${SCM_THEME_PROMPT_STAGED_COLOR} -)" 69 | elif [[ "${SCM_DIRTY}" -eq 2 ]]; then 70 | SCM_PROMPT="$(set_rgb_color ${SCM_THEME_PROMPT_UNSTAGED_COLOR} -)" 71 | elif [[ "${SCM_DIRTY}" -eq 1 ]]; then 72 | SCM_PROMPT="$(set_rgb_color ${SCM_THEME_PROMPT_DIRTY_COLOR} -)" 73 | else 74 | SCM_PROMPT="$(set_rgb_color ${SCM_THEME_PROMPT_CLEAN_COLOR} -)" 75 | fi 76 | if [[ "${SCM_GIT_CHAR}" == "${SCM_CHAR}" ]]; then 77 | SCM_PROMPT+=" ${SCM_CHAR}${SCM_BRANCH}${SCM_STATE} " 78 | fi 79 | SCM_PROMPT="${THEME_PROMPT_SEPARATOR}${SCM_PROMPT}${normal}" 80 | else 81 | SCM_PROMPT="" 82 | fi 83 | } 84 | 85 | function powerline_cwd_prompt { 86 | CWD_PROMPT="${THEME_PROMPT_SEPARATOR} \w " 87 | } 88 | 89 | function powerline_last_status_prompt { 90 | if [[ "$1" -eq 0 ]]; then 91 | LAST_STATUS_PROMPT="${THEME_PROMPT_SEPARATOR}" 92 | else 93 | LAST_STATUS_PROMPT="${THEME_PROMPT_SEPARATOR}$(set_rgb_color ${LAST_STATUS_THEME_PROMPT_COLOR} -) ${LAST_STATUS} ${normal}${THEME_PROMPT_SEPARATOR}" 94 | fi 95 | } 96 | 97 | function powerline_prompt_command() { 98 | local LAST_STATUS="$?" 99 | 100 | powerline_shell_prompt 101 | powerline_virtualenv_prompt 102 | powerline_scm_prompt 103 | powerline_cwd_prompt 104 | powerline_last_status_prompt LAST_STATUS 105 | 106 | PS1="${SHELL_PROMPT}${VIRTUALENV_PROMPT}${SCM_PROMPT}${CWD_PROMPT}${LAST_STATUS_PROMPT} " 107 | } 108 | 109 | PROMPT_COMMAND=powerline_prompt_command 110 | 111 | -------------------------------------------------------------------------------- /themes/dulcie/dulcie.theme.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Simplistic one-liner theme to display source control management info beside 4 | # the ordinary Linux bash prompt. 5 | # 6 | # Demo: 7 | # 8 | # [ritola@localhost ~]$ cd .bash-it/themes/dulcie 9 | # [ritola@localhost |master ✓| dulcie]$ # This is single line mode 10 | # |bash-it|± master ✓| 11 | # [ritola@localhost dulcie]$ # In multi line, the SCM info is in the separate line 12 | # 13 | # Configuration. Change these by adding them in your .bash_profile 14 | 15 | DULCIE_COLOR=${DULCIE_COLOR:=1} # 0 = monochrome, 1 = colorful 16 | DULCIE_MULTILINE=${DULCIE_MULTILINE:=1} # 0 = Single line, 1 = SCM in separate line 17 | 18 | dulcie_color() { 19 | echo -en "\[\e[38;5;${1}m\]" 20 | } 21 | 22 | dulcie_background() { 23 | echo -en "\[\e[48;5;${1}m\]" 24 | } 25 | 26 | dulcie_prompt() { 27 | color_user_root=$(dulcie_color 169) 28 | color_user_nonroot="${green}" 29 | color_host_local=$(dulcie_color 230) 30 | color_host_remote=$(dulcie_color 214) 31 | color_rootdir=$(dulcie_color 117) 32 | color_workingdir=$(dulcie_color 117) 33 | background_scm=$(dulcie_background 238) 34 | 35 | SCM_THEME_ROOT_SUFFIX="|$(scm_char) " 36 | 37 | # Set colors 38 | if [ "${DULCIE_COLOR}" -eq "1" ]; then 39 | if [[ $EUID -ne 0 ]]; then 40 | color_user="${color_user_nonroot}" 41 | else 42 | color_user="${color_user_root}" 43 | fi 44 | 45 | if [[ -n "${SSH_CLIENT}" ]]; then 46 | color_host="${color_host_remote}" 47 | else 48 | color_host="${color_host_local}" 49 | fi 50 | 51 | DULCIE_USER="${color_user}\u${reset_color}" 52 | DULCIE_HOST="${color_host}\h${reset_color}" 53 | DULCIE_WORKINGDIR="${color_workingdir}\W${reset_color}" 54 | DULCIE_PROMPTCHAR="${color_user}"'\$'"${reset_color}" 55 | 56 | SCM_THEME_PROMPT_DIRTY=" ${red}✗${reset_color}" 57 | SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓${normal}" 58 | DULCIE_SCM_BACKGROUND="${background_scm}" 59 | DULCIE_SCM_DIR_COLOR="${color_rootdir}" 60 | SCM_THEME_ROOT_SUFFIX="${reset_color}${SCM_THEME_ROOT_SUFFIX}" 61 | SCM_THEME_PROMPT_DIRTY=" $(dulcie_color 1)✗${reset_color}" 62 | SCM_THEME_PROMPT_CLEAN=" $(dulcie_color 10)✓${reset_color}" 63 | else 64 | DULCIE_USER='\u' 65 | DULCIE_HOST='\h' 66 | DULCIE_WORKINGDIR='\W' 67 | DULCIE_PROMPTCHAR='\$' 68 | 69 | DULCIE_SCM_BACKGROUND="" 70 | DULCIE_SCM_DIR_COLOR="" 71 | SCM_THEME_DIR_COLOR="" 72 | SCM_THEME_PROMPT_DIRTY=" ✗" 73 | SCM_THEME_PROMPT_CLEAN=" ✓" 74 | fi 75 | 76 | # Change terminal title 77 | printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/\~}" 78 | 79 | # Open the new terminal in the same directory 80 | declare -f __vte_osc7 > /dev/null && __vte_osc7 81 | 82 | PS1="${reset_color}[${DULCIE_USER}@${DULCIE_HOST}$(scm_prompt_info)${reset_color} ${DULCIE_WORKINGDIR}]" 83 | if [[ "${DULCIE_MULTILINE}" -eq "1" ]]; then 84 | PS1="${reset_color}[${DULCIE_USER}@${DULCIE_HOST}${reset_color} ${DULCIE_WORKINGDIR}]" 85 | if [[ "$(scm_prompt_info)" ]]; then 86 | SCM_THEME_PROMPT_PREFIX="${DULCIE_SCM_BACKGROUND}|${DULCIE_SCM_DIR_COLOR}" 87 | SCM_THEME_PROMPT_SUFFIX="|${normal}" 88 | PS1="$(scm_prompt_info)\n${PS1}" 89 | fi 90 | else 91 | SCM_THEME_PROMPT_PREFIX=" ${DULCIE_SCM_BACKGROUND}|${DULCIE_SCM_DIR_COLOR}" 92 | SCM_THEME_PROMPT_SUFFIX="|${normal}" 93 | PS1="${reset_color}[${DULCIE_USER}@${DULCIE_HOST}$(scm_prompt_info)${reset_color} ${DULCIE_WORKINGDIR}]" 94 | fi 95 | PS1="${PS1}${DULCIE_PROMPTCHAR} " 96 | } 97 | 98 | PROMPT_COMMAND=dulcie_prompt 99 | -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | BASH_IT="$(cd "$(dirname "$0")" && pwd)" 3 | 4 | case $OSTYPE in 5 | darwin*) 6 | CONFIG_FILE=.bash_profile 7 | ;; 8 | *) 9 | CONFIG_FILE=.bashrc 10 | ;; 11 | esac 12 | 13 | BACKUP_FILE=$CONFIG_FILE.bak 14 | 15 | if [ -e "$HOME/$BACKUP_FILE" ]; then 16 | echo -e "\033[0;33mBackup file already exists. Make sure to backup your .bashrc before running this installation.\033[0m" >&2 17 | while true 18 | do 19 | read -e -n 1 -r -p "Would you like to overwrite the existing backup? This will delete your existing backup file ($HOME/$BACKUP_FILE) [y/N] " RESP 20 | case $RESP in 21 | [yY]) 22 | break 23 | ;; 24 | [nN]|"") 25 | echo -e "\033[91mInstallation aborted. Please come back soon!\033[m" 26 | exit 1 27 | ;; 28 | *) 29 | echo -e "\033[91mPlease choose y or n.\033[m" 30 | ;; 31 | esac 32 | done 33 | fi 34 | 35 | test -w "$HOME/$CONFIG_FILE" && 36 | cp -a "$HOME/$CONFIG_FILE" "$HOME/$CONFIG_FILE.bak" && 37 | echo -e "\033[0;32mYour original $CONFIG_FILE has been backed up to $CONFIG_FILE.bak\033[0m" 38 | 39 | sed "s|{{BASH_IT}}|$BASH_IT|" "$BASH_IT/template/bash_profile.template.bash" > "$HOME/$CONFIG_FILE" 40 | 41 | echo -e "\033[0;32mCopied the template $CONFIG_FILE into ~/$CONFIG_FILE, edit this file to customize bash-it\033[0m" 42 | 43 | function load_one() { 44 | file_type=$1 45 | file_to_enable=$2 46 | mkdir -p "$BASH_IT/${file_type}/enabled" 47 | 48 | dest="${BASH_IT}/${file_type}/enabled/${file_to_enable}" 49 | if [ ! -e "${dest}" ]; then 50 | ln -sf "../available/${file_to_enable}" "${dest}" 51 | else 52 | echo "File ${dest} exists, skipping" 53 | fi 54 | } 55 | 56 | function load_some() { 57 | file_type=$1 58 | [ -d "$BASH_IT/$file_type/enabled" ] || mkdir "$BASH_IT/$file_type/enabled" 59 | for path in `ls $BASH_IT/${file_type}/available/[^_]*` 60 | do 61 | file_name=$(basename "$path") 62 | while true 63 | do 64 | read -e -n 1 -p "Would you like to enable the ${file_name%%.*} $file_type? [y/N] " RESP 65 | case $RESP in 66 | [yY]) 67 | ln -s "../available/${file_name}" "$BASH_IT/$file_type/enabled" 68 | break 69 | ;; 70 | [nN]|"") 71 | break 72 | ;; 73 | *) 74 | echo -e "\033[91mPlease choose y or n.\033[m" 75 | ;; 76 | esac 77 | done 78 | done 79 | } 80 | 81 | if [[ "$1" == "--interactive" ]] 82 | then 83 | for type in "aliases" "plugins" "completion" 84 | do 85 | echo -e "\033[0;32mEnabling $type\033[0m" 86 | load_some $type 87 | done 88 | else 89 | echo "" 90 | echo -e "\033[0;32mEnabling sane defaults\033[0m" 91 | load_one completion bash-it.completion.bash 92 | load_one plugins alias-completion.plugin.bash 93 | load_one aliases general.aliases.bash 94 | fi 95 | 96 | echo "" 97 | echo -e "\033[0;32mInstallation finished successfully! Enjoy bash-it!\033[0m" 98 | echo -e "\033[0;32mTo start using it, open a new tab or 'source "$HOME/$CONFIG_FILE"'.\033[0m" 99 | echo "" 100 | echo "To show the available aliases/completions/plugins, type one of the following:" 101 | echo " bash-it show aliases" 102 | echo " bash-it show completions" 103 | echo " bash-it show plugins" 104 | echo "" 105 | echo "To avoid issues and to keep your shell lean, please enable only features you really want to use." 106 | echo "Enabling everything can lead to issues." 107 | -------------------------------------------------------------------------------- /plugins/available/aws.plugin.bash: -------------------------------------------------------------------------------- 1 | cite about-plugin 2 | about-plugin 'AWS helper functions' 3 | 4 | function awskeys { 5 | about 'helper function for AWS credentials file' 6 | group 'aws' 7 | 8 | if [[ ! -f ~/.aws/credentials ]]; then 9 | echo "AWS credentials file not found" 10 | return 1 11 | fi 12 | 13 | if [[ $# -eq 1 ]] && [[ "$1" = "list" ]]; then 14 | __awskeys_list "$2" 15 | elif [[ $# -eq 1 ]] && [[ "$1" = "unset" ]]; then 16 | __awskeys_unset "$2" 17 | elif [[ $# -eq 2 ]] && [[ "$1" = "show" ]]; then 18 | __awskeys_show "$2" 19 | elif [[ $# -eq 2 ]] && [[ "$1" = "export" ]]; then 20 | __awskeys_export "$2" 21 | else 22 | __awskeys_help 23 | fi 24 | } 25 | 26 | function __awskeys_help { 27 | echo -e "Usage: awskeys [COMMAND] [profile]\n" 28 | echo -e "Helper to AWS credentials file.\n" 29 | echo -e "Commands:\n" 30 | echo " help Show this help message" 31 | echo " list List available AWS credentials profiles" 32 | echo " show Show the AWS keys associated to a credentials profile" 33 | echo " export Export an AWS credentials profile keys as environment variables" 34 | echo " unset Unset the AWS keys variables from the environment" 35 | } 36 | 37 | function __awskeys_get { 38 | local ln=$(grep -n "\[ *$1 *\]" ~/.aws/credentials | cut -d ":" -f 1) 39 | if [[ -n "${ln}" ]]; then 40 | tail -n +${ln} ~/.aws/credentials | egrep -m 2 "aws_access_key_id|aws_secret_access_key" 41 | fi 42 | } 43 | 44 | function __awskeys_list { 45 | local credentials_list="$(egrep '^\[ *[a-zA-Z0-9_-]+ *\]$' ~/.aws/credentials)" 46 | if [[ -n $"{credentials_list}" ]]; then 47 | echo -e "Available credentials profiles:\n" 48 | for profile in ${credentials_list}; do 49 | echo " $(echo ${profile} | tr -d "[]")" 50 | done 51 | echo 52 | else 53 | echo "No profiles found in credentials file" 54 | fi 55 | } 56 | 57 | function __awskeys_show { 58 | local p_keys="$(__awskeys_get $1)" 59 | if [[ -n "${p_keys}" ]]; then 60 | echo "${p_keys}" 61 | else 62 | echo "Profile $1 not found in credentials file" 63 | fi 64 | } 65 | 66 | function __awskeys_export { 67 | local p_keys=( $(__awskeys_get $1 | tr -d " ") ) 68 | if [[ -n "${p_keys}" ]]; then 69 | for p_key in ${p_keys[@]}; do 70 | local key="${p_key%=*}" 71 | export "$(echo ${key} | tr [:lower:] [:upper:])=${p_key#*=}" 72 | done 73 | export AWS_DEFAULT_PROFILE="$1" 74 | else 75 | echo "Profile $1 not found in credentials file" 76 | fi 77 | } 78 | 79 | function __awskeys_unset { 80 | unset AWS_DEFAULT_PROFILE AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY 81 | } 82 | 83 | function __awskeys_comp { 84 | local cur prev opts prevprev 85 | COMPREPLY=() 86 | cur="${COMP_WORDS[COMP_CWORD]}" 87 | prev="${COMP_WORDS[COMP_CWORD-1]}" 88 | 89 | opts="help list show export unset" 90 | 91 | case "${prev}" in 92 | help|list|unset) 93 | return 0 94 | ;; 95 | show|export) 96 | local profile_list="$(__awskeys_list | grep " ")" 97 | COMPREPLY=( $(compgen -W "${profile_list}" -- ${cur}) ) 98 | return 0 99 | ;; 100 | esac 101 | 102 | COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) 103 | 104 | return 0 105 | } 106 | 107 | complete -F __awskeys_comp awskeys 108 | -------------------------------------------------------------------------------- /themes/powerline-plain/powerline-plain.theme.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | SHELL_SSH_CHAR="⌁ " 4 | SHELL_THEME_PROMPT_COLOR=32 5 | SHELL_SSH_THEME_PROMPT_COLOR=208 6 | 7 | VIRTUALENV_CHAR="ⓔ " 8 | VIRTUALENV_THEME_PROMPT_COLOR=35 9 | 10 | SCM_NONE_CHAR="" 11 | SCM_GIT_CHAR="⎇ " 12 | 13 | SCM_THEME_PROMPT_CLEAN="" 14 | SCM_THEME_PROMPT_DIRTY="" 15 | 16 | SCM_THEME_PROMPT_COLOR=238 17 | SCM_THEME_PROMPT_CLEAN_COLOR=231 18 | SCM_THEME_PROMPT_DIRTY_COLOR=196 19 | SCM_THEME_PROMPT_STAGED_COLOR=220 20 | SCM_THEME_PROMPT_UNSTAGED_COLOR=166 21 | 22 | CWD_THEME_PROMPT_COLOR=240 23 | 24 | LAST_STATUS_THEME_PROMPT_COLOR=52 25 | 26 | function set_rgb_color { 27 | if [[ "${1}" != "-" ]]; then 28 | fg="38;5;${1}" 29 | fi 30 | if [[ "${2}" != "-" ]]; then 31 | bg="48;5;${2}" 32 | [[ -n "${fg}" ]] && bg=";${bg}" 33 | fi 34 | echo -e "\[\033[${fg}${bg}m\]" 35 | } 36 | 37 | function powerline_shell_prompt { 38 | if [[ -n "${SSH_CLIENT}" ]]; then 39 | SHELL_PROMPT="${bold_white}$(set_rgb_color - ${SHELL_SSH_THEME_PROMPT_COLOR}) ${SHELL_SSH_CHAR}\u@\h ${normal}" 40 | else 41 | SHELL_PROMPT="${bold_white}$(set_rgb_color - ${SHELL_THEME_PROMPT_COLOR}) \u ${normal}" 42 | fi 43 | } 44 | 45 | function powerline_virtualenv_prompt { 46 | local environ="" 47 | 48 | if [[ -n "$CONDA_DEFAULT_ENV" ]]; then 49 | environ="conda: $CONDA_DEFAULT_ENV" 50 | elif [[ -n "$VIRTUAL_ENV" ]]; then 51 | environ=$(basename "$VIRTUAL_ENV") 52 | fi 53 | 54 | if [[ -n "$environ" ]]; then 55 | VIRTUALENV_PROMPT="$(set_rgb_color ${LAST_THEME_COLOR} ${VIRTUALENV_THEME_PROMPT_COLOR})${THEME_PROMPT_SEPARATOR}${normal}$(set_rgb_color - ${VIRTUALENV_THEME_PROMPT_COLOR}) ${VIRTUALENV_CHAR}$environ ${normal}" 56 | LAST_THEME_COLOR=${VIRTUALENV_THEME_PROMPT_COLOR} 57 | else 58 | VIRTUALENV_PROMPT="" 59 | fi 60 | } 61 | 62 | function powerline_scm_prompt { 63 | scm_prompt_vars 64 | 65 | if [[ "${SCM_NONE_CHAR}" != "${SCM_CHAR}" ]]; then 66 | if [[ "${SCM_DIRTY}" -eq 3 ]]; then 67 | SCM_PROMPT="$(set_rgb_color ${SCM_THEME_PROMPT_STAGED_COLOR} ${SCM_THEME_PROMPT_COLOR})" 68 | elif [[ "${SCM_DIRTY}" -eq 2 ]]; then 69 | SCM_PROMPT="$(set_rgb_color ${SCM_THEME_PROMPT_UNSTAGED_COLOR} ${SCM_THEME_PROMPT_COLOR})" 70 | elif [[ "${SCM_DIRTY}" -eq 1 ]]; then 71 | SCM_PROMPT="$(set_rgb_color ${SCM_THEME_PROMPT_DIRTY_COLOR} ${SCM_THEME_PROMPT_COLOR})" 72 | else 73 | SCM_PROMPT="$(set_rgb_color ${SCM_THEME_PROMPT_CLEAN_COLOR} ${SCM_THEME_PROMPT_COLOR})" 74 | fi 75 | if [[ "${SCM_GIT_CHAR}" == "${SCM_CHAR}" ]]; then 76 | SCM_PROMPT+=" ${SCM_CHAR}${SCM_BRANCH}${SCM_STATE} " 77 | fi 78 | SCM_PROMPT="${SCM_PROMPT}${normal}" 79 | else 80 | SCM_PROMPT="" 81 | fi 82 | } 83 | 84 | function powerline_cwd_prompt { 85 | CWD_PROMPT="${THEME_PROMPT_SEPARATOR}${normal}$(set_rgb_color - ${CWD_THEME_PROMPT_COLOR}) \w ${normal}$(set_rgb_color ${CWD_THEME_PROMPT_COLOR} -)${normal}" 86 | } 87 | 88 | function powerline_last_status_prompt { 89 | if [[ "$1" -eq 0 ]]; then 90 | LAST_STATUS_PROMPT="" 91 | else 92 | LAST_STATUS_PROMPT="$(set_rgb_color - ${LAST_STATUS_THEME_PROMPT_COLOR}) ${LAST_STATUS} ${normal}$(set_rgb_color ${LAST_STATUS_THEME_PROMPT_COLOR} -)${THEME_PROMPT_SEPARATOR}${normal}" 93 | fi 94 | } 95 | 96 | function powerline_prompt_command() { 97 | local LAST_STATUS="$?" 98 | 99 | powerline_shell_prompt 100 | powerline_virtualenv_prompt 101 | powerline_scm_prompt 102 | powerline_cwd_prompt 103 | powerline_last_status_prompt LAST_STATUS 104 | 105 | PS1="${SHELL_PROMPT}${VIRTUALENV_PROMPT}${SCM_PROMPT}${CWD_PROMPT}${LAST_STATUS_PROMPT} " 106 | } 107 | 108 | PROMPT_COMMAND=powerline_prompt_command 109 | 110 | -------------------------------------------------------------------------------- /themes/demula/demula.theme.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Theme inspired on: 4 | # - Ronacher's dotfiles (mitsuhikos) - http://github.com/mitsuhiko/dotfiles/tree/master/bash/ 5 | # - Glenbot - http://theglenbot.com/custom-bash-shell-for-development/ 6 | # - My extravagant zsh - http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/ 7 | # - Monokai colors - http://monokai.nl/blog/2006/07/15/textmate-color-theme/ 8 | # - Bash_it modern theme 9 | # 10 | # Screenshot: http://goo.gl/VCmX5 11 | # by Jesus de Mula 12 | 13 | # For the real Monokai colors you should add these to your .XDefaults or 14 | # terminal configuration: 15 | #! ----------------------------------------------------------- TERMINAL COLORS 16 | #! monokai - http://www.monokai.nl/blog/2006/07/15/textmate-color-theme/ 17 | #*background: #272822 18 | #*foreground: #E2DA6E 19 | #*color0: black 20 | #! mild red 21 | #*color1: #CD0000 22 | #! light green 23 | #*color2: #A5E02D 24 | #! orange (yellow) 25 | #*color3: #FB951F 26 | #! "dark" blue 27 | #*color4: #076BCC 28 | #! hot pink 29 | #*color5: #F6266C 30 | #! cyan 31 | #*color6: #64D9ED 32 | #! gray 33 | #*color7: #E5E5E5 34 | 35 | # ----------------------------------------------------------------- COLOR CONF 36 | D_DEFAULT_COLOR="${normal}" 37 | D_INTERMEDIATE_COLOR="${white}" 38 | D_USER_COLOR="${purple}" 39 | D_SUPERUSER_COLOR="${red}" 40 | D_MACHINE_COLOR="${cyan}" 41 | D_DIR_COLOR="${green}" 42 | D_SCM_COLOR="${yellow}" 43 | D_BRANCH_COLOR="${yellow}" 44 | D_CHANGES_COLOR="${white}" 45 | D_CMDFAIL_COLOR="${red}" 46 | D_VIMSHELL_COLOR="${cyan}" 47 | 48 | # ------------------------------------------------------------------ FUNCTIONS 49 | case $TERM in 50 | xterm*) 51 | TITLEBAR="\033]0;\w\007" 52 | ;; 53 | *) 54 | TITLEBAR="" 55 | ;; 56 | esac 57 | 58 | is_vim_shell() { 59 | if [ ! -z "$VIMRUNTIME" ]; 60 | then 61 | echo "${D_INTERMEDIATE_COLOR}on ${D_VIMSHELL_COLOR}\ 62 | vim shell${D_DEFAULT_COLOR} " 63 | fi 64 | } 65 | 66 | mitsuhikos_lastcommandfailed() { 67 | code=$? 68 | if [ $code != 0 ]; 69 | then 70 | echo "${D_INTERMEDIATE_COLOR}exited ${D_CMDFAIL_COLOR}\ 71 | $code ${D_DEFAULT_COLOR}" 72 | fi 73 | } 74 | 75 | # vcprompt for scm instead of bash_it default 76 | demula_vcprompt() { 77 | if [ ! -z "$VCPROMPT_EXECUTABLE" ]; 78 | then 79 | local D_VCPROMPT_FORMAT="on ${D_SCM_COLOR}%s${D_INTERMEDIATE_COLOR}:\ 80 | ${D_BRANCH_COLOR}%b %r ${D_CHANGES_COLOR}%m%u ${D_DEFAULT_COLOR}" 81 | $VCPROMPT_EXECUTABLE -f "$D_VCPROMPT_FORMAT" 82 | fi 83 | } 84 | 85 | # checks if the plugin is installed before calling battery_charge 86 | safe_battery_charge() { 87 | if [ -e "${BASH_IT}/plugins/enabled/battery.plugin.bash" ]; 88 | then 89 | battery_charge 90 | fi 91 | } 92 | 93 | # -------------------------------------------------------------- PROMPT OUTPUT 94 | prompt() { 95 | local LAST_COMMAND_FAILED=$(mitsuhikos_lastcommandfailed) 96 | local SAVE_CURSOR='\033[s' 97 | local RESTORE_CURSOR='\033[u' 98 | local MOVE_CURSOR_RIGHTMOST='\033[500C' 99 | local MOVE_CURSOR_5_LEFT='\033[5D' 100 | 101 | if [ $(uname) = "Linux" ]; 102 | then 103 | PS1="${TITLEBAR} 104 | ${SAVE_CURSOR}${MOVE_CURSOR_RIGHTMOST}${MOVE_CURSOR_5_LEFT}\ 105 | $(safe_battery_charge)${RESTORE_CURSOR}\ 106 | ${D_USER_COLOR}\u ${D_INTERMEDIATE_COLOR}\ 107 | at ${D_MACHINE_COLOR}\h ${D_INTERMEDIATE_COLOR}\ 108 | in ${D_DIR_COLOR}\w ${D_INTERMEDIATE_COLOR}\ 109 | ${LAST_COMMAND_FAILED}\ 110 | $(demula_vcprompt)\ 111 | $(is_vim_shell) 112 | ${D_INTERMEDIATE_COLOR}$ ${D_DEFAULT_COLOR}" 113 | else 114 | PS1="${TITLEBAR} 115 | ${D_USER_COLOR}\u ${D_INTERMEDIATE_COLOR}\ 116 | at ${D_MACHINE_COLOR}\h ${D_INTERMEDIATE_COLOR}\ 117 | in ${D_DIR_COLOR}\w ${D_INTERMEDIATE_COLOR}\ 118 | ${LAST_COMMAND_FAILED}\ 119 | $(demula_vcprompt)\ 120 | $(is_vim_shell)\ 121 | $(safe_battery_charge) 122 | ${D_INTERMEDIATE_COLOR}$ ${D_DEFAULT_COLOR}" 123 | fi 124 | 125 | PS2="${D_INTERMEDIATE_COLOR}$ ${D_DEFAULT_COLOR}" 126 | } 127 | 128 | # Runs prompt (this bypasses bash_it $PROMPT setting) 129 | PROMPT_COMMAND=prompt 130 | 131 | -------------------------------------------------------------------------------- /plugins/available/alias-completion.plugin.bash: -------------------------------------------------------------------------------- 1 | cite about-plugin 2 | about-plugin 'Automatic completion of aliases' 3 | 4 | # References: 5 | # http://superuser.com/a/437508/119764 6 | # http://stackoverflow.com/a/1793178/1228454 7 | 8 | # This needs to be a plugin so it gets executed after the completions and the aliases have been defined. 9 | # Bash-it loads its components in the order 10 | # 1) Aliases 11 | # 2) Completions 12 | # 3) Plugins 13 | # 4) Custom scripts 14 | 15 | # Automatically add completion for all aliases to commands having completion functions 16 | function alias_completion { 17 | local namespace="alias_completion" 18 | 19 | # parse function based completion definitions, where capture group 2 => function and 3 => trigger 20 | local compl_regex='complete( +[^ ]+)* -F ([^ ]+) ("[^"]+"|[^ ]+)' 21 | # parse alias definitions, where capture group 1 => trigger, 2 => command, 3 => command arguments 22 | local alias_regex="alias ([^=]+)='(\"[^\"]+\"|[^ ]+)(( +[^ ]+)*)'" 23 | 24 | # create array of function completion triggers, keeping multi-word triggers together 25 | eval "local completions=($(complete -p | sed -Ene "/$compl_regex/s//'\3'/p"))" 26 | (( ${#completions[@]} == 0 )) && return 0 27 | 28 | # create temporary file for wrapper functions and completions 29 | rm -f "/tmp/${namespace}-*.tmp" # preliminary cleanup 30 | local tmp_file; tmp_file="$(mktemp "/tmp/${namespace}-${RANDOM}XXX.tmp")" || return 1 31 | 32 | local completion_loader; completion_loader="$(complete -p -D 2>/dev/null | sed -Ene 's/.* -F ([^ ]*).*/\1/p')" 33 | 34 | # read in " '' ''" lines from defined aliases 35 | local line; while read line; do 36 | eval "local alias_tokens; alias_tokens=($line)" 2>/dev/null || continue # some alias arg patterns cause an eval parse error 37 | local alias_name="${alias_tokens[0]}" alias_cmd="${alias_tokens[1]}" alias_args="${alias_tokens[2]# }" 38 | 39 | # skip aliases to pipes, boolean control structures and other command lists 40 | # (leveraging that eval errs out if $alias_args contains unquoted shell metacharacters) 41 | eval "local alias_arg_words; alias_arg_words=($alias_args)" 2>/dev/null || continue 42 | # avoid expanding wildcards 43 | read -a alias_arg_words <<< "$alias_args" 44 | 45 | # skip alias if there is no completion function triggered by the aliased command 46 | if [[ ! " ${completions[*]} " =~ " $alias_cmd " ]]; then 47 | if [[ -n "$completion_loader" ]]; then 48 | # force loading of completions for the aliased command 49 | eval "$completion_loader $alias_cmd" 50 | # 124 means completion loader was successful 51 | [[ $? -eq 124 ]] || continue 52 | completions+=($alias_cmd) 53 | else 54 | continue 55 | fi 56 | fi 57 | local new_completion="$(complete -p "$alias_cmd")" 58 | 59 | # create a wrapper inserting the alias arguments if any 60 | if [[ -n $alias_args ]]; then 61 | local compl_func="${new_completion/#* -F /}"; compl_func="${compl_func%% *}" 62 | # avoid recursive call loops by ignoring our own functions 63 | if [[ "${compl_func#_$namespace::}" == $compl_func ]]; then 64 | local compl_wrapper="_${namespace}::${alias_name}" 65 | echo "function $compl_wrapper { 66 | (( COMP_CWORD += ${#alias_arg_words[@]} )) 67 | COMP_WORDS=($alias_cmd $alias_args \${COMP_WORDS[@]:1}) 68 | (( COMP_POINT -= \${#COMP_LINE} )) 69 | COMP_LINE=\${COMP_LINE/$alias_name/$alias_cmd $alias_args} 70 | (( COMP_POINT += \${#COMP_LINE} )) 71 | $compl_func 72 | }" >> "$tmp_file" 73 | new_completion="${new_completion/ -F $compl_func / -F $compl_wrapper }" 74 | fi 75 | fi 76 | 77 | # replace completion trigger by alias 78 | new_completion="${new_completion% *} $alias_name" 79 | echo "$new_completion" >> "$tmp_file" 80 | done < <(alias -p | sed -Ene "s/$alias_regex/\1 '\2' '\3'/p") 81 | source "$tmp_file" && rm -f "$tmp_file" 82 | }; alias_completion 83 | -------------------------------------------------------------------------------- /completion/available/git_flow.completion.bash: -------------------------------------------------------------------------------- 1 | #!bash 2 | # 3 | # git-flow-completion 4 | # =================== 5 | # 6 | # Bash completion support for [git-flow](http://github.com/nvie/gitflow) 7 | # 8 | # The contained completion routines provide support for completing: 9 | # 10 | # * git-flow init and version 11 | # * feature, hotfix and release branches 12 | # * remote feature branch names (for `git-flow feature track`) 13 | # 14 | # 15 | # Installation 16 | # ------------ 17 | # 18 | # To achieve git-flow completion nirvana: 19 | # 20 | # 0. Install git-completion. 21 | # 22 | # 1. Install this file. Either: 23 | # 24 | # a. Place it in a `bash-completion.d` folder: 25 | # 26 | # * /etc/bash-completion.d 27 | # * /usr/local/etc/bash-completion.d 28 | # * ~/bash-completion.d 29 | # 30 | # b. Or, copy it somewhere (e.g. ~/.git-flow-completion.sh) and put the following line in 31 | # your .bashrc: 32 | # 33 | # source ~/.git-flow-completion.sh 34 | # 35 | # 2. If you are using Git < 1.7.1: Edit git-completion.sh and add the following line to the giant 36 | # $command case in _git: 37 | # 38 | # flow) _git_flow ;; 39 | # 40 | # 41 | # The Fine Print 42 | # -------------- 43 | # 44 | # Copyright (c) 2010 [Justin Hileman](http://justinhileman.com) 45 | # 46 | # Distributed under the [MIT License](http://creativecommons.org/licenses/MIT/) 47 | 48 | _git_flow () 49 | { 50 | local subcommands="init feature release hotfix" 51 | local subcommand="$(__git_find_subcommand "$subcommands")" 52 | if [ -z "$subcommand" ]; then 53 | __gitcomp "$subcommands" 54 | return 55 | fi 56 | 57 | case "$subcommand" in 58 | feature) 59 | __git_flow_feature 60 | return 61 | ;; 62 | release) 63 | __git_flow_release 64 | return 65 | ;; 66 | hotfix) 67 | __git_flow_hotfix 68 | return 69 | ;; 70 | *) 71 | COMPREPLY=() 72 | ;; 73 | esac 74 | } 75 | 76 | __git_flow_feature () 77 | { 78 | local subcommands="list start finish publish track diff rebase checkout pull" 79 | local subcommand="$(__git_find_subcommand "$subcommands")" 80 | if [ -z "$subcommand" ]; then 81 | __gitcomp "$subcommands" 82 | return 83 | fi 84 | 85 | case "$subcommand" in 86 | pull) 87 | __gitcomp "$(__git_remotes)" 88 | return 89 | ;; 90 | checkout|finish|diff|rebase) 91 | __gitcomp "$(__git_flow_list_features)" 92 | return 93 | ;; 94 | publish) 95 | __gitcomp "$(comm -23 <(__git_flow_list_features) <(__git_flow_list_remote_features))" 96 | return 97 | ;; 98 | track) 99 | __gitcomp "$(__git_flow_list_remote_features)" 100 | return 101 | ;; 102 | *) 103 | COMPREPLY=() 104 | ;; 105 | esac 106 | } 107 | 108 | __git_flow_list_features () 109 | { 110 | git flow feature list 2> /dev/null | tr -d ' |*' 111 | } 112 | 113 | __git_flow_list_remote_features () 114 | { 115 | git branch -r 2> /dev/null | grep "origin/$(__git_flow_feature_prefix)" | awk '{ sub(/^origin\/$(__git_flow_feature_prefix)/, "", $1); print }' 116 | } 117 | 118 | __git_flow_feature_prefix () 119 | { 120 | git config gitflow.prefix.feature 2> /dev/null || echo "feature/" 121 | } 122 | 123 | __git_flow_release () 124 | { 125 | local subcommands="list start finish" 126 | local subcommand="$(__git_find_subcommand "$subcommands")" 127 | if [ -z "$subcommand" ]; then 128 | __gitcomp "$subcommands" 129 | return 130 | fi 131 | 132 | case "$subcommand" in 133 | finish) 134 | __gitcomp "$(__git_flow_list_releases)" 135 | return 136 | ;; 137 | *) 138 | COMPREPLY=() 139 | ;; 140 | esac 141 | 142 | } 143 | 144 | __git_flow_list_releases () 145 | { 146 | git flow release list 2> /dev/null 147 | } 148 | 149 | __git_flow_hotfix () 150 | { 151 | local subcommands="list start finish" 152 | local subcommand="$(__git_find_subcommand "$subcommands")" 153 | if [ -z "$subcommand" ]; then 154 | __gitcomp "$subcommands" 155 | return 156 | fi 157 | 158 | case "$subcommand" in 159 | finish) 160 | __gitcomp "$(__git_flow_list_hotfixes)" 161 | return 162 | ;; 163 | *) 164 | COMPREPLY=() 165 | ;; 166 | esac 167 | } 168 | 169 | __git_flow_list_hotfixes () 170 | { 171 | git flow hotfix list 2> /dev/null 172 | } 173 | 174 | # temporarily wrap __git_find_on_cmdline() for backwards compatibility 175 | if [ -z "`type -t __git_find_subcommand`" ]; then 176 | alias __git_find_subcommand=__git_find_on_cmdline 177 | fi -------------------------------------------------------------------------------- /plugins/available/battery.plugin.bash: -------------------------------------------------------------------------------- 1 | cite about-plugin 2 | about-plugin 'display info about your battery charge level' 3 | 4 | ac_adapter_connected(){ 5 | if command_exists acpi; 6 | then 7 | acpi -a | grep "on-line" 8 | if [[ "$?" -eq 0 ]]; then 9 | return 1 10 | else 11 | return 0 12 | fi 13 | fi 14 | } 15 | 16 | battery_percentage(){ 17 | about 'displays battery charge as a percentage of full (100%)' 18 | group 'battery' 19 | 20 | if command_exists acpi; 21 | then 22 | local ACPI_OUTPUT=$(acpi -b) 23 | case $ACPI_OUTPUT in 24 | *" Unknown"*) 25 | local PERC_OUTPUT=$(echo $ACPI_OUTPUT | head -c 22 | tail -c 2) 26 | case $PERC_OUTPUT in 27 | *%) 28 | echo "0${PERC_OUTPUT}" | head -c 2 29 | ;; 30 | *) 31 | echo ${PERC_OUTPUT} 32 | ;; 33 | esac 34 | ;; 35 | *" Discharging"*) 36 | local PERC_OUTPUT=$(echo $ACPI_OUTPUT | head -c 26 | tail -c 2) 37 | case $PERC_OUTPUT in 38 | *%) 39 | echo "0${PERC_OUTPUT}" | head -c 2 40 | ;; 41 | *) 42 | echo ${PERC_OUTPUT} 43 | ;; 44 | esac 45 | ;; 46 | *" Charging"*) 47 | local PERC_OUTPUT=$(echo $ACPI_OUTPUT | head -c 23 | tail -c 2) 48 | case $PERC_OUTPUT in 49 | *%) 50 | echo "0${PERC_OUTPUT}" | head -c 2 51 | ;; 52 | *) 53 | echo ${PERC_OUTPUT} 54 | ;; 55 | esac 56 | ;; 57 | *" Full"*) 58 | echo '99' 59 | ;; 60 | *) 61 | echo '-1' 62 | ;; 63 | esac 64 | elif command_exists ioreg; 65 | then 66 | # http://hints.macworld.com/article.php?story=20100130123935998 67 | #local IOREG_OUTPUT_10_6=$(ioreg -l | grep -i capacity | tr '\n' ' | ' | awk '{printf("%.2f%%", $10/$5 * 100)}') 68 | #local IOREG_OUTPUT_10_5=$(ioreg -l | grep -i capacity | grep -v Legacy| tr '\n' ' | ' | awk '{printf("%.2f%%", $14/$7 * 100)}') 69 | local IOREG_OUTPUT=$(ioreg -n AppleSmartBattery -r | awk '$1~/Capacity/{c[$1]=$3} END{OFMT="%05.2f%%"; max=c["\"MaxCapacity\""]; print (max>0? 100*c["\"CurrentCapacity\""]/max: "?")}') 70 | case $IOREG_OUTPUT in 71 | 100*) 72 | echo '99' 73 | ;; 74 | *) 75 | echo $IOREG_OUTPUT | head -c 2 76 | ;; 77 | esac 78 | else 79 | echo "no" 80 | fi 81 | } 82 | 83 | battery_charge(){ 84 | about 'graphical display of your battery charge' 85 | group 'battery' 86 | 87 | # Full char 88 | local F_C='▸' 89 | # Depleted char 90 | local D_C='▹' 91 | local DEPLETED_COLOR="${normal}" 92 | local FULL_COLOR="${green}" 93 | local HALF_COLOR="${yellow}" 94 | local DANGER_COLOR="${red}" 95 | local BATTERY_OUTPUT="${DEPLETED_COLOR}${D_C}${D_C}${D_C}${D_C}${D_C}" 96 | local BATTERY_PERC=$(battery_percentage) 97 | 98 | case $BATTERY_PERC in 99 | no) 100 | echo "" 101 | ;; 102 | 9*) 103 | echo "${FULL_COLOR}${F_C}${F_C}${F_C}${F_C}${F_C}${normal}" 104 | ;; 105 | 8*) 106 | echo "${FULL_COLOR}${F_C}${F_C}${F_C}${F_C}${HALF_COLOR}${F_C}${normal}" 107 | ;; 108 | 7*) 109 | echo "${FULL_COLOR}${F_C}${F_C}${F_C}${F_C}${DEPLETED_COLOR}${D_C}${normal}" 110 | ;; 111 | 6*) 112 | echo "${FULL_COLOR}${F_C}${F_C}${F_C}${HALF_COLOR}${F_C}${DEPLETED_COLOR}${D_C}${normal}" 113 | ;; 114 | 5*) 115 | echo "${FULL_COLOR}${F_C}${F_C}${F_C}${DEPLETED_COLOR}${D_C}${D_C}${normal}" 116 | ;; 117 | 4*) 118 | echo "${FULL_COLOR}${F_C}${F_C}${HALF_COLOR}${F_C}${DEPLETED_COLOR}${D_C}${D_C}${normal}" 119 | ;; 120 | 3*) 121 | echo "${FULL_COLOR}${F_C}${F_C}${DEPLETED_COLOR}${D_C}${D_C}${D_C}${normal}" 122 | ;; 123 | 2*) 124 | echo "${FULL_COLOR}${F_C}${HALF_COLOR}${F_C}${DEPLETED_COLOR}${D_C}${D_C}${D_C}${normal}" 125 | ;; 126 | 1*) 127 | echo "${FULL_COLOR}${F_C}${DEPLETED_COLOR}${D_C}${D_C}${D_C}${D_C}${normal}" 128 | ;; 129 | 05) 130 | echo "${DANGER_COLOR}${F_C}${DEPLETED_COLOR}${D_C}${D_C}${D_C}${D_C}${normal}" 131 | ;; 132 | 04) 133 | echo "${DANGER_COLOR}${F_C}${DEPLETED_COLOR}${D_C}${D_C}${D_C}${D_C}${normal}" 134 | ;; 135 | 03) 136 | echo "${DANGER_COLOR}${F_C}${DEPLETED_COLOR}${D_C}${D_C}${D_C}${D_C}${normal}" 137 | ;; 138 | 02) 139 | echo "${DANGER_COLOR}${F_C}${DEPLETED_COLOR}${D_C}${D_C}${D_C}${D_C}${normal}" 140 | ;; 141 | 0*) 142 | echo "${HALF_COLOR}${F_C}${DEPLETED_COLOR}${D_C}${D_C}${D_C}${D_C}${normal}" 143 | ;; 144 | *) 145 | echo "${DANGER_COLOR}UNPLG${normal}" 146 | ;; 147 | esac 148 | } 149 | -------------------------------------------------------------------------------- /completion/available/packer.completion.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Packer (http://www.packer.io) bash completion 4 | # 5 | # This script provides bash completion for packer and supports: 6 | # 7 | # - template filename completion (*.json) in cwd 8 | # - support for basic options (i.e.. -debug) 9 | # - support for complex options (i.e. -parallel=[true|false] 10 | # 11 | # The scirpt has been successfully tested with packer-0.6.0 and the 12 | # following OS: 13 | # 14 | # - OS X 10.9 15 | # - CentOS-6.5 16 | # - Ubuntu 12.04 Server 17 | # 18 | # The script technically is heavily inspired by the git-completion.bash 19 | # script. Kudos to Shawn O. Pearce and all other 20 | # contributors for the inspiration and especially to the bash-completion 21 | # team in general. 22 | # 23 | # Copyright (c) 2014 IT Services Department, University of Bern 24 | # 25 | # This script is licensed under the MIT License (MIT) 26 | # For licsense details see the LICENSE file included in the repository 27 | # or read the license text at http://opensource.org/licenses/MIT. 28 | # 29 | 30 | # Generates completion reply, appending a space to possible completion words, 31 | # if necessary. 32 | # It accepts 2 arguments though the second is optional: 33 | # 1: List of possible completion words. 34 | # 2: Generate possible completion matches for this word (optional). 35 | __packercomp () 36 | { 37 | local cur_="${2-$cur}" 38 | 39 | case "$cur_" in 40 | -*=) 41 | ;; 42 | *) 43 | local c i=0 IFS=$' \t\n' 44 | for c in $1; do 45 | if [[ $c == "$cur_"* ]]; then 46 | case $c in 47 | -*=*|*.) ;; 48 | *) c="$c " ;; 49 | esac 50 | COMPREPLY[i++]="$c" 51 | fi 52 | done 53 | ;; 54 | esac 55 | } 56 | 57 | # Generates completion reply for template files in cwd. 58 | __packercomp_template_file () 59 | { 60 | local IFS=$'\n' 61 | 62 | COMPREPLY=($(compgen -S " " -A file -X '!*.json' -- "${cur}")) 63 | } 64 | 65 | # Generates completion for the build command. 66 | __packer_build () 67 | { 68 | local builders=" 69 | amazon-ebs amazon-instance amazon-chroot digitalocean docker 70 | googlecompute openstack parallels-iso parallels-pvm qemu 71 | virtualbox-iso virtualbox-ovf vmware-iso vmware-vmx" 72 | 73 | case "$cur" in 74 | -parallel=*) 75 | __packercomp "false true" "${cur##-parallel=}" 76 | return 77 | ;; 78 | -except=*) 79 | __packercomp "$builders" "${cur##-except=}" 80 | return 81 | ;; 82 | -only=*) 83 | __packercomp "$builders" "${cur##-only=}" 84 | return 85 | ;; 86 | -*) 87 | __packercomp "-debug -force -machine-readable -except= -only= -parallel= -var -var-file" 88 | return 89 | ;; 90 | *) 91 | esac 92 | 93 | __packercomp_template_file 94 | } 95 | 96 | # Generates completion for the fix command. 97 | __packer_fix () 98 | { 99 | __packercomp_template_file 100 | } 101 | 102 | # Generates completion for the inspect command. 103 | __packer_inspect () 104 | { 105 | case "$cur" in 106 | -*) 107 | __packercomp "-machine-readable" 108 | return 109 | ;; 110 | *) 111 | esac 112 | 113 | __packercomp_template_file 114 | } 115 | 116 | # Generates completion for the validate command. 117 | __packer_validate () 118 | { 119 | __packercomp_template_file 120 | } 121 | 122 | # Main function for packer completion. 123 | # 124 | # Searches for a command in $COMP_WORDS. If one is found 125 | # the appropriate function from above is called, if not 126 | # completion for global options is done. 127 | _packer_completion () 128 | { 129 | cur=${COMP_WORDS[COMP_CWORD]} 130 | # Words containing an equal sign get split into tokens in bash > 4, which 131 | # doesn't come in handy here. 132 | # This is handled here. bash < 4 does not split. 133 | declare -f _get_comp_words_by_ref >/dev/null && _get_comp_words_by_ref -n = cur 134 | 135 | COMPREPLY=() 136 | local i c=1 command 137 | 138 | while [ $c -lt $COMP_CWORD ]; do 139 | i="${COMP_WORDS[c]}" 140 | case "$i" in 141 | -*) ;; 142 | *) command="$i"; break ;; 143 | esac 144 | ((c++)) 145 | done 146 | 147 | if [ -z $command ]; then 148 | case "$cur" in 149 | '-'*) 150 | __packercomp "-machine-readable --help --version" 151 | ;; 152 | *) 153 | __packercomp "build fix inspect validate" 154 | ;; 155 | esac 156 | return 157 | fi 158 | 159 | local completion_func="__packer_${command}" 160 | declare -f $completion_func >/dev/null && $completion_func 161 | } 162 | 163 | complete -o nospace -F _packer_completion packer 164 | 165 | -------------------------------------------------------------------------------- /themes/powerline/powerline.theme.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | THEME_PROMPT_SEPARATOR="" 4 | 5 | SHELL_SSH_CHAR=" " 6 | SHELL_THEME_PROMPT_COLOR=32 7 | SHELL_THEME_PROMPT_COLOR_SUDO=202 8 | 9 | VIRTUALENV_CHAR="ⓔ " 10 | VIRTUALENV_THEME_PROMPT_COLOR=35 11 | 12 | SCM_NONE_CHAR="" 13 | SCM_GIT_CHAR=" " 14 | 15 | SCM_THEME_PROMPT_CLEAN="" 16 | SCM_THEME_PROMPT_DIRTY="" 17 | 18 | SCM_THEME_PROMPT_COLOR=238 19 | SCM_THEME_PROMPT_CLEAN_COLOR=231 20 | SCM_THEME_PROMPT_DIRTY_COLOR=196 21 | SCM_THEME_PROMPT_STAGED_COLOR=220 22 | SCM_THEME_PROMPT_UNSTAGED_COLOR=166 23 | 24 | CWD_THEME_PROMPT_COLOR=240 25 | 26 | LAST_STATUS_THEME_PROMPT_COLOR=52 27 | 28 | IN_VIM_PROMPT_COLOR=35 29 | IN_VIM_PROMPT_TEXT="vim" 30 | 31 | 32 | function set_rgb_color { 33 | if [[ "${1}" != "-" ]]; then 34 | fg="38;5;${1}" 35 | fi 36 | if [[ "${2}" != "-" ]]; then 37 | bg="48;5;${2}" 38 | [[ -n "${fg}" ]] && bg=";${bg}" 39 | fi 40 | echo -e "\[\033[${fg}${bg}m\]" 41 | } 42 | 43 | function powerline_shell_prompt { 44 | SHELL_PROMPT_COLOR=${SHELL_THEME_PROMPT_COLOR} 45 | if sudo -n uptime 2>&1 | grep -q "load"; then 46 | SHELL_PROMPT_COLOR=${SHELL_THEME_PROMPT_COLOR_SUDO} 47 | fi 48 | if [[ -n "${SSH_CLIENT}" ]]; then 49 | SHELL_PROMPT="${SHELL_SSH_CHAR}\u@\h" 50 | else 51 | SHELL_PROMPT="\u" 52 | fi 53 | SHELL_PROMPT="${bold_white}$(set_rgb_color - ${SHELL_PROMPT_COLOR}) ${SHELL_PROMPT} ${normal}" 54 | LAST_THEME_COLOR=${SHELL_PROMPT_COLOR} 55 | } 56 | 57 | function powerline_virtualenv_prompt { 58 | local environ="" 59 | 60 | if [[ -n "$CONDA_DEFAULT_ENV" ]]; then 61 | environ="conda: $CONDA_DEFAULT_ENV" 62 | elif [[ -n "$VIRTUAL_ENV" ]]; then 63 | environ=$(basename "$VIRTUAL_ENV") 64 | fi 65 | 66 | if [[ -n "$environ" ]]; then 67 | VIRTUALENV_PROMPT="$(set_rgb_color ${LAST_THEME_COLOR} ${VIRTUALENV_THEME_PROMPT_COLOR})${THEME_PROMPT_SEPARATOR}${normal}$(set_rgb_color - ${VIRTUALENV_THEME_PROMPT_COLOR}) ${VIRTUALENV_CHAR}$environ ${normal}" 68 | LAST_THEME_COLOR=${VIRTUALENV_THEME_PROMPT_COLOR} 69 | else 70 | VIRTUALENV_PROMPT="" 71 | fi 72 | } 73 | 74 | function powerline_scm_prompt { 75 | scm_prompt_vars 76 | 77 | if [[ "${SCM_NONE_CHAR}" != "${SCM_CHAR}" ]]; then 78 | if [[ "${SCM_DIRTY}" -eq 3 ]]; then 79 | SCM_PROMPT="$(set_rgb_color ${SCM_THEME_PROMPT_STAGED_COLOR} ${SCM_THEME_PROMPT_COLOR})" 80 | elif [[ "${SCM_DIRTY}" -eq 2 ]]; then 81 | SCM_PROMPT="$(set_rgb_color ${SCM_THEME_PROMPT_UNSTAGED_COLOR} ${SCM_THEME_PROMPT_COLOR})" 82 | elif [[ "${SCM_DIRTY}" -eq 1 ]]; then 83 | SCM_PROMPT="$(set_rgb_color ${SCM_THEME_PROMPT_DIRTY_COLOR} ${SCM_THEME_PROMPT_COLOR})" 84 | else 85 | SCM_PROMPT="$(set_rgb_color ${SCM_THEME_PROMPT_CLEAN_COLOR} ${SCM_THEME_PROMPT_COLOR})" 86 | fi 87 | if [[ "${SCM_GIT_CHAR}" == "${SCM_CHAR}" ]]; then 88 | SCM_PROMPT+=" ${SCM_CHAR}${SCM_BRANCH}${SCM_STATE}" 89 | fi 90 | SCM_PROMPT="$(set_rgb_color ${LAST_THEME_COLOR} ${SCM_THEME_PROMPT_COLOR})${THEME_PROMPT_SEPARATOR}${normal}${SCM_PROMPT} ${normal}" 91 | LAST_THEME_COLOR=${SCM_THEME_PROMPT_COLOR} 92 | else 93 | SCM_PROMPT="" 94 | fi 95 | } 96 | 97 | function powerline_cwd_prompt { 98 | CWD_PROMPT="$(set_rgb_color ${LAST_THEME_COLOR} ${CWD_THEME_PROMPT_COLOR})${THEME_PROMPT_SEPARATOR}${normal}$(set_rgb_color - ${CWD_THEME_PROMPT_COLOR}) \w ${normal}$(set_rgb_color ${CWD_THEME_PROMPT_COLOR} -)${normal}" 99 | LAST_THEME_COLOR=${CWD_THEME_PROMPT_COLOR} 100 | } 101 | 102 | function powerline_last_status_prompt { 103 | if [[ "$1" -eq 0 ]]; then 104 | LAST_STATUS_PROMPT="$(set_rgb_color ${LAST_THEME_COLOR} -)${THEME_PROMPT_SEPARATOR}${normal}" 105 | else 106 | LAST_STATUS_PROMPT="$(set_rgb_color ${LAST_THEME_COLOR} ${LAST_STATUS_THEME_PROMPT_COLOR})${THEME_PROMPT_SEPARATOR}${normal}$(set_rgb_color - ${LAST_STATUS_THEME_PROMPT_COLOR}) ${LAST_STATUS} ${normal}$(set_rgb_color ${LAST_STATUS_THEME_PROMPT_COLOR} -)${THEME_PROMPT_SEPARATOR}${normal}" 107 | fi 108 | } 109 | 110 | function powerline_in_vim_prompt { 111 | if [ -z "$VIMRUNTIME" ]; then 112 | IN_VIM_PROMPT="" 113 | else 114 | IN_VIM_PROMPT="$(set_rgb_color ${LAST_THEME_COLOR} ${IN_VIM_PROMPT_COLOR})${THEME_PROMPT_SEPARATOR}${normal}$(set_rgb_color - ${IN_VIM_PROMPT_COLOR}) ${IN_VIM_PROMPT_TEXT} ${normal}$(set_rgb_color ${IN_VIM_PROMPT_COLOR} -)${normal}" 115 | LAST_THEME_COLOR=${IN_VIM_PROMPT_COLOR} 116 | fi 117 | } 118 | 119 | function powerline_prompt_command() { 120 | local LAST_STATUS="$?" 121 | 122 | powerline_shell_prompt 123 | powerline_in_vim_prompt 124 | powerline_virtualenv_prompt 125 | powerline_scm_prompt 126 | powerline_cwd_prompt 127 | powerline_last_status_prompt LAST_STATUS 128 | 129 | PS1="${SHELL_PROMPT}${IN_VIM_PROMPT}${VIRTUALENV_PROMPT}${SCM_PROMPT}${CWD_PROMPT}${LAST_STATUS_PROMPT} " 130 | } 131 | 132 | PROMPT_COMMAND=powerline_prompt_command 133 | 134 | -------------------------------------------------------------------------------- /plugins/available/z.plugin.bash: -------------------------------------------------------------------------------- 1 | cite about-plugin 2 | about-plugin 'maintains a jump-list of the directories you actually use' 3 | about-plugin ' z is DEPRECATED, use fasd instead' 4 | 5 | # INSTALL: 6 | # * put something like this in your .bashrc: 7 | # . /path/to/z.sh 8 | # * cd around for a while to build up the db 9 | # * PROFIT!! 10 | # 11 | # USE: 12 | # * z foo # goes to most frecent dir matching foo 13 | # * z foo bar # goes to most frecent dir matching foo and bar 14 | # * z -r foo # goes to highest ranked dir matching foo 15 | # * z -t foo # goes to most recently accessed dir matching foo 16 | # * z -l foo # list all dirs matching foo (by frecency) 17 | 18 | if [ -e $BASH_IT/plugins/enabled/fasd.plugin.bash ]; then 19 | printf '%s\n' 'sorry, the z plugin is incompatible with the fasd plugin. you may use either, but not both.' 20 | return 21 | fi 22 | 23 | z() { 24 | local datafile="$HOME/.z" 25 | if [ "$1" = "--add" ]; then 26 | # add 27 | shift 28 | # $HOME isn't worth matching 29 | [ "$*" = "$HOME" ] && return 30 | awk -v p="$*" -v t="$(date +%s)" -F"|" ' 31 | BEGIN { rank[p] = 1; time[p] = t } 32 | $2 >= 1 { 33 | if( $1 == p ) { 34 | rank[$1] = $2 + 1 35 | time[$1] = t 36 | } else { 37 | rank[$1] = $2 38 | time[$1] = $3 39 | } 40 | count += $2 41 | } 42 | END { 43 | if( count > 1000 ) { 44 | for( i in rank ) print i "|" 0.9*rank[i] "|" time[i] # aging 45 | } else for( i in rank ) print i "|" rank[i] "|" time[i] 46 | } 47 | ' "$datafile" 2>/dev/null > "$datafile.tmp" 48 | mv -f "$datafile.tmp" "$datafile" 49 | elif [ "$1" = "--complete" ]; then 50 | # tab completion 51 | awk -v q="$2" -F"|" ' 52 | BEGIN { 53 | if( q == tolower(q) ) nocase = 1 54 | split(substr(q,3),fnd," ") 55 | } 56 | { 57 | if( system("test -d \"" $1 "\"") ) next 58 | if( nocase ) { 59 | for( i in fnd ) tolower($1) !~ tolower(fnd[i]) && $1 = "" 60 | if( $1 ) print $1 61 | } else { 62 | for( i in fnd ) $1 !~ fnd[i] && $1 = "" 63 | if( $1 ) print $1 64 | } 65 | } 66 | ' "$datafile" 2>/dev/null 67 | else 68 | # list/go 69 | while [ "$1" ]; do case "$1" in 70 | -h) echo "z [-h][-l][-r][-t] args" >&2; return;; 71 | -l) local list=1;; 72 | -r) local typ="rank";; 73 | -t) local typ="recent";; 74 | --) while [ "$1" ]; do shift; local fnd="$fnd $1";done;; 75 | *) local fnd="$fnd $1";; 76 | esac; local last=$1; shift; done 77 | [ "$fnd" ] || local list=1 78 | # if we hit enter on a completion just go there 79 | [ -d "$last" ] && cd "$last" && return 80 | [ -f "$datafile" ] || return 81 | local cd="$(awk -v t="$(date +%s)" -v list="$list" -v typ="$typ" -v q="$fnd" -v tmpfl="$datafile.tmp" -F"|" ' 82 | function frecent(rank, time) { 83 | dx = t-time 84 | if( dx < 3600 ) return rank*4 85 | if( dx < 86400 ) return rank*2 86 | if( dx < 604800 ) return rank/2 87 | return rank/4 88 | } 89 | function output(files, toopen, override) { 90 | if( list ) { 91 | if( typ == "recent" ) { 92 | cmd = "sort -nr >&2" 93 | } else cmd = "sort -n >&2" 94 | for( i in files ) if( files[i] ) printf "%-10s %s\n", files[i], i | cmd 95 | if( override ) printf "%-10s %s\n", "common:", override > "/dev/stderr" 96 | } else { 97 | if( override ) toopen = override 98 | print toopen 99 | } 100 | } 101 | function common(matches, fnd, nc) { 102 | for( i in matches ) { 103 | if( matches[i] && (!short || length(i) < length(short)) ) short = i 104 | } 105 | if( short == "/" ) return 106 | for( i in matches ) if( matches[i] && i !~ short ) x = 1 107 | if( x ) return 108 | if( nc ) { 109 | for( i in fnd ) if( tolower(short) !~ tolower(fnd[i]) ) x = 1 110 | } else for( i in fnd ) if( short !~ fnd[i] ) x = 1 111 | if( !x ) return short 112 | } 113 | BEGIN { split(q, a, " ") } 114 | { 115 | if( system("test -d \"" $1 "\"") ) next 116 | print $0 >> tmpfl 117 | if( typ == "rank" ) { 118 | f = $2 119 | } else if( typ == "recent" ) { 120 | f = t-$3 121 | } else f = frecent($2, $3) 122 | wcase[$1] = nocase[$1] = f 123 | for( i in a ) { 124 | if( $1 !~ a[i] ) delete wcase[$1] 125 | if( tolower($1) !~ tolower(a[i]) ) delete nocase[$1] 126 | } 127 | if( wcase[$1] > oldf ) { 128 | cx = $1 129 | oldf = wcase[$1] 130 | } else if( nocase[$1] > noldf ) { 131 | ncx = $1 132 | noldf = nocase[$1] 133 | } 134 | } 135 | END { 136 | if( cx ) { 137 | output(wcase, cx, common(wcase, a, 0)) 138 | } else if( ncx ) output(nocase, ncx, common(nocase, a, 1)) 139 | } 140 | ' "$datafile")" 141 | if [ $? -gt 0 ]; then 142 | rm -f "$datafile.tmp" 143 | else 144 | mv -f "$datafile.tmp" "$datafile" 145 | [ "$cd" ] && cd "$cd" 146 | fi 147 | fi 148 | } 149 | # tab completion 150 | complete -C 'z --complete "$COMP_LINE"' z 151 | # populate directory list. avoid clobbering other PROMPT_COMMANDs. 152 | echo $PROMPT_COMMAND | grep -q "z --add" 153 | [ $? -gt 0 ] && PROMPT_COMMAND='z --add "$(pwd -P)";'"$PROMPT_COMMAND" 154 | -------------------------------------------------------------------------------- /completion/available/fabric-completion.bash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Bash completion support for Fabric (http://fabfile.org/) 4 | # 5 | # 6 | # Copyright (C) 2011 by Konstantin Bakulin 7 | # 8 | # Permission is hereby granted, free of charge, to any person obtaining a copy 9 | # of this software and associated documentation files (the "Software"), to deal 10 | # in the Software without restriction, including without limitation the rights 11 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | # copies of the Software, and to permit persons to whom the Software is 13 | # furnished to do so, subject to the following conditions: 14 | # 15 | # The above copyright notice and this permission notice shall be included in 16 | # all copies or substantial portions of the Software. 17 | # 18 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | # THE SOFTWARE. 25 | # 26 | # Thanks to: 27 | # - Adam Vandenberg, 28 | # https://github.com/adamv/dotfiles/blob/master/completion_scripts/fab_completion.bash 29 | # 30 | # - Enrico Batista da Luz, 31 | # https://github.com/ricobl/dotfiles/blob/master/bin/fab_bash_completion 32 | # 33 | 34 | 35 | # Use cache files for fab tasks or not. 36 | # If set to "false" command "fab --shortlist" will be executed every time. 37 | export FAB_COMPLETION_CACHE_TASKS=true 38 | 39 | # File name where tasks cache will be stored (in current dir). 40 | export FAB_COMPLETION_CACHED_TASKS_FILENAME=".fab_tasks~" 41 | 42 | 43 | # Set command to get time of last file modification as seconds since Epoch 44 | case `uname` in 45 | Darwin|FreeBSD) 46 | __FAB_COMPLETION_MTIME_COMMAND="stat -f '%m'" 47 | ;; 48 | *) 49 | __FAB_COMPLETION_MTIME_COMMAND="stat -c '%Y'" 50 | ;; 51 | esac 52 | 53 | 54 | # 55 | # Get time of last fab cache file modification as seconds since Epoch 56 | # 57 | function __fab_chache_mtime() { 58 | ${__FAB_COMPLETION_MTIME_COMMAND} \ 59 | $FAB_COMPLETION_CACHED_TASKS_FILENAME | xargs -n 1 expr 60 | } 61 | 62 | 63 | # 64 | # Get time of last fabfile file/module modification as seconds since Epoch 65 | # 66 | function __fab_fabfile_mtime() { 67 | local f="fabfile" 68 | if [[ -e "$f.py" ]]; then 69 | ${__FAB_COMPLETION_MTIME_COMMAND} "$f.py" | xargs -n 1 expr 70 | else 71 | # Suppose that it's a fabfile dir 72 | find $f/*.py -exec ${__FAB_COMPLETION_MTIME_COMMAND} {} + \ 73 | | xargs -n 1 expr | sort -n -r | head -1 74 | fi 75 | } 76 | 77 | 78 | # 79 | # Completion for "fab" command 80 | # 81 | function __fab_completion() { 82 | # Return if "fab" command doesn't exists 83 | [[ -e `which fab 2> /dev/null` ]] || return 0 84 | 85 | # Variables to hold the current word and possible matches 86 | local cur="${COMP_WORDS[COMP_CWORD]}" 87 | local opts=() 88 | 89 | # Generate possible matches and store them in variable "opts" 90 | case "${cur}" in 91 | -*) 92 | if [[ -z "${__FAB_COMPLETION_LONG_OPT}" ]]; then 93 | export __FAB_COMPLETION_LONG_OPT=$( 94 | fab --help | egrep -o "\-\-[A-Za-z_\-]+\=?" | sort -u) 95 | fi 96 | opts="${__FAB_COMPLETION_LONG_OPT}" 97 | ;; 98 | 99 | # Completion for short options is not nessary. 100 | # It's left here just for history. 101 | # -*) 102 | # if [[ -z "${__FAB_COMPLETION_SHORT_OPT}" ]]; then 103 | # export __FAB_COMPLETION_SHORT_OPT=$( 104 | # fab --help | egrep -o "^ +\-[A-Za-z_\]" | sort -u) 105 | # fi 106 | # opts="${__FAB_COMPLETION_SHORT_OPT}" 107 | # ;; 108 | 109 | *) 110 | # If "fabfile.py" or "fabfile" dir with "__init__.py" file exists 111 | local f="fabfile" 112 | if [[ -e "$f.py" || (-d "$f" && -e "$f/__init__.py") ]]; then 113 | # Build a list of the available tasks 114 | if $FAB_COMPLETION_CACHE_TASKS; then 115 | # If use cache 116 | if [[ ! -s ${FAB_COMPLETION_CACHED_TASKS_FILENAME} || 117 | $(__fab_fabfile_mtime) -gt $(__fab_chache_mtime) ]]; then 118 | fab --shortlist > ${FAB_COMPLETION_CACHED_TASKS_FILENAME} \ 119 | 2> /dev/null 120 | fi 121 | opts=$(cat ${FAB_COMPLETION_CACHED_TASKS_FILENAME}) 122 | else 123 | # Without cache 124 | opts=$(fab --shortlist 2> /dev/null) 125 | fi 126 | fi 127 | ;; 128 | esac 129 | 130 | # Set possible completions 131 | COMPREPLY=($(compgen -W "${opts}" -- ${cur})) 132 | } 133 | complete -o default -o nospace -F __fab_completion fab 134 | -------------------------------------------------------------------------------- /plugins/available/todo/todo_completion: -------------------------------------------------------------------------------- 1 | #!/bin/bash source-this-script 2 | [ "$BASH_VERSION" ] || return 3 | 4 | _todo() 5 | { 6 | local cur prev opts 7 | COMPREPLY=() 8 | cur="${COMP_WORDS[COMP_CWORD]}" 9 | prev="${COMP_WORDS[COMP_CWORD-1]}" 10 | 11 | local -r OPTS="-@ -@@ -+ -++ -d -f -h -p -P -PP -a -n -t -v -vv -V -x" 12 | local -r COMMANDS="\ 13 | add a addto addm append app archive command del \ 14 | rm depri dp do help list ls listaddons listall lsa listcon \ 15 | lsc listfile lf listpri lsp listproj lsprj move \ 16 | mv prepend prep pri p replace report shorthelp" 17 | 18 | local _todo_sh=${_todo_sh:-todo.sh} 19 | local completions 20 | if [ $COMP_CWORD -eq 1 ]; then 21 | completions="$COMMANDS $(eval TODOTXT_VERBOSE=0 $_todo_sh command listaddons) $OPTS" 22 | elif [[ $COMP_CWORD -gt 2 && ( \ 23 | "${COMP_WORDS[COMP_CWORD-2]}" =~ ^(move|mv)$ || \ 24 | "${COMP_WORDS[COMP_CWORD-3]}" =~ ^(move|mv)$ ) ]]; then 25 | # "move ITEM# DEST [SRC]" has file arguments on positions 2 and 3. 26 | completions=$(eval TODOTXT_VERBOSE=0 $_todo_sh command listfile) 27 | else 28 | case "$prev" in 29 | command) 30 | completions=$COMMANDS;; 31 | addto|listfile|lf) 32 | completions=$(eval TODOTXT_VERBOSE=0 $_todo_sh command listfile);; 33 | -*) completions="$COMMANDS $(eval TODOTXT_VERBOSE=0 $_todo_sh command listaddons) $OPTS";; 34 | *) case "$cur" in 35 | +*) completions=$(eval TODOTXT_VERBOSE=0 $_todo_sh command listproj) 36 | COMPREPLY=( $( compgen -W "$completions" -- $cur )) 37 | [ ${#COMPREPLY[@]} -gt 0 ] && return 0 38 | # Fall back to projects extracted from done tasks. 39 | completions=$(eval 'TODOTXT_VERBOSE=0 TODOTXT_SOURCEVAR=\$DONE_FILE' $_todo_sh command listproj) 40 | ;; 41 | @*) completions=$(eval TODOTXT_VERBOSE=0 $_todo_sh command listcon) 42 | COMPREPLY=( $( compgen -W "$completions" -- $cur )) 43 | [ ${#COMPREPLY[@]} -gt 0 ] && return 0 44 | # Fall back to contexts extracted from done tasks. 45 | completions=$(eval 'TODOTXT_VERBOSE=0 TODOTXT_SOURCEVAR=\$DONE_FILE' $_todo_sh command listcon) 46 | ;; 47 | *) if [[ "$cur" =~ ^[0-9]+$ ]]; then 48 | # Remove the (padded) task number; we prepend the 49 | # user-provided $cur instead. 50 | # Remove the timestamp prepended by the -t option, 51 | # and the done date (for done tasks); there's no 52 | # todo.txt option for that yet. 53 | # But keep priority and "x"; they're short and may 54 | # provide useful context. 55 | # Remove any trailing whitespace; the Bash 56 | # completion inserts a trailing space itself. 57 | # Finally, limit the output to a single line just as 58 | # a safety check of the ls action output. 59 | local todo=$( \ 60 | eval TODOTXT_VERBOSE=0 $_todo_sh '-@ -+ -p -x command ls "^ *${cur} "' | \ 61 | sed -e 's/^ *[0-9]\{1,\} //' -e 's/\((.) \)[0-9]\{2,4\}-[0-9]\{2\}-[0-9]\{2\} /\1/' \ 62 | -e 's/\([xX] \)\([0-9]\{2,4\}-[0-9]\{2\}-[0-9]\{2\} \)\{1,2\}/\1/' \ 63 | -e 's/[[:space:]]*$//' \ 64 | -e '1q' \ 65 | ) 66 | # Append task text as a shell comment. This 67 | # completion can be a safety check before a 68 | # destructive todo.txt operation. 69 | [ "$todo" ] && COMPREPLY[0]="$cur # $todo" 70 | return 0 71 | else 72 | return 0 73 | fi 74 | ;; 75 | esac 76 | ;; 77 | esac 78 | fi 79 | 80 | COMPREPLY=( $( compgen -W "$completions" -- $cur )) 81 | return 0 82 | } 83 | complete -F _todo todo.sh 84 | 85 | # If you define an alias (e.g. "t") to todo.sh, you need to explicitly enable 86 | # completion for it, too: 87 | #complete -F _todo t 88 | 89 | # If you have renamed the todo.sh executable, or if it is not accessible through 90 | # PATH, you need to add and use a wrapper completion function, like this: 91 | #_todoElsewhere() 92 | #{ 93 | # local _todo_sh='/path/to/todo2.sh' 94 | # _todo "$@" 95 | #} 96 | #complete -F _todoElsewhere /path/to/todo2.sh 97 | 98 | # If you use aliases to use different configuration(s), you need to add and use 99 | # a wrapper completion function for each configuration if you want to complete 100 | # fron the actual configured task locations: 101 | #alias todo2='todo.sh -d "$HOME/todo2.cfg"' 102 | #_todo2() 103 | #{ 104 | # local _todo_sh='todo.sh -d "$HOME/todo2.cfg"' 105 | # _todo "$@" 106 | #} 107 | #complete -F _todo2 todo2 108 | -------------------------------------------------------------------------------- /plugins/available/git.plugin.bash: -------------------------------------------------------------------------------- 1 | cite about-plugin 2 | about-plugin 'git helper functions' 3 | 4 | function git_remote { 5 | about 'adds remote $GIT_HOSTING:$1 to current repo' 6 | group 'git' 7 | 8 | echo "Running: git remote add origin ${GIT_HOSTING}:$1.git" 9 | git remote add origin $GIT_HOSTING:$1.git 10 | } 11 | 12 | function git_first_push { 13 | about 'push into origin refs/heads/master' 14 | group 'git' 15 | 16 | echo "Running: git push origin master:refs/heads/master" 17 | git push origin master:refs/heads/master 18 | } 19 | 20 | function git_pub() { 21 | about 'publishes current branch to remote origin' 22 | group 'git' 23 | BRANCH=$(git rev-parse --abbrev-ref HEAD) 24 | 25 | echo "Publishing ${BRANCH} to remote origin" 26 | git push -u origin $BRANCH 27 | } 28 | 29 | function git_revert() { 30 | about 'applies changes to HEAD that revert all changes after this commit' 31 | group 'git' 32 | 33 | git reset $1 34 | git reset --soft HEAD@{1} 35 | git commit -m "Revert to ${1}" 36 | git reset --hard 37 | } 38 | 39 | function git_rollback() { 40 | about 'resets the current HEAD to this commit' 41 | group 'git' 42 | 43 | function is_clean() { 44 | if [[ $(git diff --shortstat 2> /dev/null | tail -n1) != "" ]]; then 45 | echo "Your branch is dirty, please commit your changes" 46 | kill -INT $$ 47 | fi 48 | } 49 | 50 | function commit_exists() { 51 | git rev-list --quiet $1 52 | status=$? 53 | if [ $status -ne 0 ]; then 54 | echo "Commit ${1} does not exist" 55 | kill -INT $$ 56 | fi 57 | } 58 | 59 | function keep_changes() { 60 | while true 61 | do 62 | read -p "Do you want to keep all changes from rolled back revisions in your working tree? [Y/N]" RESP 63 | case $RESP 64 | in 65 | [yY]) 66 | echo "Rolling back to commit ${1} with unstaged changes" 67 | git reset $1 68 | break 69 | ;; 70 | [nN]) 71 | echo "Rolling back to commit ${1} with a clean working tree" 72 | git reset --hard $1 73 | break 74 | ;; 75 | *) 76 | echo "Please enter Y or N" 77 | esac 78 | done 79 | } 80 | 81 | if [ -n "$(git symbolic-ref HEAD 2> /dev/null)" ]; then 82 | is_clean 83 | commit_exists $1 84 | 85 | while true 86 | do 87 | read -p "WARNING: This will change your history and move the current HEAD back to commit ${1}, continue? [Y/N]" RESP 88 | case $RESP 89 | in 90 | [yY]) 91 | keep_changes $1 92 | break 93 | ;; 94 | [nN]) 95 | break 96 | ;; 97 | *) 98 | echo "Please enter Y or N" 99 | esac 100 | done 101 | else 102 | echo "you're currently not in a git repository" 103 | fi 104 | } 105 | 106 | function git_remove_missing_files() { 107 | about "git rm's missing files" 108 | group 'git' 109 | 110 | git ls-files -d -z | xargs -0 git update-index --remove 111 | } 112 | 113 | # Adds files to git's exclude file (same as .gitignore) 114 | function local-ignore() { 115 | about 'adds file or path to git exclude file' 116 | param '1: file or path fragment to ignore' 117 | group 'git' 118 | echo "$1" >> .git/info/exclude 119 | } 120 | 121 | # get a quick overview for your git repo 122 | function git_info() { 123 | about 'overview for your git repo' 124 | group 'git' 125 | 126 | if [ -n "$(git symbolic-ref HEAD 2> /dev/null)" ]; then 127 | # print informations 128 | echo "git repo overview" 129 | echo "-----------------" 130 | echo 131 | 132 | # print all remotes and thier details 133 | for remote in $(git remote show); do 134 | echo $remote: 135 | git remote show $remote 136 | echo 137 | done 138 | 139 | # print status of working repo 140 | echo "status:" 141 | if [ -n "$(git status -s 2> /dev/null)" ]; then 142 | git status -s 143 | else 144 | echo "working directory is clean" 145 | fi 146 | 147 | # print at least 5 last log entries 148 | echo 149 | echo "log:" 150 | git log -5 --oneline 151 | echo 152 | 153 | else 154 | echo "you're currently not in a git repository" 155 | 156 | fi 157 | } 158 | 159 | function git_stats { 160 | about 'display stats per author' 161 | group 'git' 162 | 163 | # awesome work from https://github.com/esc/git-stats 164 | # including some modifications 165 | 166 | if [ -n "$(git symbolic-ref HEAD 2> /dev/null)" ]; then 167 | echo "Number of commits per author:" 168 | git --no-pager shortlog -sn --all 169 | AUTHORS=$( git shortlog -sn --all | cut -f2 | cut -f1 -d' ') 170 | LOGOPTS="" 171 | if [ "$1" == '-w' ]; then 172 | LOGOPTS="$LOGOPTS -w" 173 | shift 174 | fi 175 | if [ "$1" == '-M' ]; then 176 | LOGOPTS="$LOGOPTS -M" 177 | shift 178 | fi 179 | if [ "$1" == '-C' ]; then 180 | LOGOPTS="$LOGOPTS -C --find-copies-harder" 181 | shift 182 | fi 183 | for a in $AUTHORS 184 | do 185 | echo '-------------------' 186 | echo "Statistics for: $a" 187 | echo -n "Number of files changed: " 188 | git log $LOGOPTS --all --numstat --format="%n" --author=$a | cut -f3 | sort -iu | wc -l 189 | echo -n "Number of lines added: " 190 | git log $LOGOPTS --all --numstat --format="%n" --author=$a | cut -f1 | awk '{s+=$1} END {print s}' 191 | echo -n "Number of lines deleted: " 192 | git log $LOGOPTS --all --numstat --format="%n" --author=$a | cut -f2 | awk '{s+=$1} END {print s}' 193 | echo -n "Number of merges: " 194 | git log $LOGOPTS --all --merges --author=$a | grep -c '^commit' 195 | done 196 | else 197 | echo "you're currently not in a git repository" 198 | fi 199 | } 200 | 201 | --------------------------------------------------------------------------------