Merge remote-tracking branch 'upstream/master'

pull/301/head
Maxim Kovgan 2014-09-24 11:21:52 +03:00
commit 684e7c93d7
14 changed files with 601 additions and 549 deletions

View File

@ -44,6 +44,11 @@ There are a few bash it themes. If you've created your own custom prompts, I'd
You can see the theme screenshots [here](https://github.com/revans/bash-it/wiki/Themes) You can see the theme screenshots [here](https://github.com/revans/bash-it/wiki/Themes)
## Misc
Bash it creates a 'reload' alias that makes it convenient to reload
your bash profile when you make changes.
## Help out ## Help out
I think everyone has their own custom scripts accumulated over time. And so, following in the footsteps of oh-my-zsh, bash it is a framework for easily customizing your bash shell. Everyone's got a custom toolbox, so let's start making them even better, **as a community!** I think everyone has their own custom scripts accumulated over time. And so, following in the footsteps of oh-my-zsh, bash it is a framework for easily customizing your bash shell. Everyone's got a custom toolbox, so let's start making them even better, **as a community!**

View File

@ -5,6 +5,7 @@ case $OSTYPE in
linux*) linux*)
alias em='emacs' alias em='emacs'
alias e='emacsclient -n' alias e='emacsclient -n'
alias E='SUDO_EDITOR="emacsclient" sudo -e'
;; ;;
darwin*) darwin*)
alias em='open -a emacs' alias em='open -a emacs'

View File

@ -16,7 +16,7 @@ then
alias ls="ls --color=auto" alias ls="ls --color=auto"
fi fi
which gshuf &> /dev/null which gshuf &> /dev/null
if [ $? -eq 1 ] if [ $? -eq 0 ]
then then
alias shuf=gshuf alias shuf=gshuf
fi fi

View File

@ -0,0 +1,73 @@
cite 'about-alias'
about-alias 'laravel artisan abbreviations'
# A list of useful laravel aliases
# asset
alias a:apub='php artisan asset:publish'
# auth
alias a:remclear='php artisan auth:clear-reminders'
alias a:remcontroller='php artisan auth:reminders-controller'
alias a:remtable='php artisan auth:reminders-table'
# cache
alias a:cacheclear='php artisan cache:clear'
# command
alias a:command='php artisan command:make'
# config
alias a:confpub='php artisan config:publish'
# controller
alias a:controller='php artisan controller:make'
# db
alias a:seed='php artisan db:seed'
# key
alias a:key='php artisan key:generate'
# migrate
alias a:migrate='php artisan migrate'
alias a:mig='a:migrate'
alias a:miginstall='php artisan migrate:install'
alias a:migmake='php artisan migrate:make'
alias a:migcreate='php artisan migrate:create'
alias a:migpublish='php artisan migrate:publish'
alias a:migrefresh='php artisan migrate:refresh'
alias a:migreset='php artisan migrate:reset'
alias a:migrollback='php artisan migrate:rollback'
alias a:rollback='a:migrollback'
# queue
alias a:qfailed='php artisan queue:failed'
alias a:qfailedtable='php artisan queue:failed-table'
alias a:qflush='php artisan queue:flush'
alias a:qforget='php artisan queue:forget'
alias a:qlisten='php artisan queue:listen'
alias a:qretry='php artisan queue:retry'
alias a:qsubscribe='php artisan queue:subscribe'
alias a:qwork='php artisan queue:work'
# session
alias a:stable='php artisan session:table'
# view
alias a:vpub='php artisan view:publish'
# misc
alias a:='php artisan'
alias a:changes='php artisan changes'
alias a:down='php artisan down'
alias a:env='php artisan env'
alias a:help='php artisan help'
alias a:list='php artisan list'
alias a:optimize='php artisan optimize'
alias a:routes='php artisan routes'
alias a:serve='php artisan serve'
alias a:tail='php artisan tail'
alias a:tinker='php artisan tinker'
alias a:up='php artisan up'
alias a:work='php artisan workbench'

View File

@ -27,10 +27,14 @@ fi
alias grnot='growlnotify -s -t Terminal -m "Done"' alias grnot='growlnotify -s -t Terminal -m "Done"'
# Get rid of those pesky .DS_Store files recursively # Get rid of those pesky .DS_Store files recursively
alias dsclean='find . -type f -name .DS_Store -print0 | xargs -0 rm' alias dsclean='find . -type f -name .DS_Store -delete'
# Track who is listening to your iTunes music # Track who is listening to your iTunes music
alias whotunes='lsof -r 2 -n -P -F n -c iTunes -a -i TCP@`hostname`:3689' alias whotunes='lsof -r 2 -n -P -F n -c iTunes -a -i TCP@`hostname`:3689'
# Flush your dns cache # Flush your dns cache
alias flush='dscacheutil -flushcache' alias flush='dscacheutil -flushcache'
# Show/hide hidden files (for Mac OS X Mavericks)
alias showhidden="defaults write com.apple.finder AppleShowAllFiles TRUE"
alias hidehidden="defaults write com.apple.finder AppleShowAllFiles FALSE"

