Merge branch 'master' of https://github.com/Bash-it/bash-it
commit
60509836d7
17
README.md
17
README.md
|
|
@ -189,6 +189,7 @@ There are over 50+ Bash-it themes to pick from in `$BASH_IT/themes`.
|
|||
The default theme is `bobby`.
|
||||
Set `BASH_IT_THEME` to the theme name you want, or if you've developed your own custom theme outside of `$BASH_IT/themes`,
|
||||
point the `BASH_IT_THEME` variable directly to the theme file.
|
||||
To disable theming completely, leave the variable empty.
|
||||
|
||||
Examples:
|
||||
|
||||
|
|
@ -198,6 +199,9 @@ export BASH_IT_THEME="powerline-multiline"
|
|||
|
||||
# Use a theme outside of the Bash-it folder
|
||||
export BASH_IT_THEME="/home/foo/my_theme/my_theme.theme.bash"
|
||||
|
||||
# Disable theming
|
||||
export BASH_IT_THEME=""
|
||||
```
|
||||
|
||||
You can easily preview the themes in your own shell using `BASH_PREVIEW=true bash-it reload`.
|
||||
|
|
@ -312,6 +316,19 @@ Also, with this flag to false, Bash-it will not show the repository as dirty whe
|
|||
|
||||
**NOTE:** If you set in git configuration file the option to ignore *untracked* files, this flag has no effect, and Bash-it will ignore *untracked* files always.
|
||||
|
||||
### Stash item count
|
||||
|
||||
When `SCM_GIT_SHOW_DETAILS` is enabled, you can get the count of *stashed* items. This feature can be useful when a user has a lot of stash items.
|
||||
This feature is controlled through the flag `SCM_GIT_SHOW_STASH_INFO` as follows:
|
||||
|
||||
Set `SCM_GIT_SHOW_STASH_INFO` to 'true' (the default value) to **show** the count of stashed items:
|
||||
|
||||
* `export SCM_GIT_SHOW_STASH_INFO=true`
|
||||
|
||||
Set `SCM_GIT_SHOW_STASH_INFO` to 'false' to **don't show** it:
|
||||
|
||||
* `export SCM_GIT_SHOW_STASH_INFO=false`
|
||||
|
||||
### Git user
|
||||
|
||||
In some environments, it is useful to know the value of the current git user, which is used to mark all new commits.
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
cite 'about-alias'
|
||||
about-alias 'puppet bolt aliases'
|
||||
|
||||
# Aliases
|
||||
alias bolt='bolt command run --tty --no-host-key-check'
|
||||
alias boltas='bolt -p -u'
|
||||
alias sudobolt='bolt --run-as root --sudo-password'
|
||||
alias sudoboltas='sudobolt -p -u'
|
||||
|
|
@ -4,3 +4,4 @@ about-alias 'docker-compose abbreviations'
|
|||
alias dco="docker-compose"
|
||||
alias dcofresh="docker-compose-fresh"
|
||||
alias dcol="docker-compose logs -f --tail 100"
|
||||
alias dcou="docker-compose up"
|
||||
|
|
|
|||
|
|
@ -25,3 +25,9 @@ alias dkrmi='docker-remove-images' # Delete images for supplied IDs or all if n
|
|||
alias dkideps='docker-image-dependencies' # Output a graph of image dependencies using Graphiz
|
||||
alias dkre='docker-runtime-environment' # List environmental variables of the supplied image ID
|
||||
alias dkelc='docker exec -it `dklcid` bash' # Enter last container (works with Docker 1.3 and above)
|
||||
alias dkex='docker exec -it ' # Useful to run any commands into container without leaving host
|
||||
|
||||
# Added more recent cleanup options from newer docker versions
|
||||
alias dkip='docker image prune -a -f'
|
||||
alias dkvp='docker volume prune -f'
|
||||
alias dksp='docker system prune -a -f'
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ alias bcin='brew cask install'
|
|||
alias bcrm='brew cask uninstall'
|
||||
alias bczp='brew cask zap'
|
||||
alias bccl='brew cask cleanup'
|
||||
alias bcsr='brew cask search'
|
||||
alias bcls='brew cask list'
|
||||
alias bcinf='brew cask info'
|
||||
alias bcdr='brew cask doctor'
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# -binaryanomaly
|
||||
|
||||
cite 'about-alias'
|
||||
about-alias 'kubectl aliases'
|
||||
|
||||
# set apt aliases
|
||||
function _set_pkg_aliases()
|
||||
{
|
||||
if [ -x $(which kubectl) ]; then
|
||||
alias kc='kubectl'
|
||||
alias kcgp='kubectl get pods'
|
||||
alias kcgd='kubectl get deployments'
|
||||
alias kcgn='kubectl get nodes'
|
||||
alias kcdp='kubectl describe pod'
|
||||
alias kcdd='kubectl describe deployment'
|
||||
alias kcdn='kubectl describe node'
|
||||
alias kcgpan='kubectl get pods --all-namespaces'
|
||||
alias kcgdan='kubectl get deployments --all-namespaces'
|
||||
fi
|
||||
}
|
||||
|
||||
_set_pkg_aliases
|
||||
|
|
@ -3,9 +3,12 @@ about-alias 'maven abbreviations'
|
|||
|
||||
alias mci='mvn clean install'
|
||||
alias mi='mvn install'
|
||||
alias mcp='mvn clean package'
|
||||
alias mp='mvn package'
|
||||
alias mrprep='mvn release:prepare'
|
||||
alias mrperf='mvn release:perform'
|
||||
alias mrrb='mvn release:rollback'
|
||||
alias mdep='mvn dependency:tree'
|
||||
alias mpom='mvn help:effective-pom'
|
||||
alias mcisk='mci -Dmaven.test.skip=true'
|
||||
alias mcpsk='mcp -Dmaven.test.skip=true'
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
cite 'about-alias'
|
||||
about-alias 'puppet aliases'
|
||||
|
||||
# Aliases
|
||||
alias pupval="puppet parser validate *.pp"
|
||||
alias puplint="puppet-lint *.pp"
|
||||
alias pupagt="puppet agent -t"
|
||||
alias pupagtd="puppet agent -t --debug"
|
||||
alias pupapp="puppet apply"
|
||||
|
||||
27
bash_it.sh
27
bash_it.sh
|
|
@ -46,19 +46,22 @@ do
|
|||
_load_bash_it_files $file_type
|
||||
done
|
||||
|
||||
# Load colors and helpers first so they can be used in base theme
|
||||
# shellcheck source=./themes/colors.theme.bash
|
||||
source "${BASH_IT}/themes/colors.theme.bash"
|
||||
# shellcheck source=./themes/githelpers.theme.bash
|
||||
source "${BASH_IT}/themes/githelpers.theme.bash"
|
||||
# shellcheck source=./themes/p4helpers.theme.bash
|
||||
source "${BASH_IT}/themes/p4helpers.theme.bash"
|
||||
# shellcheck source=./themes/base.theme.bash
|
||||
source "${BASH_IT}/themes/base.theme.bash"
|
||||
# Load theme, if a theme was set
|
||||
if [[ ! -z "${BASH_IT_THEME}" ]]; then
|
||||
# Load colors and helpers first so they can be used in base theme
|
||||
# shellcheck source=./themes/colors.theme.bash
|
||||
source "${BASH_IT}/themes/colors.theme.bash"
|
||||
# shellcheck source=./themes/githelpers.theme.bash
|
||||
source "${BASH_IT}/themes/githelpers.theme.bash"
|
||||
# shellcheck source=./themes/p4helpers.theme.bash
|
||||
source "${BASH_IT}/themes/p4helpers.theme.bash"
|
||||
# shellcheck source=./themes/base.theme.bash
|
||||
source "${BASH_IT}/themes/base.theme.bash"
|
||||
|
||||
# appearance (themes) now, after all dependencies
|
||||
# shellcheck source=./lib/appearance.bash
|
||||
source "$APPEARANCE_LIB"
|
||||
# appearance (themes) now, after all dependencies
|
||||
# shellcheck source=./lib/appearance.bash
|
||||
source "$APPEARANCE_LIB"
|
||||
fi
|
||||
|
||||
# Load custom aliases, completion, plugins
|
||||
for file_type in "aliases" "completion" "plugins"
|
||||
|
|
|
|||
|
|
@ -21,6 +21,9 @@ __bundle() {
|
|||
if [[ -z $bundle_command ]]; then
|
||||
options="$options --version --help"
|
||||
fi
|
||||
elif [[ $bundle_command = "exec" ]]; then
|
||||
_bundle_exec_completions
|
||||
return
|
||||
else
|
||||
if [[ -z $bundle_command || $bundle_command = help ]]; then
|
||||
options="help install update package exec config check list show
|
||||
|
|
@ -53,3 +56,10 @@ __bundle_get_command() {
|
|||
|
||||
complete -F __bundle -o bashdefault -o default bundle
|
||||
# vim: ai ft=sh sw=4 sts=2 et
|
||||
|
||||
_bundle_exec_completions()
|
||||
{
|
||||
if [[ $COMP_CWORD = 2 ]]; then
|
||||
COMPREPLY=($(compgen -c -- "$2"))
|
||||
fi
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,19 @@
|
|||
#!/bin/bash
|
||||
# Lerna autocompletion.
|
||||
function _lerna_completions() {
|
||||
local cur compls
|
||||
|
||||
# The currently-being-completed word.
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
|
||||
# Options
|
||||
compls="add bootstrap changed clean create diff exec \
|
||||
import init link list publish run version \
|
||||
--loglevel --concurrency --reject-cycles \
|
||||
--progress --sort --no-sort --help \
|
||||
--version"
|
||||
|
||||
# Tell complete what stuff to show.
|
||||
COMPREPLY=($(compgen -W "$compls" -- "$cur"))
|
||||
}
|
||||
complete -o default -F _lerna_completions lerna
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# minikube (Local Kubernetes) completion
|
||||
|
||||
if command -v minikube &>/dev/null
|
||||
then
|
||||
eval "$(minikube completion bash)"
|
||||
fi
|
||||
|
|
@ -27,10 +27,14 @@ _sdkman_complete()
|
|||
esac
|
||||
elif [ $COMP_CWORD -eq 3 ]; then
|
||||
case "${COMP_WORDS[COMP_CWORD-2]}" in
|
||||
"install" | "uninstall" | "rm" | "use" | "default" )
|
||||
"uninstall" | "rm" | "use" | "default" )
|
||||
_sdkman_candidate_versions ${COMP_WORDS[COMP_CWORD-1]}
|
||||
COMPREPLY=( $(compgen -W "$CANDIDATE_VERSIONS" -- ${COMP_WORDS[COMP_CWORD]}) )
|
||||
;;
|
||||
"install")
|
||||
_sdkman_candidate_not_installed_versions ${COMP_WORDS[COMP_CWORD-1]}
|
||||
COMPREPLY=( $(compgen -W "$CANDIDATE_VERSIONS" -- ${COMP_WORDS[COMP_CWORD]}) )
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
|
@ -51,6 +55,14 @@ _sdkman_candidate_versions(){
|
|||
|
||||
}
|
||||
|
||||
_sdkman_candidate_not_installed_versions(){
|
||||
CANDIDATE_LOCAL_VERSIONS=$(__sdkman_cleanup_local_versions $1)
|
||||
if [ "$SDKMAN_OFFLINE_MODE" = "false" ]; then
|
||||
CANDIDATE_ONLINE_VERSIONS="$(__sdkman_list_versions $1 | grep " " | grep "\." | cut -c 6-)"
|
||||
CANDIDATE_VERSIONS="$(echo $CANDIDATE_ONLINE_VERSIONS $CANDIDATE_LOCAL_VERSIONS | tr ' ' '\n' | sort | uniq -u) "
|
||||
fi
|
||||
}
|
||||
|
||||
__sdkman_cleanup_local_versions(){
|
||||
|
||||
__sdkman_build_version_csv $1 | tr ',' ' '
|
||||
|
|
|
|||
|
|
@ -11,11 +11,16 @@ _sshcomplete() {
|
|||
local OPTIONS=" -- ${CURRENT_PROMPT}"
|
||||
fi
|
||||
|
||||
|
||||
# parse all defined hosts from .ssh/config
|
||||
if [ -r "$HOME/.ssh/config" ]; then
|
||||
COMPREPLY=($(compgen -W "$(grep -i ^Host "$HOME/.ssh/config" | awk '{for (i=2; i<=NF; i++) print $i}' )" ${OPTIONS}) )
|
||||
fi
|
||||
# parse all defined hosts from .ssh/config and files included there
|
||||
for fl in "$HOME/.ssh/config" \
|
||||
$(grep "^\s*Include" "$HOME/.ssh/config" |
|
||||
awk '{for (i=2; i<=NF; i++) print $i}' |
|
||||
sed "s|^~/|$HOME/|")
|
||||
do
|
||||
if [ -r "$fl" ]; then
|
||||
COMPREPLY=( ${COMPREPLY[@]} $(compgen -W "$(grep -i ^Host "$fl" |grep -v '[*!]' | awk '{for (i=2; i<=NF; i++) print $i}' )" ${OPTIONS}) )
|
||||
fi
|
||||
done
|
||||
|
||||
# parse all hosts found in .ssh/known_hosts
|
||||
if [ -r "$HOME/.ssh/known_hosts" ]; then
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ if [ $(uname) = "Darwin" ] && command -v brew &>/dev/null ; then
|
|||
. "$BREW_PREFIX"/etc/bash_completion
|
||||
fi
|
||||
|
||||
# homebrew/versions/bash-completion2 (required for projects.completion.bash) is installed to this path
|
||||
if [ -f "$BREW_PREFIX"/share/bash-completion/bash_completion ]; then
|
||||
# homebrew/versions/bash-completion2 (required for projects.completion.bash) is installed to this path
|
||||
if [ "${BASH_VERSINFO}" -ge 4 ] && [ -f "$BREW_PREFIX"/share/bash-completion/bash_completion ]; then
|
||||
. "$BREW_PREFIX"/share/bash-completion/bash_completion
|
||||
fi
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ function reload_plugins() {
|
|||
bash-it ()
|
||||
{
|
||||
about 'Bash-it help and maintenance'
|
||||
param '1: verb [one of: help | show | enable | disable | migrate | update | search | version | reload ] '
|
||||
param '1: verb [one of: help | show | enable | disable | migrate | update | search | version | reload ] '
|
||||
param '2: component type [one of: alias(es) | completion(s) | plugin(s) ] or search term(s)'
|
||||
param '3: specific component [optional]'
|
||||
example '$ bash-it show plugins'
|
||||
|
|
@ -79,28 +79,28 @@ bash-it ()
|
|||
shift
|
||||
typeset func
|
||||
case $verb in
|
||||
show)
|
||||
func=_bash-it-$component;;
|
||||
enable)
|
||||
func=_enable-$component;;
|
||||
disable)
|
||||
func=_disable-$component;;
|
||||
help)
|
||||
func=_help-$component;;
|
||||
search)
|
||||
_bash-it-search $component "$@"
|
||||
return;;
|
||||
update)
|
||||
func=_bash-it_update;;
|
||||
migrate)
|
||||
func=_bash-it-migrate;;
|
||||
version)
|
||||
func=_bash-it-version;;
|
||||
reload)
|
||||
func=_bash-it-reload;;
|
||||
*)
|
||||
reference bash-it
|
||||
return;;
|
||||
show)
|
||||
func=_bash-it-$component;;
|
||||
enable)
|
||||
func=_enable-$component;;
|
||||
disable)
|
||||
func=_disable-$component;;
|
||||
help)
|
||||
func=_help-$component;;
|
||||
search)
|
||||
_bash-it-search $component "$@"
|
||||
return;;
|
||||
update)
|
||||
func=_bash-it_update;;
|
||||
migrate)
|
||||
func=_bash-it-migrate;;
|
||||
version)
|
||||
func=_bash-it-version;;
|
||||
reload)
|
||||
func=_bash-it-reload;;
|
||||
*)
|
||||
reference bash-it
|
||||
return;;
|
||||
esac
|
||||
|
||||
# pluralize component if necessary
|
||||
|
|
@ -187,7 +187,7 @@ _bash-it_update() {
|
|||
_bash-it-migrate
|
||||
echo ""
|
||||
echo "All done, enjoy!"
|
||||
reload
|
||||
bash-it reload
|
||||
else
|
||||
echo "Error updating Bash-it, please, check if your Bash-it installation folder (${BASH_IT}) is clean."
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,11 +1,14 @@
|
|||
cite about-plugin
|
||||
about-plugin 'AWS helper functions'
|
||||
|
||||
AWS_CONFIG_FILE="${AWS_CONFIG_FILE:-$HOME/.aws/config}"
|
||||
AWS_SHARED_CREDENTIALS_FILE="${AWS_SHARED_CREDENTIALS_FILE:-$HOME/.aws/credentials}"
|
||||
|
||||
function awskeys {
|
||||
about 'helper function for AWS credentials file'
|
||||
group 'aws'
|
||||
|
||||
if [[ ! -f ~/.aws/credentials ]]; then
|
||||
if [[ ! -f "${AWS_SHARED_CREDENTIALS_FILE}" ]]; then
|
||||
echo "AWS credentials file not found"
|
||||
return 1
|
||||
fi
|
||||
|
|
@ -35,14 +38,14 @@ function __awskeys_help {
|
|||
}
|
||||
|
||||
function __awskeys_get {
|
||||
local ln=$(grep -n "\[ *$1 *\]" ~/.aws/credentials | cut -d ":" -f 1)
|
||||
local ln=$(grep -n "\[ *$1 *\]" "${AWS_SHARED_CREDENTIALS_FILE}" | cut -d ":" -f 1)
|
||||
if [[ -n "${ln}" ]]; then
|
||||
tail -n +${ln} ~/.aws/credentials | egrep -m 2 "aws_access_key_id|aws_secret_access_key"
|
||||
tail -n +${ln} "${AWS_SHARED_CREDENTIALS_FILE}" | egrep -m 3 "aws_access_key_id|aws_secret_access_key|aws_session_token"
|
||||
fi
|
||||
}
|
||||
|
||||
function __awskeys_list {
|
||||
local credentials_list="$((egrep '^\[ *[a-zA-Z0-9_-]+ *\]$' ~/.aws/credentials; grep "\[profile" ~/.aws/config | sed "s|\[profile |\[|g") | sort | uniq)"
|
||||
local credentials_list="$((egrep '^\[ *[a-zA-Z0-9_-]+ *\]$' "${AWS_SHARED_CREDENTIALS_FILE}"; grep "\[profile" "${AWS_CONFIG_FILE}" | sed "s|\[profile |\[|g") | sort | uniq)"
|
||||
if [[ -n $"{credentials_list}" ]]; then
|
||||
echo -e "Available credentials profiles:\n"
|
||||
for profile in ${credentials_list}; do
|
||||
|
|
@ -72,14 +75,14 @@ function __awskeys_export {
|
|||
export "$(echo ${key} | tr [:lower:] [:upper:])=${p_key#*=}"
|
||||
done
|
||||
fi
|
||||
export AWS_DEFAULT_PROFILE="$1"
|
||||
export AWS_PROFILE="$1"
|
||||
else
|
||||
echo "Profile $1 not found in credentials file"
|
||||
fi
|
||||
}
|
||||
|
||||
function __awskeys_unset {
|
||||
unset AWS_DEFAULT_PROFILE AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY
|
||||
unset AWS_PROFILE AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN
|
||||
}
|
||||
|
||||
function __awskeys_comp {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,10 @@ about-plugin 'load fzf, if you are using it'
|
|||
|
||||
[ -f ~/.fzf.bash ] && source ~/.fzf.bash
|
||||
|
||||
if [ -z ${FZF_DEFAULT_COMMAND+x} ]; then
|
||||
command -v fd &> /dev/null && export FZF_DEFAULT_COMMAND='fd --type f'
|
||||
fi
|
||||
|
||||
fe() {
|
||||
about "Open the selected file in the default editor"
|
||||
group "fzf"
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ about-plugin 'go environment variables & path configuration'
|
|||
|
||||
[ ! command -v go &>/dev/null ] && return
|
||||
|
||||
export GOROOT=${GOROOT:-$(go env | grep GOROOT | cut -d'"' -f2)}
|
||||
export GOROOT=${GOROOT:-$(go env GOROOT)}
|
||||
pathmunge "${GOROOT}/bin"
|
||||
export GOPATH=${GOPATH:-"$HOME/go"}
|
||||
export GOPATH=${GOPATH:-$(go env GOPATH)}
|
||||
pathmunge "${GOPATH}/bin"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
cite about-plugin
|
||||
about-plugin 'initialize jump (see https://github.com/gsamokovarov/jump)'
|
||||
|
||||
__init_jump() {
|
||||
command -v jump &> /dev/null || return
|
||||
eval "$(jump shell --bind=z)"
|
||||
}
|
||||
|
||||
__init_jump
|
||||
|
|
@ -5,7 +5,7 @@ about-plugin 'osx-specific functions'
|
|||
if [ $(uname) = "Darwin" ]; then
|
||||
if type update_terminal_cwd > /dev/null 2>&1 ; then
|
||||
if ! [[ $PROMPT_COMMAND =~ (^|;)update_terminal_cwd($|;) ]] ; then
|
||||
PROMPT_COMMAND="$PROMPT_COMMAND;update_terminal_cwd"
|
||||
PROMPT_COMMAND="${PROMPT_COMMAND%;};update_terminal_cwd"
|
||||
declared="$(declare -p PROMPT_COMMAND)"
|
||||
[[ "$declared" =~ \ -[aAilrtu]*x[aAilrtu]*\ ]] 2>/dev/null
|
||||
[[ $? -eq 0 ]] && export PROMPT_COMMAND
|
||||
|
|
|
|||
|
|
@ -20,23 +20,23 @@ done
|
|||
|
||||
|
||||
function postgres_start {
|
||||
about 'Starts PostgresSQL server'
|
||||
about 'Starts PostgreSQL server'
|
||||
group 'postgres'
|
||||
|
||||
echo 'Starting PostgresSQL Server....';
|
||||
echo 'Starting Postgres....';
|
||||
$POSTGRES_BIN/pg_ctl -D $PGDATA -l $PGDATA/logfile start
|
||||
}
|
||||
|
||||
function postgres_stop {
|
||||
about 'Steps PostgresSQL server'
|
||||
about 'Stops PostgreSQL server'
|
||||
group 'postgres'
|
||||
|
||||
echo 'Stopping PostgresSQL Server....';
|
||||
echo 'Stopping Postgres....';
|
||||
$POSTGRES_BIN/pg_ctl -D $PGDATA -l $PGDATA/logfile stop -s -m fast
|
||||
}
|
||||
|
||||
function postgres_status {
|
||||
about 'Returns status of PostgresSQL server'
|
||||
about 'Returns status of PostgreSQL server'
|
||||
group 'postgres'
|
||||
|
||||
# $POSTGRES_BIN/pg_ctl -D $PGDATA status
|
||||
|
|
@ -55,7 +55,7 @@ function is_postgres_running {
|
|||
|
||||
|
||||
function postgres_restart {
|
||||
about 'Restarts status of PostgresSQL server'
|
||||
about 'Restarts status of PostgreSQL server'
|
||||
group 'postgres'
|
||||
|
||||
echo 'Restarting Postgres....';
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
cite about-plugin
|
||||
about-plugin 'enables powerline daemon'
|
||||
|
||||
command -v powerline-daemon &>/dev/null || return
|
||||
powerline-daemon -q
|
||||
|
||||
#the following should not be executed if bashit powerline themes in use
|
||||
case "$BASH_IT_THEME" in
|
||||
*powerline*)
|
||||
return
|
||||
;;
|
||||
esac
|
||||
POWERLINE_BASH_CONTINUATION=1
|
||||
POWERLINE_BASH_SELECT=1
|
||||
bashPowerlineInit=$(python -c \
|
||||
"import os; \
|
||||
import powerline;\
|
||||
print(os.path.join(os.path.dirname(\
|
||||
powerline.__file__),\
|
||||
'bindings', \
|
||||
'bash', \
|
||||
'powerline.sh'))")
|
||||
[ -e $bashPowerlineInit ] || return
|
||||
. $bashPowerlineInit
|
||||
|
|
@ -1,9 +1,10 @@
|
|||
# Load rbebv, if you are using it
|
||||
|
||||
cite about-plugin
|
||||
about-plugin 'load rbenv, if you are using it'
|
||||
|
||||
pathmunge "$HOME"/.rbenv/bin
|
||||
[ -x `which rbenv` ] && eval "$(rbenv init -)"
|
||||
export RBENV_ROOT="$HOME/.rbenv"
|
||||
pathmunge "$RBENV_ROOT/bin"
|
||||
|
||||
[ -d "$HOME"/.rbenv/plugins/ruby-build ] && pathmunge "$HOME"/.rbenv/plugins/ruby-build/bin
|
||||
[[ `which rbenv` ]] && eval "$(rbenv init -)"
|
||||
|
||||
# Load the auto-completion script if rbenv was loaded.
|
||||
[[ -e $RBENV_ROOT/completions/rbenv.bash ]] && source $RBENV_ROOT/completions/rbenv.bash
|
||||
|
|
|
|||
|
|
@ -3,7 +3,8 @@
|
|||
# Path to the bash it configuration
|
||||
export BASH_IT="{{BASH_IT}}"
|
||||
|
||||
# Lock and Load a custom theme file
|
||||
# Lock and Load a custom theme file.
|
||||
# Leave empty to disable theming.
|
||||
# location /.bash_it/themes/
|
||||
export BASH_IT_THEME='bobby'
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ SCM_GIT_SHOW_REMOTE_INFO=${SCM_GIT_SHOW_REMOTE_INFO:=auto}
|
|||
SCM_GIT_IGNORE_UNTRACKED=${SCM_GIT_IGNORE_UNTRACKED:=false}
|
||||
SCM_GIT_SHOW_CURRENT_USER=${SCM_GIT_SHOW_CURRENT_USER:=false}
|
||||
SCM_GIT_SHOW_MINIMAL_INFO=${SCM_GIT_SHOW_MINIMAL_INFO:=false}
|
||||
SCM_GIT_SHOW_STASH_INFO=${SCM_GIT_SHOW_STASH_INFO:=true}
|
||||
|
||||
SCM_GIT='git'
|
||||
SCM_GIT_CHAR='±'
|
||||
|
|
@ -181,9 +182,11 @@ function git_prompt_vars {
|
|||
[[ "${commits_ahead}" -gt 0 ]] && SCM_BRANCH+=" ${SCM_GIT_AHEAD_CHAR}${commits_ahead}"
|
||||
[[ "${commits_behind}" -gt 0 ]] && SCM_BRANCH+=" ${SCM_GIT_BEHIND_CHAR}${commits_behind}"
|
||||
|
||||
local stash_count
|
||||
stash_count="$(git stash list 2> /dev/null | wc -l | tr -d ' ')"
|
||||
[[ "${stash_count}" -gt 0 ]] && SCM_BRANCH+=" ${SCM_GIT_STASH_CHAR_PREFIX}${stash_count}${SCM_GIT_STASH_CHAR_SUFFIX}"
|
||||
if [[ "${SCM_GIT_SHOW_STASH_INFO}" = "true" ]]; then
|
||||
local stash_count
|
||||
stash_count="$(git stash list 2> /dev/null | wc -l | tr -d ' ')"
|
||||
[[ "${stash_count}" -gt 0 ]] && SCM_BRANCH+=" ${SCM_GIT_STASH_CHAR_PREFIX}${stash_count}${SCM_GIT_STASH_CHAR_SUFFIX}"
|
||||
fi
|
||||
|
||||
SCM_STATE=${GIT_THEME_PROMPT_CLEAN:-$SCM_THEME_PROMPT_CLEAN}
|
||||
if ! _git-hide-status; then
|
||||
|
|
@ -347,7 +350,7 @@ function condaenv_prompt {
|
|||
}
|
||||
|
||||
function py_interp_prompt {
|
||||
py_version=$(python --version 2>&1 | awk '{print "py-"$2;}') || return
|
||||
py_version=$(python --version 2>&1 | awk 'NR==1{print "py-"$2;}') || return
|
||||
echo -e "${PYTHON_THEME_PROMPT_PREFIX}${py_version}${PYTHON_THEME_PROMPT_SUFFIX}"
|
||||
}
|
||||
|
||||
|
|
@ -393,6 +396,7 @@ function user_host_prompt {
|
|||
|
||||
# backwards-compatibility
|
||||
function git_prompt_info {
|
||||
_git-hide-status && return
|
||||
git_prompt_vars
|
||||
echo -e "${SCM_PREFIX}${SCM_BRANCH}${SCM_STATE}${SCM_SUFFIX}"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,8 +100,7 @@ prompt() {
|
|||
|
||||
if [ $(uname) = "Linux" ];
|
||||
then
|
||||
PS1="${TITLEBAR}
|
||||
${SAVE_CURSOR}${MOVE_CURSOR_RIGHTMOST}${MOVE_CURSOR_5_LEFT}\
|
||||
PS1="${TITLEBAR}${SAVE_CURSOR}${MOVE_CURSOR_RIGHTMOST}${MOVE_CURSOR_5_LEFT}
|
||||
$(safe_battery_charge)${RESTORE_CURSOR}\
|
||||
${D_USER_COLOR}\u ${D_INTERMEDIATE_COLOR}\
|
||||
at ${D_MACHINE_COLOR}\h ${D_INTERMEDIATE_COLOR}\
|
||||
|
|
@ -113,7 +112,7 @@ ${D_INTERMEDIATE_COLOR}$ ${D_DEFAULT_COLOR}"
|
|||
else
|
||||
PS1="${TITLEBAR}
|
||||
${D_USER_COLOR}\u ${D_INTERMEDIATE_COLOR}\
|
||||
at ${D_MACHINE_COLOR}\h ${D_INTERMEDIATE_COLOR}\
|
||||
at ${D_MACHINE_COLOR}\h ${D_INTERMEDIATE_COLOR}\
|
||||
in ${D_DIR_COLOR}\w ${D_INTERMEDIATE_COLOR}\
|
||||
${LAST_COMMAND_FAILED}\
|
||||
$(demula_vcprompt)\
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ RVM_THEME_PROMPT_SUFFIX=" d|"
|
|||
BOLD="\[\e[1m\]"
|
||||
|
||||
function prompt_command() {
|
||||
PS1="\n${bold_cyan}$(scm_prompt_char_info) ${bold_cyan}\w :${reset_color}${normal}${BOLD} "
|
||||
PS1="\n${bold_cyan}$(scm_prompt_char_info)$(virtualenv_prompt) ${bold_cyan}\w :${reset_color}${normal}${BOLD} "
|
||||
}
|
||||
|
||||
safe_append_prompt_command prompt_command
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ The time/date is printed by the `date` command, so refer to its man page to chan
|
|||
|
||||
The contents of both prompt sides can be "reordered", all the "segments" (every piece of information) can take any place. The currently available segments are:
|
||||
|
||||
* `aws_profile` - Show the current value of the `AWS_PROFILE` environment variable
|
||||
* `battery` - Battery information (you'll need to enable the `battery` plugin)
|
||||
* `clock` - Current time in `HH:MM:SS` format
|
||||
* `cwd` - Current working directory including full folder hierarchy (c.f. `wd`)
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ PYTHON_VENV_THEME_PROMPT_COLOR=35
|
|||
|
||||
SCM_NONE_CHAR=""
|
||||
SCM_GIT_CHAR=${POWERLINE_SCM_GIT_CHAR:=" "}
|
||||
SCM_HG_CHAR=${POWERLINE_SCM_HG_CHAR:="☿ "}
|
||||
SCM_THEME_PROMPT_CLEAN=""
|
||||
SCM_THEME_PROMPT_DIRTY=""
|
||||
SCM_THEME_PROMPT_CLEAN_COLOR=25
|
||||
|
|
@ -35,6 +36,9 @@ RBENV_THEME_PROMPT_SUFFIX=""
|
|||
RUBY_THEME_PROMPT_COLOR=161
|
||||
RUBY_CHAR=${POWERLINE_RUBY_CHAR:="❲r❳ "}
|
||||
|
||||
AWS_PROFILE_CHAR="${POWERLINE_AWS_PROFILE_CHAR:=❲aws❳ }"
|
||||
AWS_PROFILE_PROMPT_COLOR=208
|
||||
|
||||
CWD_THEME_PROMPT_COLOR=240
|
||||
|
||||
LAST_STATUS_THEME_PROMPT_COLOR=196
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ The time/date is printed by the `date` command, so refer to its man page to chan
|
|||
|
||||
The contents of the prompt can be "reordered", all the "segments" (every piece of information) can take any place. The currently available segments are:
|
||||
|
||||
* `aws_profile` - Show the current value of the `AWS_PROFILE` environment variable
|
||||
* `battery` - Battery information (you'll need to enable the `battery` plugin)
|
||||
* `clock` - Current time in `HH:MM:SS` format
|
||||
* `cwd` - Current working directory including full folder hierarchy (c.f. `wd`)
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ PYTHON_VENV_THEME_PROMPT_COLOR=35
|
|||
|
||||
SCM_NONE_CHAR=""
|
||||
SCM_GIT_CHAR=${POWERLINE_SCM_GIT_CHAR:=" "}
|
||||
SCM_HG_CHAR=${POWERLINE_SCM_HG_CHAR:="☿ "}
|
||||
SCM_THEME_PROMPT_CLEAN=""
|
||||
SCM_THEME_PROMPT_DIRTY=""
|
||||
SCM_THEME_PROMPT_COLOR=238
|
||||
|
|
@ -32,6 +33,9 @@ RBENV_THEME_PROMPT_SUFFIX=""
|
|||
RUBY_THEME_PROMPT_COLOR=161
|
||||
RUBY_CHAR=${POWERLINE_RUBY_CHAR:="❲r❳ "}
|
||||
|
||||
AWS_PROFILE_CHAR="${POWERLINE_AWS_PROFILE_CHAR:=❲aws❳ }"
|
||||
AWS_PROFILE_PROMPT_COLOR=208
|
||||
|
||||
CWD_THEME_PROMPT_COLOR=254
|
||||
|
||||
LAST_STATUS_THEME_PROMPT_COLOR=124
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ The time/date is printed by the `date` command, so refer to its man page to chan
|
|||
|
||||
The contents of the prompt can be "reordered", all the "segments" (every piece of information) can take any place. The currently available segments are:
|
||||
|
||||
* `aws_profile` - Show the current value of the `AWS_PROFILE` environment variable
|
||||
* `battery` - Battery information (you'll need to enable the `battery` plugin)
|
||||
* `clock` - Current time in `HH:MM:SS` format
|
||||
* `cwd` - Current working directory including full folder hierarchy (c.f. `wd`)
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ PYTHON_VENV_THEME_PROMPT_COLOR=35
|
|||
|
||||
SCM_NONE_CHAR=""
|
||||
SCM_GIT_CHAR=${POWERLINE_SCM_GIT_CHAR:="⎇ "}
|
||||
SCM_HG_CHAR=${POWERLINE_SCM_HG_CHAR:="☿ "}
|
||||
SCM_THEME_PROMPT_CLEAN=""
|
||||
SCM_THEME_PROMPT_DIRTY=""
|
||||
SCM_THEME_PROMPT_CLEAN_COLOR=25
|
||||
|
|
@ -25,7 +26,10 @@ RVM_THEME_PROMPT_SUFFIX=""
|
|||
RBENV_THEME_PROMPT_PREFIX=""
|
||||
RBENV_THEME_PROMPT_SUFFIX=""
|
||||
RUBY_THEME_PROMPT_COLOR=161
|
||||
RUBY_CHAR=${POWERLINE_RUBY_CHAR:="ⓔ "}
|
||||
RUBY_CHAR=${POWERLINE_RUBY_CHAR:="💎 "}
|
||||
|
||||
AWS_PROFILE_CHAR="${POWERLINE_AWS_PROFILE_CHAR:=❲aws❳ }"
|
||||
AWS_PROFILE_PROMPT_COLOR=208
|
||||
|
||||
CWD_THEME_PROMPT_COLOR=240
|
||||
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ The time/date is printed by the `date` command, so refer to its man page to chan
|
|||
|
||||
The contents of the prompt can be "reordered", all the "segments" (every piece of information) can take any place. The currently available segments are:
|
||||
|
||||
* `aws_profile` - Show the current value of the `AWS_PROFILE` environment variable
|
||||
* `battery` - Battery information (you'll need to enable the `battery` plugin)
|
||||
* `clock` - Current time in `HH:MM:SS` format
|
||||
* `cwd` - Current working directory including full folder hierarchy (c.f. `wd`)
|
||||
|
|
|
|||
|
|
@ -86,6 +86,8 @@ function __powerline_scm_prompt {
|
|||
scm_prompt+="${SCM_CHAR}${SCM_BRANCH}${SCM_STATE}"
|
||||
elif [[ "${SCM_P4_CHAR}" == "${SCM_CHAR}" ]]; then
|
||||
scm_prompt+="${SCM_CHAR}${SCM_BRANCH}${SCM_STATE}"
|
||||
elif [[ "${SCM_HG_CHAR}" == "${SCM_CHAR}" ]]; then
|
||||
scm_prompt+="${SCM_CHAR}${SCM_BRANCH}${SCM_STATE}"
|
||||
fi
|
||||
echo "${scm_prompt}${scm}|${color}"
|
||||
fi
|
||||
|
|
@ -134,6 +136,12 @@ function __powerline_in_vim_prompt {
|
|||
fi
|
||||
}
|
||||
|
||||
function __powerline_aws_profile_prompt {
|
||||
if [[ -n "${AWS_PROFILE}" ]]; then
|
||||
echo "${AWS_PROFILE_CHAR}${AWS_PROFILE}|${AWS_PROFILE_PROMPT_COLOR}"
|
||||
fi
|
||||
}
|
||||
|
||||
function __powerline_left_segment {
|
||||
local OLD_IFS="${IFS}"; IFS="|"
|
||||
local params=( $1 )
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ PYTHON_VENV_THEME_PROMPT_COLOR=35
|
|||
|
||||
SCM_NONE_CHAR=""
|
||||
SCM_GIT_CHAR=${POWERLINE_SCM_GIT_CHAR:=" "}
|
||||
SCM_HG_CHAR=${POWERLINE_SCM_HG_CHAR:="☿ "}
|
||||
SCM_THEME_PROMPT_CLEAN=""
|
||||
SCM_THEME_PROMPT_DIRTY=""
|
||||
SCM_THEME_PROMPT_CLEAN_COLOR=25
|
||||
|
|
@ -30,6 +31,9 @@ RBENV_THEME_PROMPT_SUFFIX=""
|
|||
RUBY_THEME_PROMPT_COLOR=161
|
||||
RUBY_CHAR=${POWERLINE_RUBY_CHAR:="❲r❳ "}
|
||||
|
||||
AWS_PROFILE_CHAR="${POWERLINE_AWS_PROFILE_CHAR:=❲aws❳ }"
|
||||
AWS_PROFILE_PROMPT_COLOR=208
|
||||
|
||||
CWD_THEME_PROMPT_COLOR=240
|
||||
|
||||
LAST_STATUS_THEME_PROMPT_COLOR=52
|
||||
|
|
|
|||
|
|
@ -57,7 +57,12 @@ chroot(){
|
|||
|
||||
# show virtualenvwrapper
|
||||
my_ve(){
|
||||
if [ -n "$VIRTUAL_ENV" ]
|
||||
|
||||
if [ -n "$CONDA_DEFAULT_ENV" ]
|
||||
then
|
||||
my_ps_ve="${bold_purple}${CONDA_DEFAULT_ENV}${normal}";
|
||||
echo "($my_ps_ve)";
|
||||
elif [ -n "$VIRTUAL_ENV" ]
|
||||
then
|
||||
my_ps_ve="${bold_purple}$ve${normal}";
|
||||
echo "($my_ps_ve)";
|
||||
|
|
|
|||
Loading…
Reference in New Issue