View File

@ -7,7 +7,7 @@ alias rg='rails g'
alias rs='rails s' alias rs='rails s'
alias rc='rails c' alias rc='rails c'
alias rn='rails new' alias rn='rails new'
alias rd='rails dbconsole' alias rb='rails dbconsole'
alias rp='rails plugin' alias rp='rails plugin'
alias ra='rails application' alias ra='rails application'
alias rd='rails destroy' alias rd='rails destroy'

View File

File diff suppressed because it is too large Load Diff

View File

@ -1,14 +1,14 @@
cite about-plugin cite about-plugin
about-plugin 'miscellaneous tools' about-plugin 'miscellaneous tools'
ips () function ips ()
{ {
about 'display all ip addresses for this host' about 'display all ip addresses for this host'
group 'base' group 'base'
ifconfig | grep "inet " | awk '{ print $2 }' ifconfig | grep "inet " | awk '{ print $2 }'
} }
down4me () function down4me ()
{ {
about 'checks whether a website is down for you, or everybody' about 'checks whether a website is down for you, or everybody'
param '1: website url' param '1: website url'
@ -17,7 +17,7 @@ down4me ()
curl -s "http://www.downforeveryoneorjustme.com/$1" | sed '/just you/!d;s/<[^>]*>//g' curl -s "http://www.downforeveryoneorjustme.com/$1" | sed '/just you/!d;s/<[^>]*>//g'
} }
myip () function myip ()
{ {
about 'displays your ip address, as seen by the Internet' about 'displays your ip address, as seen by the Internet'
group 'base' group 'base'
@ -26,7 +26,7 @@ myip ()
} }
pickfrom () function pickfrom ()
{ {
about 'picks random line from file' about 'picks random line from file'
param '1: filename' param '1: filename'
@ -39,7 +39,7 @@ pickfrom ()
head -n $n $file | tail -1 head -n $n $file | tail -1
} }
pass () function pass ()
{ {
about 'generates random password from dictionary words' about 'generates random password from dictionary words'
param 'optional integer length' param 'optional integer length'
@ -53,7 +53,7 @@ pass ()
echo "Without (use this as the pass): $(echo $pass | tr -d ' ')" echo "Without (use this as the pass): $(echo $pass | tr -d ' ')"
} }
pmdown () function pmdown ()
{ {
about 'preview markdown file in a browser' about 'preview markdown file in a browser'
param '1: markdown file' param '1: markdown file'
@ -67,7 +67,7 @@ pmdown ()
fi fi
} }
mkcd () function mkcd ()
{ {
about 'make a directory and cd into it' about 'make a directory and cd into it'
param 'path to create' param 'path to create'
@ -78,7 +78,7 @@ mkcd ()
cd "$*" cd "$*"
} }
lsgrep () function lsgrep ()
{ {
about 'search through directory contents with grep' about 'search through directory contents with grep'
group 'base' group 'base'
@ -86,7 +86,7 @@ lsgrep ()
} }
pman () function pman ()
{ {
about 'view man documentation in Preview' about 'view man documentation in Preview'
param '1: man page to view' param '1: man page to view'
@ -96,7 +96,7 @@ pman ()
} }
pcurl () function pcurl ()
{ {
about 'download file and Preview it' about 'download file and Preview it'
param '1: download URL' param '1: download URL'
@ -105,7 +105,7 @@ pcurl ()
curl "${1}" | open -f -a $PREVIEW curl "${1}" | open -f -a $PREVIEW
} }
pri () function pri ()
{ {
about 'display information about Ruby classes, modules, or methods, in Preview' about 'display information about Ruby classes, modules, or methods, in Preview'
param '1: Ruby method, module, or class' param '1: Ruby method, module, or class'
@ -114,14 +114,14 @@ pri ()
ri -T "${1}" | open -f -a $PREVIEW ri -T "${1}" | open -f -a $PREVIEW
} }
quiet () function quiet ()
{ {
about 'what *does* this do?' about 'what *does* this do?'
group 'base' group 'base'
$* &> /dev/null & $* &> /dev/null &
} }
banish-cookies () function banish-cookies ()
{ {
about 'redirect .adobe and .macromedia files to /dev/null' about 'redirect .adobe and .macromedia files to /dev/null'
group 'base' group 'base'
@ -130,7 +130,7 @@ banish-cookies ()
ln -s /dev/null ~/.macromedia ln -s /dev/null ~/.macromedia
} }
usage () function usage ()
{ {
about 'disk usage per directory, in Mac OS X and Linux' about 'disk usage per directory, in Mac OS X and Linux'
param '1: directory name' param '1: directory name'
@ -153,7 +153,7 @@ usage ()
if [ ! -e $BASH_IT/plugins/enabled/todo.plugin.bash ]; then if [ ! -e $BASH_IT/plugins/enabled/todo.plugin.bash ]; then
# if user has installed todo plugin, skip this... # if user has installed todo plugin, skip this...
t () function t ()
{ {
about 'one thing todo' about 'one thing todo'
param 'if not set, display todo item' param 'if not set, display todo item'
@ -166,7 +166,7 @@ if [ ! -e $BASH_IT/plugins/enabled/todo.plugin.bash ]; then
} }
fi fi
command_exists () function command_exists ()
{ {
about 'checks for existence of a command' about 'checks for existence of a command'
param '1: command to check' param '1: command to check'
@ -203,7 +203,7 @@ mkiso ()
} }
# useful for administrators and configs # useful for administrators and configs
buf () function buf ()
{ {
about 'back up file with timestamp' about 'back up file with timestamp'
param 'filename' param 'filename'

View File

@ -5,4 +5,21 @@ about-plugin 'Helpers to get Docker setup correctly for boot2docker'
# of boot2docker, or its configured for a different IP # of boot2docker, or its configured for a different IP
if [[ `uname -s` == "Darwin" ]]; then if [[ `uname -s` == "Darwin" ]]; then
export DOCKER_HOST=tcp://192.168.59.103:2375 export DOCKER_HOST=tcp://192.168.59.103:2375
docker-enter() {
boot2docker ssh '[ -f /var/lib/boot2docker/nsenter ] || docker run --rm -v /var/lib/boot2docker/:/target jpetazzo/nsenter'
boot2docker ssh -t sudo "/var/lib/boot2docker/docker-enter \"$1\""
}
fi fi
function docker-remove-most-recent-container() {
about 'attempt to remove the most recent container from docker ps -a'
group 'docker'
docker ps -a | head -2 | tail -1 | awk '{print $NF}' | xargs docker rm
}
function docker-remove-most-recent-image() {
about 'attempt to remove the most recent image from docker images'
group 'docker'
docker images | head -2 | tail -1 | awk '{print $3}' | xargs docker rmi
}

View File

@ -16,6 +16,16 @@ function tab() {
EOF EOF
} }
# renames the current os x terminal tab title
function tabname {
printf "\e]1;$1\a"
}
# renames the current os x terminal window title
function winname {
printf "\e]2;$1\a"
}
# this one switches your os x dock between 2d and 3d # this one switches your os x dock between 2d and 3d
# thanks to savier.zwetschge.org # thanks to savier.zwetschge.org
function dock-switch() { function dock-switch() {

View File

@ -74,8 +74,8 @@ function git_prompt_vars {
SCM_GIT_BEHIND='' SCM_GIT_BEHIND=''
SCM_GIT_STASH='' SCM_GIT_STASH=''
if [[ "$(git config --get bash-it.hide-status)" != "1" ]]; then if [[ "$(git config --get bash-it.hide-status)" != "1" ]]; then
local status="$(git status -bs --porcelain 2> /dev/null)" local status="$(git status -b --porcelain 2> /dev/null || git status --porcelain 2> /dev/null)"
if [[ -n "$(grep -v ^# <<< "${status}")" ]]; then if [[ -n "${status}" ]] && [[ "${status}" != "\n" ]] && [[ -n "$(grep -v ^# <<< "${status}")" ]]; then
SCM_DIRTY=1 SCM_DIRTY=1
SCM_STATE=${GIT_THEME_PROMPT_DIRTY:-$SCM_THEME_PROMPT_DIRTY} SCM_STATE=${GIT_THEME_PROMPT_DIRTY:-$SCM_THEME_PROMPT_DIRTY}
else else
@ -89,9 +89,9 @@ function git_prompt_vars {
SCM_PREFIX=${GIT_THEME_PROMPT_PREFIX:-$SCM_THEME_PROMPT_PREFIX} SCM_PREFIX=${GIT_THEME_PROMPT_PREFIX:-$SCM_THEME_PROMPT_PREFIX}
SCM_SUFFIX=${GIT_THEME_PROMPT_SUFFIX:-$SCM_THEME_PROMPT_SUFFIX} SCM_SUFFIX=${GIT_THEME_PROMPT_SUFFIX:-$SCM_THEME_PROMPT_SUFFIX}
local ref=$(git symbolic-ref -q --short HEAD 2> /dev/null) local ref=$(git symbolic-ref -q HEAD 2> /dev/null)
if [[ -n "$ref" ]]; then if [[ -n "$ref" ]]; then
SCM_BRANCH=$ref SCM_BRANCH=${ref#refs/heads/}
SCM_IS_BRANCH=1 SCM_IS_BRANCH=1
SCM_IS_TAG=0 SCM_IS_TAG=0
else else
@ -99,7 +99,6 @@ function git_prompt_vars {
SCM_IS_TAG=1 SCM_IS_TAG=1
SCM_IS_BRANCH=0 SCM_IS_BRANCH=0
fi fi
# SCM_BRANCH=$(git symbolic-ref -q --short HEAD || git describe --tags --exact-match 2> /dev/null)
SCM_CHANGE=$(git rev-parse HEAD 2>/dev/null) SCM_CHANGE=$(git rev-parse HEAD 2>/dev/null)
local ahead_re='.+ahead ([0-9]+).+' local ahead_re='.+ahead ([0-9]+).+'
local behind_re='.+behind ([0-9]+).+' local behind_re='.+behind ([0-9]+).+'

View File

@ -83,7 +83,7 @@ IP_SEPARATOR=', '
# FUNCS ======================================================================= # FUNCS =======================================================================
function ip { function get_ip_info {
myip=$(curl -s checkip.dyndns.org | grep -Eo '[0-9\.]+') myip=$(curl -s checkip.dyndns.org | grep -Eo '[0-9\.]+')
echo -e "$(ips | sed -e :a -e '$!N;s/\n/${IP_SEPARATOR}/;ta' | sed -e 's/127\.0\.0\.1\${IP_SEPARATOR}//g'), ${myip}" echo -e "$(ips | sed -e :a -e '$!N;s/\n/${IP_SEPARATOR}/;ta' | sed -e 's/127\.0\.0\.1\${IP_SEPARATOR}//g'), ${myip}"
} }
@ -91,7 +91,7 @@ function ip {
# Displays ip prompt # Displays ip prompt
function ip_prompt_info() { function ip_prompt_info() {
if [[ $IP_ENABLED == 1 ]]; then if [[ $IP_ENABLED == 1 ]]; then
echo -e " ${DEFAULT_COLOR}(${IP_COLOR}$(ip)${DEFAULT_COLOR})" echo -e " ${DEFAULT_COLOR}(${IP_COLOR}$(get_ip_info)${DEFAULT_COLOR})"
fi fi
} }

View File

@ -40,11 +40,17 @@ function git_prompt_info {
echo -e "$SCM_PREFIX$SCM_BRANCH$SCM_STATE$SCM_GIT_AHEAD$SCM_GIT_BEHIND$SCM_GIT_STASH$SCM_SUFFIX" echo -e "$SCM_PREFIX$SCM_BRANCH$SCM_STATE$SCM_GIT_AHEAD$SCM_GIT_BEHIND$SCM_GIT_STASH$SCM_SUFFIX"
} }
LAST_PROMPT_INFO=""
function prompt_command() { function prompt_command() {
local prompt_info="${bold_cyan}$(scm_char)${yellow}$(ruby_version_prompt)${green}\w $(scm_prompt_info)" local prompt_info="\n${bold_cyan}$(scm_char)${yellow}$(ruby_version_prompt)${green}\w $(scm_prompt_info)"
if [ "$LAST_PROMPT_INFO" = "$prompt_info" ]; then
prompt_info=""
else
LAST_PROMPT_INFO="$prompt_info"
fi
local wrap_char="" local wrap_char=""
[[ ${#prompt_info} -gt $(($COLUMNS/1)) ]] && wrap_char="\n" [[ ${#prompt_info} -gt $(($COLUMNS/1)) ]] && wrap_char="\n"
PS1="\n${prompt_info}${green}${wrap_char}${reset_color} " PS1="${prompt_info}${green}${wrap_char}${reset_color} "
} }
PROMPT_COMMAND=prompt_command; PROMPT_COMMAND=prompt_command;