From 449d6d4fe1d969a5d60ae71db1440221304dfa48 Mon Sep 17 00:00:00 2001 From: Willy Barro Date: Tue, 25 Sep 2012 17:59:45 -0300 Subject: [PATCH 001/388] Add aliases for GIT-SVN (rebase and dcommit) - Add "gsr" for "git svn rebase" - Add "gsd" for "git svn dcommit" --- aliases/available/git.aliases.bash | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/aliases/available/git.aliases.bash b/aliases/available/git.aliases.bash index bbac313b..37cb0ab5 100644 --- a/aliases/available/git.aliases.bash +++ b/aliases/available/git.aliases.bash @@ -28,6 +28,10 @@ alias gdel='git branch -D' alias gmu='git fetch origin -v; git fetch upstream -v; git merge upstream/master' alias gll='git log --graph --pretty=oneline --abbrev-commit' +# Git SVN +alias gsr='git svn rebase' +alias gsd='git svn dcommit' + case $OSTYPE in linux*) alias gd='git diff | vim -R -' From 09a48d89ccb39a3daae40688cf724b450df42c47 Mon Sep 17 00:00:00 2001 From: Levent Yalcin Date: Mon, 20 May 2019 14:18:32 +0100 Subject: [PATCH 002/388] add an env var that themes can save history immediately --- themes/powerline-plain/powerline-plain.base.bash | 2 ++ themes/powerline-plain/powerline-plain.theme.bash | 2 ++ 2 files changed, 4 insertions(+) diff --git a/themes/powerline-plain/powerline-plain.base.bash b/themes/powerline-plain/powerline-plain.base.bash index 8b881d7e..239ed3ea 100644 --- a/themes/powerline-plain/powerline-plain.base.bash +++ b/themes/powerline-plain/powerline-plain.base.bash @@ -14,6 +14,8 @@ function __powerline_prompt_command { LEFT_PROMPT="" + [[ $HISTORY_AUTOSAVE -eq 1 ]] && history -a && history -c && history -r + ## left prompt ## for segment in $POWERLINE_PROMPT; do local info="$(__powerline_${segment}_prompt)" diff --git a/themes/powerline-plain/powerline-plain.theme.bash b/themes/powerline-plain/powerline-plain.theme.bash index bddb6450..59ae7b79 100644 --- a/themes/powerline-plain/powerline-plain.theme.bash +++ b/themes/powerline-plain/powerline-plain.theme.bash @@ -56,3 +56,5 @@ POWERLINE_PROMPT=${POWERLINE_PROMPT:="user_info scm python_venv ruby cwd"} safe_append_prompt_command __powerline_prompt_command + +HISTORY_AUTOSAVE=${HISTORY_AUTOSAVE:-0} From 1e10ad18139152172fa6829153a90a4d833d610b Mon Sep 17 00:00:00 2001 From: Szymon Szypulski Date: Wed, 22 May 2019 06:54:11 +0200 Subject: [PATCH 003/388] Ignore unset and empty Kubernetes context When current-context does not exist or is unset in $KUBECONFIG, kubectl is throwing a message to stderr "error: current-context is not set". Ignore it. --- themes/base.theme.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/base.theme.bash b/themes/base.theme.bash index 2761b632..e9e862e1 100644 --- a/themes/base.theme.bash +++ b/themes/base.theme.bash @@ -337,7 +337,7 @@ function ruby_version_prompt { } function k8s_context_prompt { - echo -e "$(kubectl config current-context)" + echo -e "$(kubectl config current-context 2> /dev/null)" } function virtualenv_prompt { From 93905c3663eb1f9383dd97dd28b458f824dcdf8d Mon Sep 17 00:00:00 2001 From: Travis Swicegood Date: Fri, 24 May 2019 15:10:48 -0500 Subject: [PATCH 004/388] Add gcloud completion --- completion/available/gcloud.bash | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 completion/available/gcloud.bash diff --git a/completion/available/gcloud.bash b/completion/available/gcloud.bash new file mode 100644 index 00000000..908ee9c5 --- /dev/null +++ b/completion/available/gcloud.bash @@ -0,0 +1,9 @@ +#/usr/bin/env bash +# Bash completion for Google Cloud SDK + +if which gcloud >/dev/null 2>&1; then + GOOGLE_SDK_ROOT=${GOOGLE_SDK_ROOT:-$(gcloud info --format="value(installation.sdk_root)")} + for i in $(ls ${GOOGLE_SDK_ROOT}/*.bash.inc); do + source $i + done +fi From 1bdcc66d5a5fdbdcf9ee0b25124d19d19fb14527 Mon Sep 17 00:00:00 2001 From: Travis Swicegood Date: Fri, 24 May 2019 15:14:13 -0500 Subject: [PATCH 005/388] Rename to .completion.bash so it can be disabled correctly --- completion/available/{gcloud.bash => gcloud.completion.bash} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename completion/available/{gcloud.bash => gcloud.completion.bash} (100%) diff --git a/completion/available/gcloud.bash b/completion/available/gcloud.completion.bash similarity index 100% rename from completion/available/gcloud.bash rename to completion/available/gcloud.completion.bash From 371c2e9834295f46771f26cf53d6911f47e15f0b Mon Sep 17 00:00:00 2001 From: Gurkirat Singh Date: Fri, 31 May 2019 23:30:55 +0530 Subject: [PATCH 006/388] added sqlmap completion --- completion/available/sqlmap.completion.bash | 160 ++++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100644 completion/available/sqlmap.completion.bash diff --git a/completion/available/sqlmap.completion.bash b/completion/available/sqlmap.completion.bash new file mode 100644 index 00000000..3eaa538d --- /dev/null +++ b/completion/available/sqlmap.completion.bash @@ -0,0 +1,160 @@ +#!/bin/bash + +if command -v sqlmap > /dev/null; then + + _sqlmap() + { + local cur prev + + COMPREPLY=() + cur=$(_get_cword) + prev=$(_get_pword) + + case $prev in + + # List directory content + --tamper) + COMPREPLY=( $( compgen -W "$tamper" -- "$cur" ) ) + return 0 + ;; + --output-dir|-t|-l|-m|-r|--load-cookies|--proxy-file|--sql-file|--shared-lib|--file-write) + _filedir + return 0 + ;; + -c) + _filedir ini + return 0 + ;; + --method) + COMPREPLY=( $( compgen -W 'GET POST PUT' -- "$cur" ) ) + return 0 + ;; + --auth-type) + COMPREPLY=( $( compgen -W 'Basic Digest NTLM PKI' -- "$cur" ) ) + return 0 + ;; + --tor-type) + COMPREPLY=( $( compgen -W 'HTTP SOCKS4 SOCKS5' -- "$cur" ) ) + return 0 + ;; + -v) + COMPREPLY=( $( compgen -W '1 2 3 4 5 6' -- "$cur" ) ) + return 0 + ;; + --dbms) + COMPREPLY=( $( compgen -W 'mysql mssql access postgres' -- "$cur" ) ) + return 0 + ;; + --level|--crawl) + COMPREPLY=( $( compgen -W '1 2 3 4 5' -- "$cur" ) ) + return 0 + ;; + --risk) + COMPREPLY=( $( compgen -W '0 1 2 3' -- "$cur" ) ) + return 0 + ;; + --technique) + COMPREPLY=( $( compgen -W 'B E U S T Q' -- "$cur" ) ) + return 0 + ;; + -s) + _filedir sqlite + return 0 + ;; + --dump-format) + COMPREPLY=( $( compgen -W 'CSV HTML SQLITE' -- "$cur" ) ) + return 0 + ;; + -x) + _filedir xml + return 0 + ;; + esac + + if [[ "$cur" == * ]]; then + COMPREPLY=( $( compgen -W '-h --help -hh --version -v -d -u --url -l -x -m -r -g -c --method \ + --data --param-del --cookie --cookie-del --load-cookies \ + --drop-set-cookie --user-agent --random-agent --host --referer \ + --headers --auth-type --auth-cred --auth-private --ignore-401 \ + --proxy --proxy-cred --proxy-file --ignore-proxy --tor --tor-port \ + --tor-type --check-tor --delay --timeout --retries --randomize \ + --safe-url --safe-freq --skip-urlencode --csrf-token --csrf-url \ + --force-ssl --hpp --eval -o --predict-output --keep-alive \ + --null-connection --threads -p --skip --dbms --dbms-cred \ + --os --invalid-bignum --invalid-logical --invalid-string \ + --no-cast --no-escape --prefix --suffix --tamper --level \ + --risk --string --not-string --regexp --code --text-only \ + --titles --technique --time-sec --union-cols --union-char \ + --union-from --dns-domain --second-order -f --fingerprint \ + -a --all -b --banner --current-user --current-db --hostname \ + --is-dba --users --passwords --privileges --roles --dbs --tables \ + --columns --schema --count --dump --dump-all --search --comments \ + -D -T -C -X -U --exclude-sysdbs --where --start --stop \ + --first --last --sql-query --sql-shell --sql-file --common-tables \ + --common-columns --udf-inject --shared-lib --file-read --file-write \ + --file-dest --os-cmd --os-shell --os-pwn --os-smbrelay --os-bof \ + --priv-esc --msf-path --tmp-path --reg-read --reg-add --reg-del \ + --reg-key --reg-value --reg-data --reg-type -s -t --batch \ + --charset --crawl --csv-del --dump-format --eta --flush-session \ + --forms --fresh-queries --hex --output-dir --parse-errors \ + --pivot-column --save --scope --test-filter --update \ + -z --alert --answers --beep --check-waf --cleanup \ + --dependencies --disable-coloring --gpage --identify-waf \ + --mobile --page-rank --purge-output --smart \ + --sqlmap-shell --wizard' -- "$cur" ) ) + # this removes any options from the list of completions that have + # already been specified somewhere on the command line, as long as + # these options can only be used once (in a word, "options", in + # opposition to "tests" and "actions", as in the find(1) manpage). + onlyonce=' -h --help -hh --version -v -d -u --url -l -x -m -r -g -c \ + --drop-set-cookie --random-agent \ + --ignore-401 \ + --ignore-proxy --tor \ + --check-tor \ + --skip-urlencode \ + --force-ssl --hpp -o --predict-output --keep-alive \ + --null-connection -p \ + --invalid-bignum --invalid-logical --invalid-string \ + --no-cast --no-escape \ + --text-only \ + --titles \ + -f --fingerprint \ + -a --all -b --banner --current-user --current-db --hostname \ + --is-dba --users --passwords --privileges --roles --dbs --tables \ + --columns --schema --count --dump --dump-all --search --comments \ + -D -T -C -X -U --exclude-sysdbs \ + --sql-shell --common-tables \ + --common-columns --udf-inject \ + --os-shell --os-pwn --os-smbrelay --os-bof \ + --priv-esc --reg-read --reg-add --reg-del \ + -s -t --batch \ + --eta --flush-session \ + --forms --fresh-queries --hex --parse-errors \ + --save --update \ + -z --beep --check-waf --cleanup \ + --dependencies --disable-coloring --identify-waf \ + --mobile --page-rank --purge-output --smart \ + --sqlmap-shell --wizard ' + COMPREPLY=( $( \ + (while read -d ' ' i; do + [[ -z "$i" || "${onlyonce/ ${i%% *} / }" == "$onlyonce" ]] && + continue + # flatten array with spaces on either side, + # otherwise we cannot grep on word boundaries of + # first and last word + COMPREPLY=" ${COMPREPLY[@]} " + # remove word from list of completions + COMPREPLY=( ${COMPREPLY/ ${i%% *} / } ) + done + printf '%s ' "${COMPREPLY[@]}") <<<"${COMP_WORDS[@]}" + ) ) + + # else + # _filedir bat + fi + } + + + complete -F _sqlmap sqlmap + +fi \ No newline at end of file From 0ea44cb72c9bee304c3f4041ab8cb041efd66e04 Mon Sep 17 00:00:00 2001 From: Gurkirat Singh Date: Sun, 2 Jun 2019 14:51:01 +0530 Subject: [PATCH 007/388] added nodejs aliases --- aliases/available/node.aliases.bash | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 aliases/available/node.aliases.bash diff --git a/aliases/available/node.aliases.bash b/aliases/available/node.aliases.bash new file mode 100644 index 00000000..14bfdb8c --- /dev/null +++ b/aliases/available/node.aliases.bash @@ -0,0 +1,8 @@ +cite 'about-alias' +about-alias 'the nodejs environment aliases' + +# alias to setup nodejs development environment +alias node-dev='export NODE_ENV=development' + +# alias to setup nodejs production environment +alias node-prod='export NODE_ENV=production' \ No newline at end of file From eccda7d09b900a17d0bc1705616c4af80abe0bf1 Mon Sep 17 00:00:00 2001 From: Gurkirat Singh Date: Mon, 3 Jun 2019 13:04:36 +0530 Subject: [PATCH 008/388] changed to official name --- aliases/available/node.aliases.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aliases/available/node.aliases.bash b/aliases/available/node.aliases.bash index 14bfdb8c..a1408f26 100644 --- a/aliases/available/node.aliases.bash +++ b/aliases/available/node.aliases.bash @@ -1,8 +1,8 @@ cite 'about-alias' -about-alias 'the nodejs environment aliases' +about-alias 'the Node.js environment aliases' # alias to setup nodejs development environment alias node-dev='export NODE_ENV=development' # alias to setup nodejs production environment -alias node-prod='export NODE_ENV=production' \ No newline at end of file +alias node-prod='export NODE_ENV=production' From a111376854ca6298b4f686252e52990e7be7e3fd Mon Sep 17 00:00:00 2001 From: Gurkirat Singh Date: Mon, 3 Jun 2019 13:05:07 +0530 Subject: [PATCH 009/388] added eol --- aliases/available/node.aliases.bash | 1 + 1 file changed, 1 insertion(+) diff --git a/aliases/available/node.aliases.bash b/aliases/available/node.aliases.bash index a1408f26..ddf3c92c 100644 --- a/aliases/available/node.aliases.bash +++ b/aliases/available/node.aliases.bash @@ -6,3 +6,4 @@ alias node-dev='export NODE_ENV=development' # alias to setup nodejs production environment alias node-prod='export NODE_ENV=production' + From 955a9dd86d5926d5b3a1590a42926889bb7d195b Mon Sep 17 00:00:00 2001 From: Gurkirat Singh Date: Mon, 3 Jun 2019 14:06:05 +0530 Subject: [PATCH 010/388] added thanks message to original author --- completion/available/sqlmap.completion.bash | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/completion/available/sqlmap.completion.bash b/completion/available/sqlmap.completion.bash index 3eaa538d..e80eb796 100644 --- a/completion/available/sqlmap.completion.bash +++ b/completion/available/sqlmap.completion.bash @@ -1,5 +1,12 @@ #!/bin/bash +# ---------------------------------------------------------------------------+ +# | +# Thanks to Alexander Korznikov | +# http://www.korznikov.com/2014/12/bash-tab-completion-for-awesome-tool.html | +# | +# ---------------------------------------------------------------------------+ + if command -v sqlmap > /dev/null; then _sqlmap() @@ -157,4 +164,4 @@ if command -v sqlmap > /dev/null; then complete -F _sqlmap sqlmap -fi \ No newline at end of file +fi From dc61f85196d8b424f1f237a7eedb4eb2976bce32 Mon Sep 17 00:00:00 2001 From: Zhao Li Date: Fri, 7 Jun 2019 15:46:24 -1000 Subject: [PATCH 011/388] allow the space before SCM_GIT_AHEAD_CHAR and SCM_GIT_BEHIND_CHAR to be customizable --- themes/base.theme.bash | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/themes/base.theme.bash b/themes/base.theme.bash index e9e862e1..79c42d1d 100644 --- a/themes/base.theme.bash +++ b/themes/base.theme.bash @@ -39,6 +39,7 @@ SCM_GIT_CHAR='±' SCM_GIT_DETACHED_CHAR='⌿' SCM_GIT_AHEAD_CHAR="↑" SCM_GIT_BEHIND_CHAR="↓" +SCM_GIT_AHEAD_BEHIND_PREFIX_CHAR=" " SCM_GIT_UNTRACKED_CHAR="?:" SCM_GIT_UNSTAGED_CHAR="U:" SCM_GIT_STAGED_CHAR="S:" @@ -179,8 +180,8 @@ function git_prompt_vars { fi IFS=$'\t' read -r commits_behind commits_ahead <<< "$(_git-upstream-behind-ahead)" - [[ "${commits_ahead}" -gt 0 ]] && SCM_BRANCH+=" ${SCM_GIT_AHEAD_CHAR}${commits_ahead}" - [[ "${commits_behind}" -gt 0 ]] && SCM_BRANCH+=" ${SCM_GIT_BEHIND_CHAR}${commits_behind}" + [[ "${commits_ahead}" -gt 0 ]] && SCM_BRANCH+="${SCM_GIT_AHEAD_BEHIND_PREFIX_CHAR}${SCM_GIT_AHEAD_CHAR}${commits_ahead}" + [[ "${commits_behind}" -gt 0 ]] && SCM_BRANCH+="${SCM_GIT_AHEAD_BEHIND_PREFIX_CHAR}${SCM_GIT_BEHIND_CHAR}${commits_behind}" if [[ "${SCM_GIT_SHOW_STASH_INFO}" = "true" ]]; then local stash_count From 23fab13d859acce83d5fb9b2876ec3530afd82a2 Mon Sep 17 00:00:00 2001 From: Levent Yalcin Date: Mon, 10 Jun 2019 10:57:52 +0100 Subject: [PATCH 012/388] requested changes has been made. --- themes/powerline-plain/powerline-plain.theme.bash | 5 +---- themes/powerline/powerline.theme.bash | 2 ++ 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/themes/powerline-plain/powerline-plain.theme.bash b/themes/powerline-plain/powerline-plain.theme.bash index 59ae7b79..f9538c2a 100644 --- a/themes/powerline-plain/powerline-plain.theme.bash +++ b/themes/powerline-plain/powerline-plain.theme.bash @@ -54,7 +54,4 @@ HOST_THEME_PROMPT_COLOR=0 POWERLINE_PROMPT=${POWERLINE_PROMPT:="user_info scm python_venv ruby cwd"} -safe_append_prompt_command __powerline_prompt_command - - -HISTORY_AUTOSAVE=${HISTORY_AUTOSAVE:-0} +safe_append_prompt_command __powerline_prompt_command \ No newline at end of file diff --git a/themes/powerline/powerline.theme.bash b/themes/powerline/powerline.theme.bash index 482b3464..377e6f8e 100644 --- a/themes/powerline/powerline.theme.bash +++ b/themes/powerline/powerline.theme.bash @@ -57,4 +57,6 @@ HOST_THEME_PROMPT_COLOR=0 POWERLINE_PROMPT=${POWERLINE_PROMPT:="user_info scm python_venv ruby cwd"} +HISTORY_AUTOSAVE=${HISTORY_AUTOSAVE:-0} + safe_append_prompt_command __powerline_prompt_command From e93cc67bcd3dd527f733c0eac4da64c7b5cb0110 Mon Sep 17 00:00:00 2001 From: Levent Yalcin Date: Mon, 10 Jun 2019 13:39:35 +0100 Subject: [PATCH 013/388] added a function instead running the same check and commands in every theme --- themes/base.theme.bash | 5 +++++ themes/powerline-plain/powerline-plain.base.bash | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/themes/base.theme.bash b/themes/base.theme.bash index 2761b632..c58aca82 100644 --- a/themes/base.theme.bash +++ b/themes/base.theme.bash @@ -497,3 +497,8 @@ function safe_append_prompt_command { fi fi } + +function _save-and-reload-history() { + local autosave=${1:-0} + [[ $autosave -eq 1 ]] && history -a && history -c && history -r +} \ No newline at end of file diff --git a/themes/powerline-plain/powerline-plain.base.bash b/themes/powerline-plain/powerline-plain.base.bash index 239ed3ea..5558e0eb 100644 --- a/themes/powerline-plain/powerline-plain.base.bash +++ b/themes/powerline-plain/powerline-plain.base.bash @@ -14,7 +14,7 @@ function __powerline_prompt_command { LEFT_PROMPT="" - [[ $HISTORY_AUTOSAVE -eq 1 ]] && history -a && history -c && history -r + _save-and-reload-history "${HISTORY_AUTOSAVE:-0}" ## left prompt ## for segment in $POWERLINE_PROMPT; do From 2cd06962d309b9a0581edae5a09924d7a88de6b4 Mon Sep 17 00:00:00 2001 From: Levent Yalcin Date: Fri, 14 Jun 2019 13:57:07 +0100 Subject: [PATCH 014/388] tab completion for Hashicorp consul --- completion/available/consul.completion.bash | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 completion/available/consul.completion.bash diff --git a/completion/available/consul.completion.bash b/completion/available/consul.completion.bash new file mode 100644 index 00000000..2082e344 --- /dev/null +++ b/completion/available/consul.completion.bash @@ -0,0 +1,10 @@ +# bash completion support for Hashicorp consul + +CONSUL_BIN=$(command -v consul 2>/dev/null) + +if [[ -x "$CONSUL_BIN" ]] +then + complete -C "$CONSUL_BIN" consul +fi + +unset CONSUL_BIN \ No newline at end of file From e42405705a10aa6eb25d4df7f06cadf75a51c3b0 Mon Sep 17 00:00:00 2001 From: Martin Ankerl Date: Mon, 24 Jun 2019 11:02:15 +0200 Subject: [PATCH 015/388] Improved subversion support for powerline SVN prompt also when in subdirectories that don't contain .svn Show correct SVN status for powerline --- themes/base.theme.bash | 1 + themes/powerline/powerline.base.bash | 2 ++ 2 files changed, 3 insertions(+) diff --git a/themes/base.theme.bash b/themes/base.theme.bash index e9e862e1..efb56fb7 100644 --- a/themes/base.theme.bash +++ b/themes/base.theme.bash @@ -86,6 +86,7 @@ function scm { elif [[ -d .hg ]] && which hg &> /dev/null; then SCM=$SCM_HG elif which hg &> /dev/null && [[ -n "$(hg root 2> /dev/null)" ]]; then SCM=$SCM_HG elif [[ -d .svn ]] && which svn &> /dev/null; then SCM=$SCM_SVN + elif which svn &> /dev/null && [[ -n "$(svn info --show-item wc-root 2>/dev/null)" ]]; then SCM=$SCM_SVN else SCM=$SCM_NONE fi } diff --git a/themes/powerline/powerline.base.bash b/themes/powerline/powerline.base.bash index b648e2a0..9e668a6c 100644 --- a/themes/powerline/powerline.base.bash +++ b/themes/powerline/powerline.base.bash @@ -98,6 +98,8 @@ function __powerline_scm_prompt { scm_prompt+="${SCM_CHAR}${SCM_BRANCH}${SCM_STATE}" elif [[ "${SCM_HG_CHAR}" == "${SCM_CHAR}" ]]; then scm_prompt+="${SCM_CHAR}${SCM_BRANCH}${SCM_STATE}" + elif [[ "${SCM_SVN_CHAR}" == "${SCM_CHAR}" ]]; then + scm_prompt+="${SCM_CHAR}${SCM_BRANCH}${SCM_STATE}" fi echo "$(eval "echo ${scm_prompt}")${scm}|${color}" fi From 0bafdbbef9db4f60a5e701d9f82ac126571c91eb Mon Sep 17 00:00:00 2001 From: Martin Ankerl Date: Mon, 24 Jun 2019 11:28:53 +0200 Subject: [PATCH 016/388] faster subversion status Stop as soon as "svn status" shows a change, not needed to walk through all the changes in the whole repository. For my large repository this is about twice as fast. Extract just the information we need from "svn info" --- themes/base.theme.bash | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/themes/base.theme.bash b/themes/base.theme.bash index e9e862e1..7ab5f39c 100644 --- a/themes/base.theme.bash +++ b/themes/base.theme.bash @@ -231,7 +231,7 @@ function p4_prompt_vars { } function svn_prompt_vars { - if [[ -n $(svn status 2> /dev/null) ]]; then + if [[ -n $(svn status |head -c1 2> /dev/null) ]]; then SCM_DIRTY=1 SCM_STATE=${SVN_THEME_PROMPT_DIRTY:-$SCM_THEME_PROMPT_DIRTY} else @@ -240,8 +240,8 @@ function svn_prompt_vars { fi SCM_PREFIX=${SVN_THEME_PROMPT_PREFIX:-$SCM_THEME_PROMPT_PREFIX} SCM_SUFFIX=${SVN_THEME_PROMPT_SUFFIX:-$SCM_THEME_PROMPT_SUFFIX} - SCM_BRANCH=$(svn info 2> /dev/null | awk -F/ '/^URL:/ { for (i=0; i<=NF; i++) { if ($i == "branches" || $i == "tags" ) { print $(i+1); break }; if ($i == "trunk") { print $i; break } } }') || return - SCM_CHANGE=$(svn info 2> /dev/null | sed -ne 's#^Revision: ##p' ) + SCM_BRANCH=$(svn info --show-item=url 2> /dev/null | awk -F/ '{ for (i=0; i<=NF; i++) { if ($i == "branches" || $i == "tags" ) { print $(i+1); break }; if ($i == "trunk") { print $i; break } } }') || return + SCM_CHANGE=$(svn info --show-item=revision 2> /dev/null) } # this functions returns absolute location of .hg directory if one exists From 7f573f24655fd70765e1d84465ee9b70b2a19d3d Mon Sep 17 00:00:00 2001 From: Matthew Adams Date: Wed, 26 Jun 2019 11:03:12 -0500 Subject: [PATCH 017/388] add gcpx --- aliases/available/git.aliases.bash | 1 + 1 file changed, 1 insertion(+) diff --git a/aliases/available/git.aliases.bash b/aliases/available/git.aliases.bash index d3f25425..fc95300d 100644 --- a/aliases/available/git.aliases.bash +++ b/aliases/available/git.aliases.bash @@ -51,6 +51,7 @@ alias gbd='git branch -d' alias gbD='git branch -D' alias gcount='git shortlog -sn' alias gcp='git cherry-pick' +alias gcpx='git cherry-pick -x' alias gco='git checkout' alias gcom='git checkout master' alias gcb='git checkout -b' From cf39dc42579bb562b9969dc17a0a5f7ac0ca825f Mon Sep 17 00:00:00 2001 From: Ti Leggett Date: Thu, 4 Jul 2019 10:52:19 -0500 Subject: [PATCH 018/388] added slogin to list of ssh completion commands --- completion/available/ssh.completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/completion/available/ssh.completion.bash b/completion/available/ssh.completion.bash index d5cd6e61..42186e81 100644 --- a/completion/available/ssh.completion.bash +++ b/completion/available/ssh.completion.bash @@ -37,4 +37,4 @@ _sshcomplete() { return 0 } -complete -o default -o nospace -F _sshcomplete ssh scp +complete -o default -o nospace -F _sshcomplete ssh scp slogin From ce935801a3c0d14824004c622942ec81ffa66b12 Mon Sep 17 00:00:00 2001 From: Ahmed Masud Date: Sat, 6 Jul 2019 16:53:45 -0400 Subject: [PATCH 019/388] Fixed test of whether or not current session is interactive --- plugins/available/history.plugin.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/available/history.plugin.bash b/plugins/available/history.plugin.bash index efd33981..528548ef 100644 --- a/plugins/available/history.plugin.bash +++ b/plugins/available/history.plugin.bash @@ -2,7 +2,7 @@ cite about-plugin about-plugin 'history manipulation' # enter a few characters and press UpArrow/DownArrow # to search backwards/forwards through the history -if [ -t 1 ] +if [[ ${SHELLOPTS} =~ (vi|emacs) ]] then bind '"":history-search-backward' bind '"":history-search-forward' From 62757b0f3f327b26f7386daeb826d1d4cebd5057 Mon Sep 17 00:00:00 2001 From: Zhao Li Date: Mon, 8 Jul 2019 10:52:44 -1000 Subject: [PATCH 020/388] allow the count information to be turned on or off --- themes/base.theme.bash | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/themes/base.theme.bash b/themes/base.theme.bash index 430fb60d..817c983d 100644 --- a/themes/base.theme.bash +++ b/themes/base.theme.bash @@ -33,6 +33,7 @@ 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_SHOW_COMMIT_COUNT=${SCM_GIT_SHOW_COMMIT_COUNT:=true} SCM_GIT='git' SCM_GIT_CHAR='±' @@ -181,8 +182,14 @@ function git_prompt_vars { fi IFS=$'\t' read -r commits_behind commits_ahead <<< "$(_git-upstream-behind-ahead)" - [[ "${commits_ahead}" -gt 0 ]] && SCM_BRANCH+="${SCM_GIT_AHEAD_BEHIND_PREFIX_CHAR}${SCM_GIT_AHEAD_CHAR}${commits_ahead}" - [[ "${commits_behind}" -gt 0 ]] && SCM_BRANCH+="${SCM_GIT_AHEAD_BEHIND_PREFIX_CHAR}${SCM_GIT_BEHIND_CHAR}${commits_behind}" + if [[ "${commits_ahead}" -gt 0 ]]; then + SCM_BRANCH+="${SCM_GIT_AHEAD_BEHIND_PREFIX_CHAR}${SCM_GIT_AHEAD_CHAR}" + [[ "${SCM_GIT_SHOW_COMMIT_COUNT}" = "true" ]] && SCM_BRANCH+="${commits_ahead}" + fi + if [[ "${commits_behind}" -gt 0 ]]; then + SCM_BRANCH+="${SCM_GIT_AHEAD_BEHIND_PREFIX_CHAR}${SCM_GIT_BEHIND_CHAR}" + [[ "${SCM_GIT_SHOW_COMMIT_COUNT}" = "true" ]] && SCM_BRANCH+="${commits_behind}" + fi if [[ "${SCM_GIT_SHOW_STASH_INFO}" = "true" ]]; then local stash_count From 49d8c8750aed586a9f746ae47f182ac760ddceb6 Mon Sep 17 00:00:00 2001 From: Zhao Li Date: Mon, 8 Jul 2019 13:28:32 -1000 Subject: [PATCH 021/388] fix broken tests --- test/themes/base.theme.git.bats | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/themes/base.theme.git.bats b/test/themes/base.theme.git.bats index 4547a6e3..997b1a59 100644 --- a/test/themes/base.theme.git.bats +++ b/test/themes/base.theme.git.bats @@ -115,6 +115,8 @@ setup_repo_with_upstream() { git add file git stash + SCM_GIT_SHOW_STASH_INFO=true + git_prompt_vars assert_equal "$SCM_BRANCH" "${pre} {1}" @@ -320,6 +322,8 @@ setup_repo_with_upstream() { echo "line2" >> file1 git add file1 + SCM_GIT_SHOW_DETAILS=true + git_prompt_vars assert_equal "$SCM_BRANCH" "${pre} S:1" assert_equal "$SCM_STATE" " ✗" From 83be21ebb35bfb11d47be8b43e5bf3e3cd332b44 Mon Sep 17 00:00:00 2001 From: Zhao Li Date: Mon, 8 Jul 2019 13:10:19 -1000 Subject: [PATCH 022/388] update tests to set flag appropriately --- test/themes/base.theme.git.bats | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/themes/base.theme.git.bats b/test/themes/base.theme.git.bats index 4547a6e3..bae8e021 100644 --- a/test/themes/base.theme.git.bats +++ b/test/themes/base.theme.git.bats @@ -72,6 +72,8 @@ setup_repo_with_upstream() { git clone "$remote" clone cd clone + SCM_GIT_SHOW_COMMIT_COUNT=true + git_prompt_vars assert_equal "$SCM_BRANCH" "${pre}" @@ -146,6 +148,7 @@ setup_repo_with_upstream() { pushd "${repo}" SCM_GIT_SHOW_REMOTE_INFO=true + SCM_GIT_SHOW_COMMIT_COUNT=true git_prompt_vars assert_equal "$SCM_BRANCH" "${pre}my-remote${post}" @@ -166,6 +169,7 @@ setup_repo_with_upstream() { pushd "${repo}" SCM_GIT_SHOW_REMOTE_INFO=auto + SCM_GIT_SHOW_COMMIT_COUNT=true git_prompt_vars assert_equal "$SCM_BRANCH" "${pre}${post}" @@ -202,6 +206,7 @@ setup_repo_with_upstream() { git remote add third-remote "$(mktemp -d)" SCM_GIT_SHOW_REMOTE_INFO=false + SCM_GIT_SHOW_COMMIT_COUNT=true git_prompt_vars assert_equal "$SCM_BRANCH" "${pre}${post}" @@ -223,6 +228,7 @@ setup_repo_with_upstream() { pushd "${repo}" SCM_GIT_SHOW_REMOTE_INFO=true + SCM_GIT_SHOW_COMMIT_COUNT=true git_prompt_vars assert_equal "$SCM_BRANCH" "${pre} → my-remote${post}" From 33239845940dbe616d3c250ad622b404a0295aa3 Mon Sep 17 00:00:00 2001 From: Lowie Huyghe Date: Mon, 22 Jul 2019 16:42:29 +0200 Subject: [PATCH 023/388] Completely ignore enabled-dir in root to support symlinking. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 6fad6279..a17b6e82 100755 --- a/.gitignore +++ b/.gitignore @@ -15,4 +15,5 @@ bats *.sublime-workspace *.sublime-project enabled/* +/enabled tmp/ From 4c0a51aee25238f8db32271a51958f2cf358ef80 Mon Sep 17 00:00:00 2001 From: Eduardo Bart Date: Mon, 15 Jul 2019 09:31:16 -0300 Subject: [PATCH 024/388] Optimize SCM checks --- themes/base.theme.bash | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/themes/base.theme.bash b/themes/base.theme.bash index 430fb60d..e172dd0c 100644 --- a/themes/base.theme.bash +++ b/themes/base.theme.bash @@ -79,15 +79,20 @@ RBENV_THEME_PROMPT_SUFFIX='|' RBFU_THEME_PROMPT_PREFIX=' |' RBFU_THEME_PROMPT_SUFFIX='|' +GIT_EXE=`which git 2> /dev/null || true` +P4_EXE=`which p4 2> /dev/null || true` +HG_EXE=`which hg 2> /dev/null || true` +SVN_EXE=`which svn 2> /dev/null || true` + function scm { if [[ "$SCM_CHECK" = false ]]; then SCM=$SCM_NONE - elif [[ -f .git/HEAD ]] && which git &> /dev/null; then SCM=$SCM_GIT - elif which git &> /dev/null && [[ -n "$(git rev-parse --is-inside-work-tree 2> /dev/null)" ]]; then SCM=$SCM_GIT - elif which p4 &> /dev/null && [[ -n "$(p4 set P4CLIENT 2> /dev/null)" ]]; then SCM=$SCM_P4 - elif [[ -d .hg ]] && which hg &> /dev/null; then SCM=$SCM_HG - elif which hg &> /dev/null && [[ -n "$(hg root 2> /dev/null)" ]]; then SCM=$SCM_HG - elif [[ -d .svn ]] && which svn &> /dev/null; then SCM=$SCM_SVN - elif which svn &> /dev/null && [[ -n "$(svn info --show-item wc-root 2>/dev/null)" ]]; then SCM=$SCM_SVN + elif [[ -f .git/HEAD ]] && [[ -x "$GIT_EXE" ]]; then SCM=$SCM_GIT + elif [[ -x "$GIT_EXE" ]] && [[ -n "$(git rev-parse --is-inside-work-tree 2> /dev/null)" ]]; then SCM=$SCM_GIT + elif [[ -x "$P4_EXE" ]] && [[ -n "$(p4 set P4CLIENT 2> /dev/null)" ]]; then SCM=$SCM_P4 + elif [[ -d .hg ]] && [[ -x "$HG_EXE" ]]; then SCM=$SCM_HG + elif [[ -x "$HG_EXE" ]] && [[ -n "$(hg root 2> /dev/null)" ]]; then SCM=$SCM_HG + elif [[ -d .svn ]] && [[ -x "$SVN_EXE" ]]; then SCM=$SCM_SVN + elif [[ -x "$SVN_EXE" ]] && [[ -n "$(svn info --show-item wc-root 2>/dev/null)" ]]; then SCM=$SCM_SVN else SCM=$SCM_NONE fi } @@ -503,4 +508,4 @@ function safe_append_prompt_command { function _save-and-reload-history() { local autosave=${1:-0} [[ $autosave -eq 1 ]] && history -a && history -c && history -r -} \ No newline at end of file +} From ef31690b07977e1cd5b9902fc37037858ea6bcd1 Mon Sep 17 00:00:00 2001 From: Arunvel Sriram Date: Sat, 27 Jul 2019 22:50:08 +0530 Subject: [PATCH 025/388] Add helper function to add all ssh private keys to agent --- plugins/available/ssh.plugin.bash | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plugins/available/ssh.plugin.bash b/plugins/available/ssh.plugin.bash index f670b98c..51587b29 100644 --- a/plugins/available/ssh.plugin.bash +++ b/plugins/available/ssh.plugin.bash @@ -17,3 +17,10 @@ function sshlist() { awk '$1 ~ /Host$/ {for (i=2; i<=NF; i++) print $i}' ~/.ssh/config } + +function ssh-add-all() { + about 'add all ssh private keys to agent' + group 'ssh' + + grep -slR "PRIVATE" ~/.ssh | xargs ssh-add +} From 12c49bd22fc1f1cbe9d48bc969661b0abaffe5d3 Mon Sep 17 00:00:00 2001 From: Martin Lariz Date: Mon, 29 Jul 2019 07:07:58 -0700 Subject: [PATCH 026/388] Remove errors if plugin executable not available --- plugins/available/node.plugin.bash | 2 +- plugins/available/pyenv.plugin.bash | 2 +- plugins/available/rbenv.plugin.bash | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/available/node.plugin.bash b/plugins/available/node.plugin.bash index f0467cef..597875ee 100644 --- a/plugins/available/node.plugin.bash +++ b/plugins/available/node.plugin.bash @@ -4,4 +4,4 @@ about-plugin 'Node.js helper functions' pathmunge ./node_modules/.bin # Make sure the global npm prefix is on the path -[[ `which npm` ]] && pathmunge $(npm config get prefix)/bin +[[ `which npm 2>/dev/null` ]] && pathmunge $(npm config get prefix)/bin diff --git a/plugins/available/pyenv.plugin.bash b/plugins/available/pyenv.plugin.bash index dced31a8..4d8db4fb 100644 --- a/plugins/available/pyenv.plugin.bash +++ b/plugins/available/pyenv.plugin.bash @@ -4,7 +4,7 @@ about-plugin 'load pyenv, if you are using it' export PYENV_ROOT="$HOME/.pyenv" pathmunge "$PYENV_ROOT/bin" -[[ `which pyenv` ]] && eval "$(pyenv init - bash)" +[[ `which pyenv 2>/dev/null` ]] && eval "$(pyenv init - bash)" #Load pyenv virtualenv if the virtualenv plugin is installed. if pyenv virtualenv-init - &> /dev/null; then diff --git a/plugins/available/rbenv.plugin.bash b/plugins/available/rbenv.plugin.bash index ecba0c89..2b01669d 100644 --- a/plugins/available/rbenv.plugin.bash +++ b/plugins/available/rbenv.plugin.bash @@ -4,4 +4,4 @@ about-plugin 'load rbenv, if you are using it' export RBENV_ROOT="$HOME/.rbenv" pathmunge "$RBENV_ROOT/bin" -[[ `which rbenv` ]] && eval "$(rbenv init - bash)" +[[ `which rbenv 2>/dev/null` ]] && eval "$(rbenv init - bash)" From 9735ad7b5ce4cf39567d025d2136d05f0fa3f3ad Mon Sep 17 00:00:00 2001 From: Brandon Waskiewicz Date: Mon, 29 Jul 2019 14:07:34 -0400 Subject: [PATCH 027/388] Ensure node paths are appended to existing $PATH --- plugins/available/node.plugin.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/available/node.plugin.bash b/plugins/available/node.plugin.bash index f0467cef..b012742d 100644 --- a/plugins/available/node.plugin.bash +++ b/plugins/available/node.plugin.bash @@ -1,7 +1,7 @@ cite about-plugin about-plugin 'Node.js helper functions' -pathmunge ./node_modules/.bin +pathmunge "./node_modules/.bin" "after" # Make sure the global npm prefix is on the path -[[ `which npm` ]] && pathmunge $(npm config get prefix)/bin +[[ `which npm` ]] && pathmunge "$(npm config get prefix)/bin" "after" From 1de985c460e152831f64a7e1e2c37c40d741b8e8 Mon Sep 17 00:00:00 2001 From: Jacob Hrbek Date: Tue, 30 Jul 2019 11:09:17 +0200 Subject: [PATCH 028/388] themes/agnoster : initial Initial commit of agnoster theme. Credit: Isaac "Agnoster" Wolkerstorfer https://github.com/agnoster - original creator Credit: Kenny Root https://gist.github.com/kruton/8345450 coverted from zsh to bash Credit: Toan Nguyen https://github.com/nntoan published in ohmybash/oh-my-bash (https://github.com/ohmybash/oh-my-bash) Credit: https://github.com/speedenator patch for kruton's work and maintainance. Credit: Hanish K H Updated & fixed on oct-05-2017 --- themes/agnoster/agnoster.theme.bash | 423 ++++++++++++++++++++++++++++ 1 file changed, 423 insertions(+) create mode 100644 themes/agnoster/agnoster.theme.bash diff --git a/themes/agnoster/agnoster.theme.bash b/themes/agnoster/agnoster.theme.bash new file mode 100644 index 00000000..dae991cf --- /dev/null +++ b/themes/agnoster/agnoster.theme.bash @@ -0,0 +1,423 @@ +#!/usr/bin/env bash +# vim: ft=bash ts=2 sw=2 sts=2 +# +# agnoster's Theme - https://gist.github.com/3712874 +# A Powerline-inspired theme for BASH +# +# (Converted from ZSH theme by Kenny Root) +# https://gist.github.com/kruton/8345450 +# +# Updated & fixed by Erik Selberg erik@selberg.org 1/14/17 +# Tested on MacOSX, Ubuntu, Amazon Linux +# Bash v3 and v4 +# +# # README +# +# In order for this theme to render correctly, you will need a +# [Powerline-patched font](https://gist.github.com/1595572). +# I recommend: https://github.com/powerline/fonts.git +# > git clone https://github.com/powerline/fonts.git fonts +# > cd fonts +# > install.sh + +# In addition, I recommend the +# [Solarized theme](https://github.com/altercation/solarized/) and, if you're +# using it on Mac OS X, [iTerm 2](http://www.iterm2.com/) over Terminal.app - +# it has significantly better color fidelity. + +# Install: + +# I recommend the following: +# $ cd home +# $ mkdir -p .bash/themes/agnoster-bash +# $ git clone https://github.com/speedenator/agnoster-bash.git .bash/themes/agnoster-bash + +# then add the following to your .bashrc: + +# export THEME=$HOME/.bash/themes/agnoster-bash/agnoster.bash +# if [[ -f $THEME ]]; then +# export DEFAULT_USER=`whoami` +# source $THEME +# fi + +# +# # Goals +# +# The aim of this theme is to only show you *relevant* information. Like most +# prompts, it will only show git information when in a git working directory. +# However, it goes a step further: everything from the current user and +# hostname to whether the last call exited with an error to whether background +# jobs are running in this shell will all be displayed automatically when +# appropriate. + +# Generally speaking, this script has limited support for right +# prompts (ala powerlevel9k on zsh), but it's pretty problematic in Bash. +# The general pattern is to write out the right prompt, hit \r, then +# write the left. This is problematic for the following reasons: +# - Doesn't properly resize dynamically when you resize the terminal +# - Changes to the prompt (like clearing and re-typing, super common) deletes the prompt +# - Getting the right alignment via columns / tput cols is pretty problematic (and is a bug in this version) +# - Bash prompt escapes (like \h or \w) don't get interpolated +# +# all in all, if you really, really want right-side prompts without a +# ton of work, recommend going to zsh for now. If you know how to fix this, +# would appreciate it! + +# note: requires bash v4+... Mac users - you often have bash3. +# 'brew install bash' will set you free +PROMPT_DIRTRIM=2 # bash4 and above + +###################################################################### +DEBUG=0 +debug() { + if [[ ${DEBUG} -ne 0 ]]; then + >&2 echo -e $* + fi +} + +###################################################################### +### Segment drawing +# A few utility functions to make it easy and re-usable to draw segmented prompts + +CURRENT_BG='NONE' +CURRENT_RBG='NONE' +SEGMENT_SEPARATOR='' +RIGHT_SEPARATOR='' +LEFT_SUBSEG='' +RIGHT_SUBSEG='' + +text_effect() { + case "$1" in + reset) echo 0;; + bold) echo 1;; + underline) echo 4;; + esac +} + +# to add colors, see +# http://bitmote.com/index.php?post/2012/11/19/Using-ANSI-Color-Codes-to-Colorize-Your-Bash-Prompt-on-Linux +# under the "256 (8-bit) Colors" section, and follow the example for orange below +fg_color() { + case "$1" in + black) echo 30;; + red) echo 31;; + green) echo 32;; + yellow) echo 33;; + blue) echo 34;; + magenta) echo 35;; + cyan) echo 36;; + white) echo 37;; + orange) echo 38\;5\;166;; + esac +} + +bg_color() { + case "$1" in + black) echo 40;; + red) echo 41;; + green) echo 42;; + yellow) echo 43;; + blue) echo 44;; + magenta) echo 45;; + cyan) echo 46;; + white) echo 47;; + orange) echo 48\;5\;166;; + esac; +} + +# TIL: declare is global not local, so best use a different name +# for codes (mycodes) as otherwise it'll clobber the original. +# this changes from BASH v3 to BASH v4. +ansi() { + local seq + declare -a mycodes=("${!1}") + + debug "ansi: ${!1} all: $* aka ${mycodes[@]}" + + seq="" + for ((i = 0; i < ${#mycodes[@]}; i++)); do + if [[ -n $seq ]]; then + seq="${seq};" + fi + seq="${seq}${mycodes[$i]}" + done + debug "ansi debug:" '\\[\\033['${seq}'m\\]' + echo -ne '\[\033['${seq}'m\]' + # PR="$PR\[\033[${seq}m\]" +} + +ansi_single() { + echo -ne '\[\033['$1'm\]' +} + +# Begin a segment +# Takes two arguments, background and foreground. Both can be omitted, +# rendering default background/foreground. +prompt_segment() { + local bg fg + declare -a codes + + debug "Prompting $1 $2 $3" + + # if commented out from kruton's original... I'm not clear + # if it did anything, but it messed up things like + # prompt_status - Erik 1/14/17 + + # if [[ -z $1 || ( -z $2 && $2 != default ) ]]; then + codes=("${codes[@]}" $(text_effect reset)) + # fi + if [[ -n $1 ]]; then + bg=$(bg_color $1) + codes=("${codes[@]}" $bg) + debug "Added $bg as background to codes" + fi + if [[ -n $2 ]]; then + fg=$(fg_color $2) + codes=("${codes[@]}" $fg) + debug "Added $fg as foreground to codes" + fi + + debug "Codes: " + # declare -p codes + + if [[ $CURRENT_BG != NONE && $1 != $CURRENT_BG ]]; then + declare -a intermediate=($(fg_color $CURRENT_BG) $(bg_color $1)) + debug "pre prompt " $(ansi intermediate[@]) + PR="$PR $(ansi intermediate[@])$SEGMENT_SEPARATOR" + debug "post prompt " $(ansi codes[@]) + PR="$PR$(ansi codes[@]) " + else + debug "no current BG, codes is $codes[@]" + PR="$PR$(ansi codes[@]) " + fi + CURRENT_BG=$1 + [[ -n $3 ]] && PR="$PR$3" +} + +# End the prompt, closing any open segments +prompt_end() { + if [[ -n $CURRENT_BG ]]; then + declare -a codes=($(text_effect reset) $(fg_color $CURRENT_BG)) + PR="$PR $(ansi codes[@])$SEGMENT_SEPARATOR" + fi + declare -a reset=($(text_effect reset)) + PR="$PR $(ansi reset[@])" + CURRENT_BG='' +} + +### virtualenv prompt +prompt_virtualenv() { + if [[ -n $VIRTUAL_ENV ]]; then + color=cyan + prompt_segment $color $PRIMARY_FG + prompt_segment $color white "$(basename $VIRTUAL_ENV)" + fi +} + + +### Prompt components +# Each component will draw itself, and hide itself if no information needs to be shown + +# Context: user@hostname (who am I and where am I) +prompt_context() { + local user=`whoami` + + if [[ $user != $DEFAULT_USER || -n $SSH_CLIENT ]]; then + prompt_segment black default "$user@\h" + fi +} + +# prints history followed by HH:MM, useful for remembering what +# we did previously +prompt_histdt() { + prompt_segment black default "\! [\A]" +} + + +git_status_dirty() { + dirty=$(git status -s 2> /dev/null | tail -n 1) + [[ -n $dirty ]] && echo " ●" +} + +# Git: branch/detached head, dirty status +prompt_git() { + local ref dirty + if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then + ZSH_THEME_GIT_PROMPT_DIRTY='±' + dirty=$(git_status_dirty) + ref=$(git symbolic-ref HEAD 2> /dev/null) || ref="➦ $(git show-ref --head -s --abbrev |head -n1 2> /dev/null)" + if [[ -n $dirty ]]; then + prompt_segment yellow black + else + prompt_segment green black + fi + PR="$PR${ref/refs\/heads\// }$dirty" + fi +} + +# Dir: current working directory +prompt_dir() { + prompt_segment blue black '\w' +} + +# Status: +# - was there an error +# - am I root +# - are there background jobs? +prompt_status() { + local symbols + symbols=() + [[ $RETVAL -ne 0 ]] && symbols+="$(ansi_single $(fg_color red))✘" + [[ $UID -eq 0 ]] && symbols+="$(ansi_single $(fg_color yellow))⚡" + [[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="$(ansi_single $(fg_color cyan))⚙" + + [[ -n "$symbols" ]] && prompt_segment black default "$symbols" +} + +###################################################################### +# +# experimental right prompt stuff +# requires setting prompt_foo to use PRIGHT vs PR +# doesn't quite work per above + +rightprompt() { + printf "%*s" $COLUMNS "$PRIGHT" +} + +# quick right prompt I grabbed to test things. +__command_rprompt() { + local times= n=$COLUMNS tz + for tz in ZRH:Europe/Zurich PIT:US/Eastern \ + MTV:US/Pacific TOK:Asia/Tokyo; do + [ $n -gt 40 ] || break + times="$times ${tz%%:*}\e[30;1m:\e[0;36;1m" + times="$times$(TZ=${tz#*:} date +%H:%M)\e[0m" + n=$(( $n - 10 )) + done + [ -z "$times" ] || printf "%${n}s$times\\r" '' +} +# PROMPT_COMMAND=__command_rprompt + +# this doens't wrap code in \[ \] +ansi_r() { + local seq + declare -a mycodes2=("${!1}") + + debug "ansi: ${!1} all: $* aka ${mycodes2[@]}" + + seq="" + for ((i = 0; i < ${#mycodes2[@]}; i++)); do + if [[ -n $seq ]]; then + seq="${seq};" + fi + seq="${seq}${mycodes2[$i]}" + done + debug "ansi debug:" '\\[\\033['${seq}'m\\]' + echo -ne '\033['${seq}'m' + # PR="$PR\[\033[${seq}m\]" +} + +# Begin a segment on the right +# Takes two arguments, background and foreground. Both can be omitted, +# rendering default background/foreground. +prompt_right_segment() { + local bg fg + declare -a codes + + debug "Prompt right" + debug "Prompting $1 $2 $3" + + # if commented out from kruton's original... I'm not clear + # if it did anything, but it messed up things like + # prompt_status - Erik 1/14/17 + + # if [[ -z $1 || ( -z $2 && $2 != default ) ]]; then + codes=("${codes[@]}" $(text_effect reset)) + # fi + if [[ -n $1 ]]; then + bg=$(bg_color $1) + codes=("${codes[@]}" $bg) + debug "Added $bg as background to codes" + fi + if [[ -n $2 ]]; then + fg=$(fg_color $2) + codes=("${codes[@]}" $fg) + debug "Added $fg as foreground to codes" + fi + + debug "Right Codes: " + # declare -p codes + + # right always has a separator + # if [[ $CURRENT_RBG != NONE && $1 != $CURRENT_RBG ]]; then + # $CURRENT_RBG= + # fi + declare -a intermediate2=($(fg_color $1) $(bg_color $CURRENT_RBG) ) + # PRIGHT="$PRIGHT---" + debug "pre prompt " $(ansi_r intermediate2[@]) + PRIGHT="$PRIGHT$(ansi_r intermediate2[@])$RIGHT_SEPARATOR" + debug "post prompt " $(ansi_r codes[@]) + PRIGHT="$PRIGHT$(ansi_r codes[@]) " + # else + # debug "no current BG, codes is $codes[@]" + # PRIGHT="$PRIGHT$(ansi codes[@]) " + # fi + CURRENT_RBG=$1 + [[ -n $3 ]] && PRIGHT="$PRIGHT$3" +} + +###################################################################### +## Emacs prompt --- for dir tracking +# stick the following in your .emacs if you use this: + +# (setq dirtrack-list '(".*DIR *\\([^ ]*\\) DIR" 1 nil)) +# (defun dirtrack-filter-out-pwd-prompt (string) +# "dirtrack-mode doesn't remove the PWD match from the prompt. This does." +# ;; TODO: support dirtrack-mode's multiline regexp. +# (if (and (stringp string) (string-match (first dirtrack-list) string)) +# (replace-match "" t t string 0) +# string)) +# (add-hook 'shell-mode-hook +# #'(lambda () +# (dirtrack-mode 1) +# (add-hook 'comint-preoutput-filter-functions +# 'dirtrack-filter-out-pwd-prompt t t))) + +prompt_emacsdir() { + # no color or other setting... this will be deleted per above + PR="DIR \w DIR$PR" +} + +###################################################################### +## Main prompt + +build_prompt() { + [[ ! -z ${AG_EMACS_DIR+x} ]] && prompt_emacsdir + prompt_status + #[[ -z ${AG_NO_HIST+x} ]] && prompt_histdt + [[ -z ${AG_NO_CONTEXT+x} ]] && prompt_context + prompt_virtualenv + prompt_dir + prompt_git + prompt_end +} + +# from orig... +# export PS1='$(ansi_single $(text_effect reset)) $(build_prompt) ' +# this doesn't work... new model: create a prompt via a PR variable and +# use that. + +set_bash_prompt() { + RETVAL=$? + PR="" + PRIGHT="" + CURRENT_BG=NONE + PR="$(ansi_single $(text_effect reset))" + build_prompt + + # uncomment below to use right prompt + # PS1='\[$(tput sc; printf "%*s" $COLUMNS "$PRIGHT"; tput rc)\]'$PR + PS1=$PR +} + +PROMPT_COMMAND=set_bash_prompt From f29a195f49be108595ff41e858af70c3821ca7d7 Mon Sep 17 00:00:00 2001 From: Nils Winkler Date: Wed, 31 Jul 2019 08:49:20 +0200 Subject: [PATCH 029/388] Make sed replacements work for both BSD and GNU sed Fixes #1411 --- lib/helpers.bash | 10 ++++++++++ plugins/available/proxy.plugin.bash | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/helpers.bash b/lib/helpers.bash index 3a47cd4a..e7ef15ba 100644 --- a/lib/helpers.bash +++ b/lib/helpers.bash @@ -5,6 +5,16 @@ BASH_IT_LOAD_PRIORITY_DEFAULT_PLUGIN=${BASH_IT_LOAD_PRIORITY_DEFAULT_PLUGIN:-250 BASH_IT_LOAD_PRIORITY_DEFAULT_COMPLETION=${BASH_IT_LOAD_PRIORITY_DEFAULT_COMPLETION:-350} BASH_IT_LOAD_PRIORITY_SEPARATOR="---" +# Handle the different ways of running `sed` without generating a backup file based on OS +# - GNU sed (Linux) uses `-i` +# - BSD sed (macOS) uses `-i ''` +# To use this in Bash-it for inline replacements with `sed`, use the following syntax: +# sed "${BASH_IT_SED_I_PARAMETERS[@]}" -e "..." file +BASH_IT_SED_I_PARAMETERS=(-i) +case "$(uname)" in + Darwin*) BASH_IT_SED_I_PARAMETERS=(-i "") +esac + function _command_exists () { _about 'checks for existence of a command' diff --git a/plugins/available/proxy.plugin.bash b/plugins/available/proxy.plugin.bash index 4f4bcbac..afd4dba4 100644 --- a/plugins/available/proxy.plugin.bash +++ b/plugins/available/proxy.plugin.bash @@ -370,7 +370,7 @@ ssh-disable-proxy () group 'proxy' if [ -f ~/.ssh/config ] ; then - sed -e's/^.*ProxyCommand/# ProxyCommand/' -i "" ~/.ssh/config + sed -e's/^.*ProxyCommand/# ProxyCommand/' "${BASH_IT_SED_I_PARAMETERS[@]}" ~/.ssh/config echo "Disabled SSH config proxy settings" fi } @@ -382,7 +382,7 @@ ssh-enable-proxy () group 'proxy' if [ -f ~/.ssh/config ] ; then - sed -e's/# ProxyCommand/ ProxyCommand/' -i "" ~/.ssh/config + sed -e's/# ProxyCommand/ ProxyCommand/' "${BASH_IT_SED_I_PARAMETERS[@]}" ~/.ssh/config echo "Enabled SSH config proxy settings" fi } From c4d03f2407016bfac08f896493d3c24c5b8aa9c7 Mon Sep 17 00:00:00 2001 From: Zhao Li Date: Fri, 30 Aug 2019 15:37:17 -1000 Subject: [PATCH 030/388] note how to use toggle flag in README --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index 13a991da..92b6465d 100644 --- a/README.md +++ b/README.md @@ -329,6 +329,19 @@ Set `SCM_GIT_SHOW_STASH_INFO` to 'false' to **don't show** it: * `export SCM_GIT_SHOW_STASH_INFO=false` +### Ahead/Behind Count + +When displaying information regarding whether or not the local branch is ahead or behind it's remote counterpart, you can opt to display the number of commits ahead/behind. +This is useful if you only care whether or not you are ahead or behind and do not care how far ahead/behind you are. + +Set `SCM_GIT_SHOW_COMMIT_COUNT` to 'true' (the default value) to **show** the count of commits ahead/behind: + +* `export SCM_GIT_SHOW_COMMIT_COUNT=true` + +Set `SCM_GIT_SHOW_COMMIT_COUNT` to 'false' to **don't show** it: + +* `export SCM_GIT_SHOW_COMMIT_COUNT=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. From a0af4f40cd72f5cc39ac3139c674a801f34056bf Mon Sep 17 00:00:00 2001 From: Stefano Cislaghi Date: Mon, 2 Sep 2019 11:40:51 +0100 Subject: [PATCH 031/388] Added proxy exceptions (noproxy) for npm --- plugins/available/proxy.plugin.bash | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/available/proxy.plugin.bash b/plugins/available/proxy.plugin.bash index afd4dba4..f2458e3f 100644 --- a/plugins/available/proxy.plugin.bash +++ b/plugins/available/proxy.plugin.bash @@ -121,6 +121,7 @@ npm-show-proxy () echo "===" echo "npm HTTP proxy: " `npm config get proxy` echo "npm HTTPS proxy: " `npm config get https-proxy` + echo "npm proxy exceptions: " `npm config get noproxy` fi } @@ -132,6 +133,7 @@ npm-disable-proxy () if $(command -v npm &> /dev/null) ; then npm config delete proxy npm config delete https-proxy + npm config delete noproxy echo "Disabled npm proxy settings" fi } @@ -143,10 +145,12 @@ npm-enable-proxy () local my_http_proxy=${1:-$BASH_IT_HTTP_PROXY} local my_https_proxy=${2:-$BASH_IT_HTTPS_PROXY} + local my_no_proxy=${3:-$BASH_IT_NO_PROXY} if $(command -v npm &> /dev/null) ; then npm config set proxy $my_http_proxy npm config set https-proxy $my_https_proxy + npm config set noproxy $my_no_proxy echo "Enabled npm proxy settings" fi } From 4b2812cbdf3872e8f9f64fff659d29a70b70208f Mon Sep 17 00:00:00 2001 From: Stanko Date: Fri, 13 Sep 2019 10:57:01 +0200 Subject: [PATCH 032/388] Trivial fix for clean theme --- themes/clean/clean.theme.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/clean/clean.theme.bash b/themes/clean/clean.theme.bash index c479a041..0082d671 100644 --- a/themes/clean/clean.theme.bash +++ b/themes/clean/clean.theme.bash @@ -13,7 +13,7 @@ function prompt_command() { if [ "$(whoami)" = root ]; then no_color=$red; else no_color=$white; fi - PS1="${no_color}\u${reset_color}:${blue}\W/${reset_color} \[$(scm_prompt_info)\]${normal}$ " + PS1="${no_color}\u${reset_color}:${blue}\W/${reset_color} $(scm_prompt_info)${normal}$ " } safe_append_prompt_command prompt_command From 92d7e29125454a60953e4a977f245403418a27ac Mon Sep 17 00:00:00 2001 From: Mattia Rigotti Date: Fri, 27 Sep 2019 14:22:01 -0400 Subject: [PATCH 033/388] Add theme/sexy-python, a modified version of sexy which shows in which virtualenv or condaenv you are --- themes/sexy-python/sexy-python.theme.bash | 46 +++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 themes/sexy-python/sexy-python.theme.bash diff --git a/themes/sexy-python/sexy-python.theme.bash b/themes/sexy-python/sexy-python.theme.bash new file mode 100644 index 00000000..e472218a --- /dev/null +++ b/themes/sexy-python/sexy-python.theme.bash @@ -0,0 +1,46 @@ +# Small modification of Sexy Bash Prompt to include virtualenv and condaenv prompts +# (Sexy Bash Prompt is inspired by "Extravagant Zsh Prompt" +# with big thanks to \amethyst on Freenode) + +if tput setaf 1 &> /dev/null; then + if [[ $(tput colors) -ge 256 ]] 2>/dev/null; then + MAGENTA=$(tput setaf 9) + ORANGE=$(tput setaf 172) + GREEN=$(tput setaf 190) + PURPLE=$(tput setaf 141) + WHITE=$(tput setaf 0) + else + MAGENTA=$(tput setaf 5) + ORANGE=$(tput setaf 4) + GREEN=$(tput setaf 2) + PURPLE=$(tput setaf 1) + WHITE=$(tput setaf 7) + fi + BOLD=$(tput bold) + RESET=$(tput sgr0) +else + MAGENTA="\033[1;31m" + ORANGE="\033[1;33m" + GREEN="\033[1;32m" + PURPLE="\033[1;35m" + WHITE="\033[1;37m" + BOLD="" + RESET="\033[m" +fi + +parse_git_dirty () { + [[ $(git status 2> /dev/null | tail -n1 | cut -c 1-17) != "nothing to commit" ]] && echo "*" +} +parse_git_branch () { + git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1$(parse_git_dirty)/" +} + +env_prompt () { + echo -e "($(virtualenv_prompt)$(condaenv_prompt))" +} + +function prompt_command() { + PS1="\[${BOLD}${WHITE}\]$(env_prompt) \[${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\]" +} + +safe_append_prompt_command prompt_command From 1224fbb0fab3814c4161c29952ba910809773182 Mon Sep 17 00:00:00 2001 From: Jonathan Lao-kan Date: Thu, 3 Oct 2019 22:05:53 +0200 Subject: [PATCH 034/388] Improve grammar in README --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 92b6465d..ccaa7946 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Includes autocompletion, themes, aliases, custom functions, a few stolen pieces from Steve Losh, and more. Bash-it provides a solid framework for using, developing and maintaining shell scripts and custom commands for your daily work. -If you're using the _Bourne Again Shell_ (Bash) on a regular basis and have been looking for an easy way on how to keep all of these nice little scripts and aliases under control, then Bash-it is for you! +If you're using the _Bourne Again Shell_ (Bash) regularly and have been looking for an easy way on how to keep all of these nice little scripts and aliases under control, then Bash-it is for you! Stop polluting your `~/bin` directory and your `.bashrc` file, fork/clone Bash-it and start hacking away. - [Contributing](#contributing) @@ -58,7 +58,7 @@ Feel free to enable the tools you want to use after the installation. When you run without the `--no-modify-config` switch, the Bash-it installer automatically modifies/replaces your existing config file. Use the `--no-modify-config` switch to avoid unwanted modifications, e.g. if your Bash config file already contains the code that loads Bash-it. -**NOTE**: Keep in mind how Bash load its configuration files, +**NOTE**: Keep in mind how Bash loads its configuration files, `.bash_profile` for login shells (and in macOS in terminal emulators like [Terminal.app](http://www.apple.com/osx/apps/) or [iTerm2](https://www.iterm2.com/)) and `.bashrc` for interactive shells (default mode in most of the GNU/Linux terminal emulators), to ensure that Bash-it is loaded correctly. @@ -77,7 +77,7 @@ Refer to the official [Bash documentation](https://www.gnu.org/software/bash/man ### Install using Docker You can try Bash-it in an isolated environment without changing any local files via a [Docker](https://www.docker.com/) Container. -(Bash Shell v4.4 with Bash-it, [bats](https://github.com/sstephenson/bats) and bash-completion based on [Alpine Linux](https://alpinelinux.org/)). +(Bash Shell v4.4 with Bash-it, [bats](https://github.com/sstephenson/bats),and bash-completion based on [Alpine Linux](https://alpinelinux.org/)). `docker pull ellerbrock/bash-it` @@ -206,7 +206,7 @@ export BASH_IT_THEME="" You can easily preview the themes in your own shell using `BASH_PREVIEW=true bash-it reload`. -If you've created your own custom prompts, we'd love it if you shared with everyone else! Just submit a Pull Request. +If you've created your own custom prompts, we'd love it if you shared them with everyone else! Just submit a Pull Request. You can see theme screenshots on [wiki/Themes](https://github.com/Bash-it/bash-it/wiki/Themes). **NOTE**: Bash-it and some themes use UTF-8 characters, so to avoid strange behavior in your terminal, set your locale to `LC_ALL=en_US.UTF-8` or the equivalent to your language if it isn't American English. @@ -235,7 +235,7 @@ Bash-it will automatically reload itself after activating or deactivating plugin ### Prompt Version Control Check -Bash-it provides prompt themes the ability to check and display version control information for the current directory. +Bash-it provides prompt themes with the ability to check and display version control information for the current directory. The information is retrieved for each directory and can slow down the navigation of projects with a large number of files and folders. Turn version control checking off to prevent slow directory navigation within large projects. @@ -331,7 +331,7 @@ Set `SCM_GIT_SHOW_STASH_INFO` to 'false' to **don't show** it: ### Ahead/Behind Count -When displaying information regarding whether or not the local branch is ahead or behind it's remote counterpart, you can opt to display the number of commits ahead/behind. +When displaying information regarding whether or not the local branch is ahead or behind its remote counterpart, you can opt to display the number of commits ahead/behind. This is useful if you only care whether or not you are ahead or behind and do not care how far ahead/behind you are. Set `SCM_GIT_SHOW_COMMIT_COUNT` to 'true' (the default value) to **show** the count of commits ahead/behind: From 8b7333cd299135ce175d293d495f12ccf0a0377f Mon Sep 17 00:00:00 2001 From: Mattia Rigotti Date: Fri, 27 Sep 2019 14:22:01 -0400 Subject: [PATCH 035/388] Add theme/sexy-python, a modified version of sexy which shows in which virtualenv or condaenv you are --- themes/sexy-python/sexy-python.theme.bash | 46 +++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 themes/sexy-python/sexy-python.theme.bash diff --git a/themes/sexy-python/sexy-python.theme.bash b/themes/sexy-python/sexy-python.theme.bash new file mode 100644 index 00000000..e472218a --- /dev/null +++ b/themes/sexy-python/sexy-python.theme.bash @@ -0,0 +1,46 @@ +# Small modification of Sexy Bash Prompt to include virtualenv and condaenv prompts +# (Sexy Bash Prompt is inspired by "Extravagant Zsh Prompt" +# with big thanks to \amethyst on Freenode) + +if tput setaf 1 &> /dev/null; then + if [[ $(tput colors) -ge 256 ]] 2>/dev/null; then + MAGENTA=$(tput setaf 9) + ORANGE=$(tput setaf 172) + GREEN=$(tput setaf 190) + PURPLE=$(tput setaf 141) + WHITE=$(tput setaf 0) + else + MAGENTA=$(tput setaf 5) + ORANGE=$(tput setaf 4) + GREEN=$(tput setaf 2) + PURPLE=$(tput setaf 1) + WHITE=$(tput setaf 7) + fi + BOLD=$(tput bold) + RESET=$(tput sgr0) +else + MAGENTA="\033[1;31m" + ORANGE="\033[1;33m" + GREEN="\033[1;32m" + PURPLE="\033[1;35m" + WHITE="\033[1;37m" + BOLD="" + RESET="\033[m" +fi + +parse_git_dirty () { + [[ $(git status 2> /dev/null | tail -n1 | cut -c 1-17) != "nothing to commit" ]] && echo "*" +} +parse_git_branch () { + git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1$(parse_git_dirty)/" +} + +env_prompt () { + echo -e "($(virtualenv_prompt)$(condaenv_prompt))" +} + +function prompt_command() { + PS1="\[${BOLD}${WHITE}\]$(env_prompt) \[${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\]" +} + +safe_append_prompt_command prompt_command From b0a22e0b97b0234655a78cbc44d8bbedc0f6397d Mon Sep 17 00:00:00 2001 From: Mattia Rigotti Date: Fri, 4 Oct 2019 12:50:06 -0400 Subject: [PATCH 036/388] In themes/sexy add option to visualize python environment --- themes/sexy/sexy.theme.bash | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/themes/sexy/sexy.theme.bash b/themes/sexy/sexy.theme.bash index 08869a3b..4250c540 100644 --- a/themes/sexy/sexy.theme.bash +++ b/themes/sexy/sexy.theme.bash @@ -1,6 +1,10 @@ # Sexy Bash Prompt, inspired by "Extravagant Zsh Prompt" # Screenshot: http://cloud.gf3.ca/M5rG # A big thanks to \amethyst on Freenode +# +# Configuration: +# * To visualize python environment (virtualenv and conda) add in your .bash_profile the following line: +# export SEXY_WITH_PYTHON=true if tput setaf 1 &> /dev/null; then if [[ $(tput colors) -ge 256 ]] 2>/dev/null; then @@ -34,9 +38,16 @@ parse_git_dirty () { parse_git_branch () { git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1$(parse_git_dirty)/" } +env_prompt () { + echo -e "($(virtualenv_prompt)$(condaenv_prompt))" +} function prompt_command() { 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\]" + + if [ "$SEXY_WITH_PYTHON" = true ] ; then + PS1="\[${BOLD}${WHITE}\]$(env_prompt) "$PS1 + fi } safe_append_prompt_command prompt_command From ed47edcb06079642ee1e28ea0ea46d7b9005c4e4 Mon Sep 17 00:00:00 2001 From: Mattia Rigotti Date: Fri, 4 Oct 2019 12:51:23 -0400 Subject: [PATCH 037/388] Remove themes/sexy-python (it is now integrated in themes/sexy) --- themes/sexy-python/sexy-python.theme.bash | 46 ----------------------- 1 file changed, 46 deletions(-) delete mode 100644 themes/sexy-python/sexy-python.theme.bash diff --git a/themes/sexy-python/sexy-python.theme.bash b/themes/sexy-python/sexy-python.theme.bash deleted file mode 100644 index e472218a..00000000 --- a/themes/sexy-python/sexy-python.theme.bash +++ /dev/null @@ -1,46 +0,0 @@ -# Small modification of Sexy Bash Prompt to include virtualenv and condaenv prompts -# (Sexy Bash Prompt is inspired by "Extravagant Zsh Prompt" -# with big thanks to \amethyst on Freenode) - -if tput setaf 1 &> /dev/null; then - if [[ $(tput colors) -ge 256 ]] 2>/dev/null; then - MAGENTA=$(tput setaf 9) - ORANGE=$(tput setaf 172) - GREEN=$(tput setaf 190) - PURPLE=$(tput setaf 141) - WHITE=$(tput setaf 0) - else - MAGENTA=$(tput setaf 5) - ORANGE=$(tput setaf 4) - GREEN=$(tput setaf 2) - PURPLE=$(tput setaf 1) - WHITE=$(tput setaf 7) - fi - BOLD=$(tput bold) - RESET=$(tput sgr0) -else - MAGENTA="\033[1;31m" - ORANGE="\033[1;33m" - GREEN="\033[1;32m" - PURPLE="\033[1;35m" - WHITE="\033[1;37m" - BOLD="" - RESET="\033[m" -fi - -parse_git_dirty () { - [[ $(git status 2> /dev/null | tail -n1 | cut -c 1-17) != "nothing to commit" ]] && echo "*" -} -parse_git_branch () { - git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1$(parse_git_dirty)/" -} - -env_prompt () { - echo -e "($(virtualenv_prompt)$(condaenv_prompt))" -} - -function prompt_command() { - PS1="\[${BOLD}${WHITE}\]$(env_prompt) \[${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\]" -} - -safe_append_prompt_command prompt_command From c0ac3d8393bfe6328f3e10b09734dc2f2a94465c Mon Sep 17 00:00:00 2001 From: markusdd Date: Sat, 5 Oct 2019 15:50:59 +0200 Subject: [PATCH 038/388] Update less-pretty-cat plugin to support pygment style selection Pygments offers great styles and in dark terminals the default is unsatisfactory. Use two new env variables BASH_IT_CLESS_STYLE and BASH_IT_CCAT_STYLE to select pygment themes. Availables styles can be listes using pygmentize -L styles --- plugins/available/less-pretty-cat.plugin.bash | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/plugins/available/less-pretty-cat.plugin.bash b/plugins/available/less-pretty-cat.plugin.bash index 841122ca..ce846868 100644 --- a/plugins/available/less-pretty-cat.plugin.bash +++ b/plugins/available/less-pretty-cat.plugin.bash @@ -13,9 +13,12 @@ if $(command -v pygmentize &> /dev/null) ; then about 'runs either pygmentize or cat on each file passed in' param '*: files to concatenate (as normally passed to cat)' example 'cat mysite/manage.py dir/text-file.txt' + if [ -z "$BASH_IT_CCAT_STYLE" ]; then + BASH_IT_CCAT_STYLE=default; + fi for var; do - pygmentize "$var" 2>/dev/null || "$CAT_BIN" "$var"; + pygmentize -f 256 -O style="$BASH_IT_CCAT_STYLE" -g "$var" 2>/dev/null || "$CAT_BIN" "$var"; done } @@ -24,6 +27,9 @@ if $(command -v pygmentize &> /dev/null) ; then about 'it pigments the file passed in and passes it to less for pagination' param '$1: the file to paginate with less' example 'less mysite/manage.py' - pygmentize -g $* | "$LESS_BIN" -R + if [ -z "$BASH_IT_CLESS_STYLE" ]; then + BASH_IT_CLESS_STYLE=default; + fi + pygmentize -f 256 -O style="$BASH_IT_CLESS_STYLE" -g $* | "$LESS_BIN" -R } fi From c9054e25a9c847eee4a8af27e47af2deec75bf28 Mon Sep 17 00:00:00 2001 From: markusdd Date: Mon, 7 Oct 2019 14:19:38 +0200 Subject: [PATCH 039/388] implement feedback --- plugins/available/less-pretty-cat.plugin.bash | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/plugins/available/less-pretty-cat.plugin.bash b/plugins/available/less-pretty-cat.plugin.bash index ce846868..b6b9d1f0 100644 --- a/plugins/available/less-pretty-cat.plugin.bash +++ b/plugins/available/less-pretty-cat.plugin.bash @@ -5,6 +5,8 @@ if $(command -v pygmentize &> /dev/null) ; then # get the full paths to binaries CAT_BIN=$(which cat) LESS_BIN=$(which less) + BASH_IT_CCAT_STYLE="${BASH_IT_CCAT_STYLE:=default}" + BASH_IT_CLESS_STYLE="${BASH_IT_CLESS_STYLE:=default}" # pigmentize cat and less outputs - call them ccat and cless to avoid that # especially cat'ed output in scripts gets mangled with pygemtized meta characters @@ -13,9 +15,6 @@ if $(command -v pygmentize &> /dev/null) ; then about 'runs either pygmentize or cat on each file passed in' param '*: files to concatenate (as normally passed to cat)' example 'cat mysite/manage.py dir/text-file.txt' - if [ -z "$BASH_IT_CCAT_STYLE" ]; then - BASH_IT_CCAT_STYLE=default; - fi for var; do pygmentize -f 256 -O style="$BASH_IT_CCAT_STYLE" -g "$var" 2>/dev/null || "$CAT_BIN" "$var"; @@ -27,9 +26,6 @@ if $(command -v pygmentize &> /dev/null) ; then about 'it pigments the file passed in and passes it to less for pagination' param '$1: the file to paginate with less' example 'less mysite/manage.py' - if [ -z "$BASH_IT_CLESS_STYLE" ]; then - BASH_IT_CLESS_STYLE=default; - fi pygmentize -f 256 -O style="$BASH_IT_CLESS_STYLE" -g $* | "$LESS_BIN" -R } fi From ea02e3d6bd3ad603224cacb5ee7b56583dd6b693 Mon Sep 17 00:00:00 2001 From: Zanark Date: Thu, 10 Oct 2019 16:54:43 +0530 Subject: [PATCH 040/388] added theme bash files --- themes/gitline/powerline.base.bash | 234 +++++++++++++++++++++++++++++ themes/gitline/redline.theme.bash | 68 +++++++++ 2 files changed, 302 insertions(+) create mode 100644 themes/gitline/powerline.base.bash create mode 100644 themes/gitline/redline.theme.bash diff --git a/themes/gitline/powerline.base.bash b/themes/gitline/powerline.base.bash new file mode 100644 index 00000000..925791fc --- /dev/null +++ b/themes/gitline/powerline.base.bash @@ -0,0 +1,234 @@ +# Define this here so it can be used by all of the Powerline themes +THEME_CHECK_SUDO=${THEME_CHECK_SUDO:=true} + +#To set color for foreground and background +function set_color { + set +u + if [[ "${1}" != "-" ]]; then + fg="38;5;${1}" + fi + if [[ "${2}" != "-" ]]; then + bg="48;5;${2}" + [[ -n "${fg}" ]] && bg=";${bg}" + fi + echo -e "\[\033[${fg}${bg}m\]" +} + +#Customising User Info Segment +function __powerline_user_info_prompt { + local user_info="${USER}" + local color=${USER_INFO_THEME_PROMPT_COLOR} + local fg_color=15 + + if [[ "${THEME_CHECK_SUDO}" = true ]]; then + if sudo -n uptime 2>&1 | grep -q "load"; then + color=${USER_INFO_THEME_PROMPT_COLOR_SUDO} + fi + fi + + case "${POWERLINE_PROMPT_USER_INFO_MODE}" in + "sudo") + if [[ "${color}" = "${USER_INFO_THEME_PROMPT_COLOR_SUDO}" ]]; then + user_info="👑 ${USER}" + fg_color=227 + color=${USER_INFO_THEME_PROMPT_COLOR_SUDO} + fi + ;; + *) + if [[ -n "${SSH_CLIENT}" ]] || [[ -n "${SSH_CONNECTION}" ]]; then + user_info="${USER_INFO_SSH_CHAR}${USER}" + else + user_info="${USER}" + fi + ;; + esac + [[ -n "${user_info}" ]] && echo "${user_info}|${color}|${fg_color}" +} + +#Customising Ruby Prompt +function __powerline_ruby_prompt { + local ruby_version="" + local fg_color=206 + + if _command_exists rvm; then + ruby_version="$(rvm_version_prompt)" + elif _command_exists rbenv; then + ruby_version=$(rbenv_version_prompt) + fi + + [[ -n "${ruby_version}" ]] && echo "${RUBY_CHAR}${ruby_version}|${RUBY_THEME_PROMPT_COLOR}|${fg_color}" +} + +#Customising Python (venv) Prompt +function __powerline_python_venv_prompt { + set +u + local python_venv="" + local fg_color=206 + + if [[ -n "${CONDA_DEFAULT_ENV}" ]]; then + python_venv="${CONDA_DEFAULT_ENV}" + PYTHON_VENV_CHAR=${CONDA_PYTHON_VENV_CHAR} + elif [[ -n "${VIRTUAL_ENV}" ]]; then + python_venv=$(basename "${VIRTUAL_ENV}") + fi + + [[ -n "${python_venv}" ]] && echo "${PYTHON_VENV_CHAR}${python_venv}|${PYTHON_VENV_THEME_PROMPT_COLOR}|${fg_color}" +} + +#Customising SCM Prompt +function __powerline_scm_prompt { + local color="" + local scm_prompt="" + local fg_color=206 + + scm_prompt_vars + + # echo "${scm}" + + if [[ "${SCM_NONE_CHAR}" != "${SCM_CHAR}" ]]; then + if [[ "${SCM_DIRTY}" -eq 3 ]]; then + color=${SCM_THEME_PROMPT_STAGED_COLOR} + fg_color=124 + elif [[ "${SCM_DIRTY}" -eq 2 ]]; then + color=${SCM_THEME_PROMPT_UNSTAGED_COLOR} + fg_color=56 + elif [[ "${SCM_DIRTY}" -eq 1 ]]; then + color=${SCM_THEME_PROMPT_DIRTY_COLOR} + fg_color=118 + elif [[ "${SCM_DIRTY}" -eq 0 ]]; then + color=${SCM_THEME_PROMPT_CLEAN_COLOR} + fg_color=16 + else + color=${SCM_THEME_PROMPT_COLOR} + fg_color=255 + fi + # if [[ "${SCM_BRANCH}" == "master" ]]; then + # color=128 + # fg_color=251 + # fi + if [[ "${SCM_GIT_CHAR}" == "${SCM_CHAR}" ]]; then + 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}|${fg_color}" + fi +} + +function __powerline_cwd_prompt { + local cwd=$(pwd | sed "s|^${HOME}|~|") + local fg_color=16 + + echo "${cwd}|${CWD_THEME_PROMPT_COLOR}|${fg_color}" +} + +function __powerline_hostname_prompt { + local fg_color=206 + + echo "$(hostname -s)|${HOST_THEME_PROMPT_COLOR}|${fg_color}" +} + +function __powerline_wd_prompt { + local fg_color=206 + + echo "\W|${CWD_THEME_PROMPT_COLOR}|${fg_color}" +} + +function __powerline_clock_prompt { + local fg_color=206 + + echo "$(date +"${THEME_CLOCK_FORMAT}")|${CLOCK_THEME_PROMPT_COLOR}|${fg_color}" +} + +function __powerline_battery_prompt { + local color="" + local battery_status="$(battery_percentage 2> /dev/null)" + local fg_color=255 + + if [[ -z "${battery_status}" ]] || [[ "${battery_status}" = "-1" ]] || [[ "${battery_status}" = "no" ]]; then + true + else + if [[ "$((10#${battery_status}))" -le 5 ]]; then + color="${BATTERY_STATUS_THEME_PROMPT_CRITICAL_COLOR}" + elif [[ "$((10#${battery_status}))" -le 25 ]]; then + color="${BATTERY_STATUS_THEME_PROMPT_LOW_COLOR}" + else + color="${BATTERY_STATUS_THEME_PROMPT_GOOD_COLOR}" + fi + ac_adapter_connected && battery_status="${BATTERY_AC_CHAR}${battery_status}" + echo "${battery_status}%|${color}|${fg_color}" + fi +} + +function __powerline_in_vim_prompt { + local fg_color=206 + + if [ -n "$VIMRUNTIME" ]; then + echo "${IN_VIM_THEME_PROMPT_TEXT}|${IN_VIM_THEME_PROMPT_COLOR}|${fg_color}" + fi +} + +function __powerline_aws_profile_prompt { + local fg_color=206 + + if [[ -n "${AWS_PROFILE}" ]]; then + echo "${AWS_PROFILE_CHAR}${AWS_PROFILE}|${AWS_PROFILE_PROMPT_COLOR}|${fg_color}" + fi +} + +function __powerline_left_segment { + local OLD_IFS="${IFS}"; IFS="|" + local params=( $1 ) + IFS="${OLD_IFS}" + local separator_char="${POWERLINE_LEFT_SEPARATOR}" + local separator="" + local fg_color=206 + + #for seperator character + if [[ "${SEGMENTS_AT_LEFT}" -gt 0 ]]; then + separator="$(set_color ${LAST_SEGMENT_COLOR} ${params[1]})${separator_char}${normal}" + fi + #change here to cahnge fg color + #echo "${params[0]} -> ${params[1]} -> ${params[2]}" + LEFT_PROMPT+="${separator}$(set_color ${params[2]} ${params[1]}) ${params[0]} ${normal}" + #seperator char color = current bg + LAST_SEGMENT_COLOR=${params[1]} + (( SEGMENTS_AT_LEFT += 1 )) +} + +function __powerline_last_status_prompt { + [[ "$1" -ne 0 ]] && echo "${1}|${LAST_STATUS_THEME_PROMPT_COLOR}" +} + +function __powerline_prompt_command { + local last_status="$?" ## always the first + local separator_char="${POWERLINE_PROMPT_CHAR}" + + LEFT_PROMPT="" + SEGMENTS_AT_LEFT=0 + LAST_SEGMENT_COLOR="" + + + if [[ -n "${POWERLINE_PROMPT_DISTRO_LOGO}" ]]; then + LEFT_PROMPT+="$(set_color ${PROMPT_DISTRO_LOGO_COLOR} ${PROMPT_DISTRO_LOGO_COLORBG})${PROMPT_DISTRO_LOGO}$(set_color - -)" + fi + + ## left prompt ## + for segment in $POWERLINE_PROMPT; do + local info="$(__powerline_${segment}_prompt)" + [[ -n "${info}" ]] && __powerline_left_segment "${info}" + done + + [[ "${last_status}" -ne 0 ]] && __powerline_left_segment $(__powerline_last_status_prompt ${last_status}) + [[ -n "${LEFT_PROMPT}" ]] && LEFT_PROMPT+="$(set_color ${LAST_SEGMENT_COLOR} -)${separator_char}${normal}" + + PS1="${LEFT_PROMPT} " + + ## cleanup ## + unset LAST_SEGMENT_COLOR \ + LEFT_PROMPT \ + SEGMENTS_AT_LEFT +} + diff --git a/themes/gitline/redline.theme.bash b/themes/gitline/redline.theme.bash new file mode 100644 index 00000000..425c5897 --- /dev/null +++ b/themes/gitline/redline.theme.bash @@ -0,0 +1,68 @@ +#!/usr/bin/env bash + +. "$BASH_IT/themes/redline/powerline.base.bash" + +#For the logo +#PROMPT_DISTRO_LOGO="💻" +PROMPT_DISTRO_LOGO_COLOR=15 +PROMPT_DISTRO_LOGO_COLORBG=52 + +#Prompt Seperator Charactors +PROMPT_CHAR=${POWERLINE_PROMPT_CHAR:=""} +POWERLINE_LEFT_SEPARATOR=${POWERLINE_LEFT_SEPARATOR:=""} + +#USER INFO CHARACTERS +USER_INFO_SSH_CHAR=${POWERLINE_USER_INFO_SSH_CHAR:=" "} +USER_INFO_SUDO_CHAR=${POWERLINE_USER_INFO_SUDO_CHAR:=" "} +USER_INFO_THEME_PROMPT_COLOR=91 +USER_INFO_THEME_PROMPT_COLOR_SUDO=1 + +PYTHON_VENV_CHAR=${POWERLINE_PYTHON_VENV_CHAR:=" "} +CONDA_PYTHON_VENV_CHAR=${POWERLINE_CONDA_PYTHON_VENV_CHAR:="❲c❳ "} +PYTHON_VENV_THEME_PROMPT_COLOR=17 + +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=91 +SCM_THEME_PROMPT_CLEAN_COLOR=41 +SCM_THEME_PROMPT_DIRTY_COLOR=94 +SCM_THEME_PROMPT_STAGED_COLOR=220 #52 +SCM_THEME_PROMPT_UNSTAGED_COLOR=81 +#SCM_THEME_PROMPT_COLOR=${SCM_THEME_PROMPT_CLEAN_COLOR} + + +RVM_THEME_PROMPT_PREFIX="" +RVM_THEME_PROMPT_SUFFIX="" +RBENV_THEME_PROMPT_PREFIX="" +RBENV_THEME_PROMPT_SUFFIX="" +RUBY_THEME_PROMPT_COLOR=161 +RUBY_CHAR=${POWERLINE_RUBY_CHAR:="❲r❳ "} + +CWD_THEME_DIR_SEPARATOR="" +CWD_THEME_DIR_SEPARATOR_COLOR=52 +CWD_THEME_PROMPT_COLOR=252 + +HOST_THEME_PROMPT_COLOR=88 + +LAST_STATUS_THEME_PROMPT_COLOR=52 + +CLOCK_THEME_PROMPT_COLOR=240 + +BATTERY_AC_CHAR=${BATTERY_AC_CHAR:="⚡"} +BATTERY_STATUS_THEME_PROMPT_GOOD_COLOR=70 +BATTERY_STATUS_THEME_PROMPT_LOW_COLOR=208 +BATTERY_STATUS_THEME_PROMPT_CRITICAL_COLOR=160 + +THEME_CLOCK_FORMAT=${THEME_CLOCK_FORMAT:="%H:%M:%S"} + +IN_VIM_THEME_PROMPT_COLOR=245 +IN_VIM_THEME_PROMPT_TEXT="vim" + +#POWERLINE_PROMPT=${POWERLINE_PROMPT:="python_venv ruby user_info hostname cwd scm"} +#POWERLINE_PROMPT=${POWERLINE_PROMPT:="user_info scm python_venv ruby cwd"} + + +safe_append_prompt_command __powerline_prompt_command From fd1a477716f4ff6dc5a90be84f523c481286cef5 Mon Sep 17 00:00:00 2001 From: NEwa-05 Date: Fri, 11 Oct 2019 12:36:49 +0000 Subject: [PATCH 041/388] change git alias following issues #1419 --- aliases/available/git.aliases.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aliases/available/git.aliases.bash b/aliases/available/git.aliases.bash index fc95300d..7e3d53ee 100644 --- a/aliases/available/git.aliases.bash +++ b/aliases/available/git.aliases.bash @@ -27,7 +27,7 @@ alias gpr='git pull --rebase' alias gpp='git pull && git push' alias gup='git fetch && git rebase' alias gp='git push' -alias gpo='git push origin' +alias gpo='git push origin HEAD' alias gpu='git push --set-upstream' alias gpuo='git push --set-upstream origin' alias gpuoc='git push --set-upstream origin $(git symbolic-ref --short HEAD)' From 9a543ead482b0157cd7b774dcb1d7594c58e623c Mon Sep 17 00:00:00 2001 From: Zanark Date: Sat, 12 Oct 2019 13:15:24 +0530 Subject: [PATCH 042/388] renamed files --- themes/gitline/{redline.theme.bash => gitline.theme.bash} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename themes/gitline/{redline.theme.bash => gitline.theme.bash} (100%) diff --git a/themes/gitline/redline.theme.bash b/themes/gitline/gitline.theme.bash similarity index 100% rename from themes/gitline/redline.theme.bash rename to themes/gitline/gitline.theme.bash From 08785d96b574fa93f43a55c968edac697bbe33f3 Mon Sep 17 00:00:00 2001 From: Mattia Rigotti Date: Sat, 12 Oct 2019 11:48:51 +0200 Subject: [PATCH 043/388] Delete stand-alone theme sexy-python --- themes/sexy-python/sexy-python.theme.bash | 46 ----------------------- 1 file changed, 46 deletions(-) delete mode 100644 themes/sexy-python/sexy-python.theme.bash diff --git a/themes/sexy-python/sexy-python.theme.bash b/themes/sexy-python/sexy-python.theme.bash deleted file mode 100644 index e472218a..00000000 --- a/themes/sexy-python/sexy-python.theme.bash +++ /dev/null @@ -1,46 +0,0 @@ -# Small modification of Sexy Bash Prompt to include virtualenv and condaenv prompts -# (Sexy Bash Prompt is inspired by "Extravagant Zsh Prompt" -# with big thanks to \amethyst on Freenode) - -if tput setaf 1 &> /dev/null; then - if [[ $(tput colors) -ge 256 ]] 2>/dev/null; then - MAGENTA=$(tput setaf 9) - ORANGE=$(tput setaf 172) - GREEN=$(tput setaf 190) - PURPLE=$(tput setaf 141) - WHITE=$(tput setaf 0) - else - MAGENTA=$(tput setaf 5) - ORANGE=$(tput setaf 4) - GREEN=$(tput setaf 2) - PURPLE=$(tput setaf 1) - WHITE=$(tput setaf 7) - fi - BOLD=$(tput bold) - RESET=$(tput sgr0) -else - MAGENTA="\033[1;31m" - ORANGE="\033[1;33m" - GREEN="\033[1;32m" - PURPLE="\033[1;35m" - WHITE="\033[1;37m" - BOLD="" - RESET="\033[m" -fi - -parse_git_dirty () { - [[ $(git status 2> /dev/null | tail -n1 | cut -c 1-17) != "nothing to commit" ]] && echo "*" -} -parse_git_branch () { - git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1$(parse_git_dirty)/" -} - -env_prompt () { - echo -e "($(virtualenv_prompt)$(condaenv_prompt))" -} - -function prompt_command() { - PS1="\[${BOLD}${WHITE}\]$(env_prompt) \[${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\]" -} - -safe_append_prompt_command prompt_command From a50a4ff633bed3ac27bd761f3e86889750696549 Mon Sep 17 00:00:00 2001 From: Mattia Rigotti Date: Sat, 12 Oct 2019 11:50:54 +0200 Subject: [PATCH 044/388] Rename variable to SEXY_THEME_SHOW_PYTHON --- themes/sexy/sexy.theme.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/sexy/sexy.theme.bash b/themes/sexy/sexy.theme.bash index 4250c540..fdbbf83d 100644 --- a/themes/sexy/sexy.theme.bash +++ b/themes/sexy/sexy.theme.bash @@ -4,7 +4,7 @@ # # Configuration: # * To visualize python environment (virtualenv and conda) add in your .bash_profile the following line: -# export SEXY_WITH_PYTHON=true +# export SEXY_THEME_SHOW_PYTHON=true if tput setaf 1 &> /dev/null; then if [[ $(tput colors) -ge 256 ]] 2>/dev/null; then @@ -45,7 +45,7 @@ env_prompt () { function prompt_command() { 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\]" - if [ "$SEXY_WITH_PYTHON" = true ] ; then + if [ "$SEXY_THEME_SHOW_PYTHON" = true ] ; then PS1="\[${BOLD}${WHITE}\]$(env_prompt) "$PS1 fi } From 05ded884658defde0fbc160a9d718f35f33bf845 Mon Sep 17 00:00:00 2001 From: Mattia Rigotti Date: Sat, 12 Oct 2019 11:52:53 +0200 Subject: [PATCH 045/388] Set SEXY_THEME_SHOW_PYTHON variable default value --- themes/sexy/sexy.theme.bash | 3 +++ 1 file changed, 3 insertions(+) diff --git a/themes/sexy/sexy.theme.bash b/themes/sexy/sexy.theme.bash index fdbbf83d..41d195d2 100644 --- a/themes/sexy/sexy.theme.bash +++ b/themes/sexy/sexy.theme.bash @@ -6,6 +6,9 @@ # * To visualize python environment (virtualenv and conda) add in your .bash_profile the following line: # export SEXY_THEME_SHOW_PYTHON=true +# Default setting +SEXY_THEME_SHOW_PYTHON="${SEXY_THEME_SHOW_PYTHON:=false}" + if tput setaf 1 &> /dev/null; then if [[ $(tput colors) -ge 256 ]] 2>/dev/null; then MAGENTA=$(tput setaf 9) From 0e8b6775b9f3f0de09fea8049deb4318566a008e Mon Sep 17 00:00:00 2001 From: zwfang Date: Fri, 11 Oct 2019 23:09:50 +0800 Subject: [PATCH 046/388] Add a new theme named newin :) --- themes/newin/newin.theme.bash | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 themes/newin/newin.theme.bash diff --git a/themes/newin/newin.theme.bash b/themes/newin/newin.theme.bash new file mode 100644 index 00000000..9f54dc8a --- /dev/null +++ b/themes/newin/newin.theme.bash @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +SCM_THEME_PROMPT_DIRTY=" ${red}✗" +SCM_THEME_PROMPT_CLEAN=" ${green}✓" +SCM_THEME_PROMPT_PREFIX=" ${purple}|${green} " +SCM_THEME_PROMPT_SUFFIX="${purple} |" + +prompt() { + exit_code=$? + PS1="$(if [[ ${exit_code} = 0 ]]; then echo "${green}${exit_code}"; else echo "${red}${exit_code}"; fi) ${yellow}\t ${cyan}\w$(scm_prompt_info)${reset_color}\n${orange}$ ${reset_color}" +} + +safe_append_prompt_command prompt From f99ccbd1f20e2671821669458b5b704fecb3ed00 Mon Sep 17 00:00:00 2001 From: Zanark Date: Fri, 18 Oct 2019 11:13:19 +0530 Subject: [PATCH 047/388] Removed redundant code and added some descriptive comments --- themes/gitline/gitline.theme.bash | 12 ++++++------ themes/gitline/powerline.base.bash | 10 ++-------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/themes/gitline/gitline.theme.bash b/themes/gitline/gitline.theme.bash index 425c5897..3e6be360 100644 --- a/themes/gitline/gitline.theme.bash +++ b/themes/gitline/gitline.theme.bash @@ -2,7 +2,7 @@ . "$BASH_IT/themes/redline/powerline.base.bash" -#For the logo +#For the logo(Uncomment if you want a logo before your name) #PROMPT_DISTRO_LOGO="💻" PROMPT_DISTRO_LOGO_COLOR=15 PROMPT_DISTRO_LOGO_COLORBG=52 @@ -17,10 +17,12 @@ USER_INFO_SUDO_CHAR=${POWERLINE_USER_INFO_SUDO_CHAR:=" "} USER_INFO_THEME_PROMPT_COLOR=91 USER_INFO_THEME_PROMPT_COLOR_SUDO=1 +#PYTHON VENV PYTHON_VENV_CHAR=${POWERLINE_PYTHON_VENV_CHAR:=" "} CONDA_PYTHON_VENV_CHAR=${POWERLINE_CONDA_PYTHON_VENV_CHAR:="❲c❳ "} PYTHON_VENV_THEME_PROMPT_COLOR=17 +#GIT Prompt Symbols SCM_NONE_CHAR="" SCM_GIT_CHAR=${POWERLINE_SCM_GIT_CHAR:=" "} SCM_HG_CHAR=${POWERLINE_SCM_HG_CHAR:="☿ "} @@ -31,9 +33,8 @@ SCM_THEME_PROMPT_CLEAN_COLOR=41 SCM_THEME_PROMPT_DIRTY_COLOR=94 SCM_THEME_PROMPT_STAGED_COLOR=220 #52 SCM_THEME_PROMPT_UNSTAGED_COLOR=81 -#SCM_THEME_PROMPT_COLOR=${SCM_THEME_PROMPT_CLEAN_COLOR} - +#Ruby Prompt Symbols RVM_THEME_PROMPT_PREFIX="" RVM_THEME_PROMPT_SUFFIX="" RBENV_THEME_PROMPT_PREFIX="" @@ -49,8 +50,10 @@ HOST_THEME_PROMPT_COLOR=88 LAST_STATUS_THEME_PROMPT_COLOR=52 +#Clock CLOCK_THEME_PROMPT_COLOR=240 +#For Battery Plugin BATTERY_AC_CHAR=${BATTERY_AC_CHAR:="⚡"} BATTERY_STATUS_THEME_PROMPT_GOOD_COLOR=70 BATTERY_STATUS_THEME_PROMPT_LOW_COLOR=208 @@ -61,8 +64,5 @@ THEME_CLOCK_FORMAT=${THEME_CLOCK_FORMAT:="%H:%M:%S"} IN_VIM_THEME_PROMPT_COLOR=245 IN_VIM_THEME_PROMPT_TEXT="vim" -#POWERLINE_PROMPT=${POWERLINE_PROMPT:="python_venv ruby user_info hostname cwd scm"} -#POWERLINE_PROMPT=${POWERLINE_PROMPT:="user_info scm python_venv ruby cwd"} - safe_append_prompt_command __powerline_prompt_command diff --git a/themes/gitline/powerline.base.bash b/themes/gitline/powerline.base.bash index 925791fc..45387b02 100644 --- a/themes/gitline/powerline.base.bash +++ b/themes/gitline/powerline.base.bash @@ -1,4 +1,4 @@ -# Define this here so it can be used by all of the Powerline themes +# Sudo check after every command THEME_CHECK_SUDO=${THEME_CHECK_SUDO:=true} #To set color for foreground and background @@ -75,7 +75,7 @@ function __powerline_python_venv_prompt { [[ -n "${python_venv}" ]] && echo "${PYTHON_VENV_CHAR}${python_venv}|${PYTHON_VENV_THEME_PROMPT_COLOR}|${fg_color}" } -#Customising SCM Prompt +#Customising SCM(GIT) Prompt function __powerline_scm_prompt { local color="" local scm_prompt="" @@ -83,7 +83,6 @@ function __powerline_scm_prompt { scm_prompt_vars - # echo "${scm}" if [[ "${SCM_NONE_CHAR}" != "${SCM_CHAR}" ]]; then if [[ "${SCM_DIRTY}" -eq 3 ]]; then @@ -102,10 +101,6 @@ function __powerline_scm_prompt { color=${SCM_THEME_PROMPT_COLOR} fg_color=255 fi - # if [[ "${SCM_BRANCH}" == "master" ]]; then - # color=128 - # fg_color=251 - # fi if [[ "${SCM_GIT_CHAR}" == "${SCM_CHAR}" ]]; then scm_prompt+="${SCM_CHAR}${SCM_BRANCH}${SCM_STATE}" elif [[ "${SCM_P4_CHAR}" == "${SCM_CHAR}" ]]; then @@ -191,7 +186,6 @@ function __powerline_left_segment { separator="$(set_color ${LAST_SEGMENT_COLOR} ${params[1]})${separator_char}${normal}" fi #change here to cahnge fg color - #echo "${params[0]} -> ${params[1]} -> ${params[2]}" LEFT_PROMPT+="${separator}$(set_color ${params[2]} ${params[1]}) ${params[0]} ${normal}" #seperator char color = current bg LAST_SEGMENT_COLOR=${params[1]} From cf86219418f3e62a916a15667dbdb677068188e5 Mon Sep 17 00:00:00 2001 From: wukuan405 Date: Mon, 28 Oct 2019 12:26:06 +0900 Subject: [PATCH 048/388] updated hub completion --- completion/available/hub.completion.bash | 36 ++++++++++++++++++------ 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/completion/available/hub.completion.bash b/completion/available/hub.completion.bash index bd84d322..8653084c 100644 --- a/completion/available/hub.completion.bash +++ b/completion/available/hub.completion.bash @@ -6,8 +6,8 @@ if ! declare -F _git > /dev/null && declare -F _completion_loader > /dev/null; t _completion_loader git fi -# Check that git tab completion is available -if declare -F _git > /dev/null; then +# Check that git tab completion is available and we haven't already set up completion +if declare -F _git > /dev/null && ! declare -F __git_list_all_commands_without_hub > /dev/null; then # Duplicate and rename the 'list_all_commands' function eval "$(declare -f __git_list_all_commands | \ sed 's/__git_list_all_commands/__git_list_all_commands_without_hub/')" @@ -17,11 +17,16 @@ if declare -F _git > /dev/null; then cat <<-EOF alias pull-request +pr +issue +release fork create +delete browse compare ci-status +sync EOF __git_list_all_commands_without_hub } @@ -213,21 +218,36 @@ EOF esac } - # hub fork [--no-remote] + # hub fork [--no-remote] [--remote-name REMOTE] [--org ORGANIZATION] _git_fork() { - local i c=2 remote=yes + local i c=2 flags="--no-remote --remote-name --org" while [ $c -lt $cword ]; do i="${words[c]}" case "$i" in + --org) + ((c++)) + flags=${flags/$i/} + ;; + --remote-name) + ((c++)) + flags=${flags/$i/} + flags=${flags/--no-remote/} + ;; --no-remote) - unset remote + flags=${flags/$i/} + flags=${flags/--remote-name/} ;; esac ((c++)) done - if [ -n "$remote" ]; then - __gitcomp "--no-remote" - fi + case "$prev" in + --remote-name|--org) + COMPREPLY=() + ;; + *) + __gitcomp "$flags" + ;; + esac } # hub pull-request [-f] [-m |-F |-i |] [-b ] [-h ] [-a ] [-M ] [-l ] From 35066f91b2c7472d06b822bb1de32752316c504c Mon Sep 17 00:00:00 2001 From: zwfang Date: Thu, 31 Oct 2019 21:56:54 +0800 Subject: [PATCH 049/388] add alias gcamd for `git commit --amend` --- aliases/available/git.aliases.bash | 1 + 1 file changed, 1 insertion(+) diff --git a/aliases/available/git.aliases.bash b/aliases/available/git.aliases.bash index 7e3d53ee..9a65b22a 100644 --- a/aliases/available/git.aliases.bash +++ b/aliases/available/git.aliases.bash @@ -43,6 +43,7 @@ alias gca='git commit -v -a' alias gcm='git commit -v -m' alias gcam="git commit -v -am" alias gci='git commit --interactive' +alias gcamd='git commit --amend' alias gb='git branch' alias gba='git branch -a' alias gbt='git branch --track' From 349c1df5564642b71bc92bf295e07963b166dcb2 Mon Sep 17 00:00:00 2001 From: David Farrell Date: Fri, 1 Nov 2019 10:38:34 -0700 Subject: [PATCH 050/388] Adds soft-separator suport to powerline themes --- themes/powerline-multiline/powerline-multiline.base.bash | 8 +++++++- themes/powerline-multiline/powerline-multiline.theme.bash | 2 ++ themes/powerline/powerline.base.bash | 7 ++++++- themes/powerline/powerline.theme.bash | 1 + 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/themes/powerline-multiline/powerline-multiline.base.bash b/themes/powerline-multiline/powerline-multiline.base.bash index ac442f73..ea8b2624 100644 --- a/themes/powerline-multiline/powerline-multiline.base.bash +++ b/themes/powerline-multiline/powerline-multiline.base.bash @@ -9,6 +9,7 @@ function __powerline_right_segment { local params=( $1 ) IFS="${OLD_IFS}" local separator_char="${POWERLINE_RIGHT_SEPARATOR}" + local separator_char_soft="${POWERLINE_RIGHT_SEPARATOR_SOFT}" local padding="${POWERLINE_PADDING}" local separator_color="" @@ -16,7 +17,12 @@ function __powerline_right_segment { separator_char="${POWERLINE_RIGHT_END}" separator_color="$(set_color ${params[1]} -)" else - separator_color="$(set_color ${params[1]} ${LAST_SEGMENT_COLOR})" + if [[ "${LAST_SEGMENT_COLOR}" -eq "${params[1]}" ]]; then + separator_color="$(set_color - ${LAST_SEGMENT_COLOR})" + separator_char=${separator_char_soft} + else + separator_color="$(set_color ${params[1]} ${LAST_SEGMENT_COLOR})" + fi (( padding += 1 )) fi RIGHT_PROMPT+="${separator_color}${separator_char}${normal}$(set_color - ${params[1]}) ${params[0]} ${normal}$(set_color - ${COLOR})${normal}" diff --git a/themes/powerline-multiline/powerline-multiline.theme.bash b/themes/powerline-multiline/powerline-multiline.theme.bash index ad64fb18..5c8187eb 100644 --- a/themes/powerline-multiline/powerline-multiline.theme.bash +++ b/themes/powerline-multiline/powerline-multiline.theme.bash @@ -5,7 +5,9 @@ PROMPT_CHAR=${POWERLINE_PROMPT_CHAR:="❯"} POWERLINE_LEFT_SEPARATOR=${POWERLINE_LEFT_SEPARATOR:=""} +POWERLINE_LEFT_SEPARATOR_SOFT=${POWERLINE_LEFT_SEPARATOR_SOFT:=""} POWERLINE_RIGHT_SEPARATOR=${POWERLINE_RIGHT_SEPARATOR:=""} +POWERLINE_RIGHT_SEPARATOR_SOFT=${POWERLINE_RIGHT_SEPARATOR_SOFT:=""} POWERLINE_LEFT_END=${POWERLINE_LEFT_END:=""} POWERLINE_RIGHT_END=${POWERLINE_RIGHT_END:=""} POWERLINE_PADDING=${POWERLINE_PADDING:=2} diff --git a/themes/powerline/powerline.base.bash b/themes/powerline/powerline.base.bash index 9e668a6c..d55fd60f 100644 --- a/themes/powerline/powerline.base.bash +++ b/themes/powerline/powerline.base.bash @@ -159,10 +159,15 @@ function __powerline_left_segment { local params=( $1 ) IFS="${OLD_IFS}" local separator_char="${POWERLINE_LEFT_SEPARATOR}" + local separator_char_soft="${POWERLINE_LEFT_SEPARATOR_SOFT}" local separator="" if [[ "${SEGMENTS_AT_LEFT}" -gt 0 ]]; then - separator="$(set_color ${LAST_SEGMENT_COLOR} ${params[1]})${separator_char}${normal}" + if [[ "${LAST_SEGMENT_COLOR}" -eq "${params[1]}" ]]; then + separator="$(set_color - ${LAST_SEGMENT_COLOR})${separator_char_soft}${normal}" + else + separator="$(set_color ${LAST_SEGMENT_COLOR} ${params[1]})${separator_char}${normal}" + fi fi LEFT_PROMPT+="${separator}$(set_color - ${params[1]}) ${params[0]} ${normal}" LAST_SEGMENT_COLOR=${params[1]} diff --git a/themes/powerline/powerline.theme.bash b/themes/powerline/powerline.theme.bash index 377e6f8e..bdf741cf 100644 --- a/themes/powerline/powerline.theme.bash +++ b/themes/powerline/powerline.theme.bash @@ -4,6 +4,7 @@ PROMPT_CHAR=${POWERLINE_PROMPT_CHAR:=""} POWERLINE_LEFT_SEPARATOR=${POWERLINE_LEFT_SEPARATOR:=""} +POWERLINE_LEFT_SEPARATOR_SOFT=${POWERLINE_LEFT_SEPARATOR_SOFT:=""} USER_INFO_SSH_CHAR=${POWERLINE_USER_INFO_SSH_CHAR:=" "} USER_INFO_THEME_PROMPT_COLOR=32 From 83abf624dd762e2b86e4d26109a881fba8d3ecb8 Mon Sep 17 00:00:00 2001 From: David Farrell Date: Fri, 1 Nov 2019 17:51:22 -0700 Subject: [PATCH 051/388] Updates README files for soft separators --- themes/powerline-multiline/README.md | 4 ++++ themes/powerline/README.md | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/themes/powerline-multiline/README.md b/themes/powerline-multiline/README.md index ee6095dd..a2e6d121 100644 --- a/themes/powerline-multiline/README.md +++ b/themes/powerline-multiline/README.md @@ -42,6 +42,10 @@ export THEME_CLOCK_FORMAT="%H:%M:%S" The time/date is printed by the `date` command, so refer to its man page to change the format. +### Soft Separators + +Adjacent segments having the same background color will use a less-pronouced (i.e. soft) separator between them. + ### Segment Order 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: diff --git a/themes/powerline/README.md b/themes/powerline/README.md index 974bcbeb..de399761 100644 --- a/themes/powerline/README.md +++ b/themes/powerline/README.md @@ -41,6 +41,10 @@ You can change the format using the following variable: The time/date is printed by the `date` command, so refer to its man page to change the format. +### Soft Separators + +Adjacent segments having the same background color will use a less-pronouced (i.e. soft) separator between them. + ### Segment Order The contents of the prompt can be "reordered", all the "segments" (every piece of information) can take any place. The currently available segments are: From 55ce8951410cb37c5ae02836daf03c7f5e69ffd1 Mon Sep 17 00:00:00 2001 From: David Farrell Date: Fri, 1 Nov 2019 23:16:39 -0700 Subject: [PATCH 052/388] Adds SHORT_USER/HOSTNAME support to powerline themes --- themes/powerline/powerline.base.bash | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/themes/powerline/powerline.base.bash b/themes/powerline/powerline.base.bash index 9e668a6c..e8b5ef37 100644 --- a/themes/powerline/powerline.base.bash +++ b/themes/powerline/powerline.base.bash @@ -30,10 +30,11 @@ function __powerline_user_info_prompt { fi ;; *) + local user=${SHORT_USER:-${USER}} if [[ -n "${SSH_CLIENT}" ]] || [[ -n "${SSH_CONNECTION}" ]]; then - user_info="${USER_INFO_SSH_CHAR}${USER}" + user_info="${USER_INFO_SSH_CHAR}${user}" else - user_info="${USER}" + user_info="${user}" fi ;; esac @@ -112,7 +113,7 @@ function __powerline_cwd_prompt { } function __powerline_hostname_prompt { - echo "$(hostname -s)|${HOST_THEME_PROMPT_COLOR}" + echo "${SHORT_HOSTNAME:-$(hostname -s)}|${HOST_THEME_PROMPT_COLOR}" } function __powerline_wd_prompt { From f0c1caa090ecd3614c5c83a7554fe8c6144ab294 Mon Sep 17 00:00:00 2001 From: Zanark Date: Mon, 4 Nov 2019 15:19:52 +0530 Subject: [PATCH 053/388] resolved powerline.base path issue --- themes/gitline/gitline.theme.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/gitline/gitline.theme.bash b/themes/gitline/gitline.theme.bash index 3e6be360..5debacb6 100644 --- a/themes/gitline/gitline.theme.bash +++ b/themes/gitline/gitline.theme.bash @@ -1,6 +1,6 @@ #!/usr/bin/env bash -. "$BASH_IT/themes/redline/powerline.base.bash" +. "$BASH_IT/themes/powerline/powerline.base.bash" #For the logo(Uncomment if you want a logo before your name) #PROMPT_DISTRO_LOGO="💻" From fcc3631a9a55cea9901d74b3725e26a39a2da532 Mon Sep 17 00:00:00 2001 From: Zanark Date: Mon, 4 Nov 2019 15:22:18 +0530 Subject: [PATCH 054/388] resolved powerline.base path issue --- themes/gitline/gitline.theme.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/gitline/gitline.theme.bash b/themes/gitline/gitline.theme.bash index 5debacb6..995b8c07 100644 --- a/themes/gitline/gitline.theme.bash +++ b/themes/gitline/gitline.theme.bash @@ -1,6 +1,6 @@ #!/usr/bin/env bash -. "$BASH_IT/themes/powerline/powerline.base.bash" +. "$BASH_IT/themes/gitline/powerline.base.bash" #For the logo(Uncomment if you want a logo before your name) #PROMPT_DISTRO_LOGO="💻" From 5a2dbd4780ddc22ece39bed05e90b9fb9c76dccd Mon Sep 17 00:00:00 2001 From: David Farrell Date: Wed, 6 Nov 2019 15:05:32 -0800 Subject: [PATCH 055/388] Fixes prompt bg color on powerline naked theme --- themes/powerline-naked/powerline-naked.base.bash | 1 + 1 file changed, 1 insertion(+) diff --git a/themes/powerline-naked/powerline-naked.base.bash b/themes/powerline-naked/powerline-naked.base.bash index f6b11f42..b97c93cf 100644 --- a/themes/powerline-naked/powerline-naked.base.bash +++ b/themes/powerline-naked/powerline-naked.base.bash @@ -11,5 +11,6 @@ function __powerline_left_segment { separator="${separator_char}" fi LEFT_PROMPT+="${separator}$(set_color ${params[1]} -) ${params[0]} ${normal}" + LAST_SEGMENT_COLOR=${params[1]} (( SEGMENTS_AT_LEFT += 1 )) } From 377f02714def7c259cdc8a24d4c08622b1c929dd Mon Sep 17 00:00:00 2001 From: cornfeedhobo Date: Wed, 20 Nov 2019 01:49:34 -0600 Subject: [PATCH 056/388] Simplify multiple path support in go plugin (#1284) * simplify wrapped pathmunge logic. update tests to account for cases with spaces in $PATH. --- plugins/available/go.plugin.bash | 24 ++++-------- test/plugins/go.plugin.bats | 65 ++++++++++++++++++-------------- 2 files changed, 44 insertions(+), 45 deletions(-) diff --git a/plugins/available/go.plugin.bash b/plugins/available/go.plugin.bash index 910194e5..566d7669 100755 --- a/plugins/available/go.plugin.bash +++ b/plugins/available/go.plugin.bash @@ -3,27 +3,17 @@ cite about-plugin about-plugin 'go environment variables & path configuration' -[ ! command -v go &>/dev/null ] && return +command -v go &>/dev/null || return -function _split_path_reverse() { - local a=( ${@//:/ } ) +function _go_pathmunge_wrap() { + IFS=':' local -a 'a=($1)' local i=${#a[@]} - local r= while [ $i -gt 0 ] ; do i=$(( i - 1 )) - if [ $(( i + 1 )) -eq ${#a[@]} ] ; then - r="${a[i]}" - else - r="${r} ${a[i]}" - fi + pathmunge "${a[i]}/bin" done - echo "$r" } -export GOROOT=${GOROOT:-$(go env GOROOT)} -pathmunge "${GOROOT}/bin" - -export GOPATH=${GOPATH:-$(go env GOPATH)} -for p in $( _split_path_reverse ${GOPATH} ) ; do - pathmunge "${p}/bin" -done +export GOROOT="${GOROOT:-$(go env GOROOT)}" +export GOPATH="${GOPATH:-$(go env GOPATH)}" +_go_pathmunge_wrap "${GOPATH}:${GOROOT}" diff --git a/test/plugins/go.plugin.bats b/test/plugins/go.plugin.bats index e2b27e02..02806205 100644 --- a/test/plugins/go.plugin.bats +++ b/test/plugins/go.plugin.bats @@ -1,44 +1,53 @@ #!/usr/bin/env bats -#load ../test_helper +load ../test_helper load ../../lib/helpers load ../../lib/composure -load ../../plugins/available/go.plugin -@test 'plugins go: reverse path: single entry' { - run _split_path_reverse '/foo' - echo "output = ${output}" - [ "$output" = "/foo" ] -} - -@test 'plugins go: reverse path: single entry, colon empty' { - run _split_path_reverse '/foo:' - echo "output = ${output}" - [ "$output" = "/foo" ] -} - -@test 'plugins go: reverse path: single entry, colon whitespace' { - run _split_path_reverse '/foo: ' - echo "output = ${output}" - [ "$output" = "/foo" ] -} - -@test 'plugins go: reverse path: multiple entries' { - run _split_path_reverse '/foo:/bar' - echo "output = ${output}" - [ "$output" = "/bar /foo" ] +@test 'ensure _go_pathmunge_wrap is defined' { + load ../../plugins/available/go.plugin + run type -t _go_pathmunge_wrap + assert_line 'function' } @test 'plugins go: single entry in GOPATH' { export GOPATH="/foo" + export GOROOT="/baz" load ../../plugins/available/go.plugin - echo "$(echo $PATH | cut -d':' -f1,2)" - [ "$(echo $PATH | cut -d':' -f1)" = "/foo/bin" ] + assert_equal "$(cut -d':' -f1,2 <<<$PATH)" "/foo/bin:/baz/bin" +} + +@test 'plugins go: single entry in GOPATH, with space' { + export GOPATH="/foo bar" + export GOROOT="/baz" + load ../../plugins/available/go.plugin + assert_equal "$(cut -d':' -f1,2 <<<$PATH)" "/foo bar/bin:/baz/bin" +} + +@test 'plugins go: single entry in GOPATH, with escaped space' { + export GOPATH="/foo\ bar" + export GOROOT="/baz" + load ../../plugins/available/go.plugin + assert_equal "$(cut -d':' -f1,2 <<<$PATH)" "/foo\ bar/bin:/baz/bin" } @test 'plugins go: multiple entries in GOPATH' { export GOPATH="/foo:/bar" + export GOROOT="/baz" load ../../plugins/available/go.plugin - echo "$(echo $PATH | cut -d':' -f1,2)" - [ "$(echo $PATH | cut -d':' -f1,2)" = "/foo/bin:/bar/bin" ] + assert_equal "$(cut -d':' -f1,2,3 <<<$PATH)" "/foo/bin:/bar/bin:/baz/bin" +} + +@test 'plugins go: multiple entries in GOPATH, with space' { + export GOPATH="/foo:/foo bar" + export GOROOT="/baz" + load ../../plugins/available/go.plugin + assert_equal "$(cut -d':' -f1,2,3 <<<$PATH)" "/foo/bin:/foo bar/bin:/baz/bin" +} + +@test 'plugins go: multiple entries in GOPATH, with escaped space' { + export GOPATH="/foo:/foo\ bar" + export GOROOT="/baz" + load ../../plugins/available/go.plugin + assert_equal "$(cut -d':' -f1,2,3 <<<$PATH)" "/foo/bin:/foo\ bar/bin:/baz/bin" } From 29bb382cc13c66378692b2fef30560457a4b7cf6 Mon Sep 17 00:00:00 2001 From: Gurkirat Singh Date: Wed, 27 Nov 2019 18:01:28 +0530 Subject: [PATCH 057/388] added man colors plugin --- plugins/available/man.plugin.bash | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 plugins/available/man.plugin.bash diff --git a/plugins/available/man.plugin.bash b/plugins/available/man.plugin.bash new file mode 100644 index 00000000..438779f0 --- /dev/null +++ b/plugins/available/man.plugin.bash @@ -0,0 +1,10 @@ +cite about-plugin +about-plugin 'colorize man pages for better readability' + +export LESS_TERMCAP_mb=$'\e[1;32m' +export LESS_TERMCAP_md=$'\e[1;32m' +export LESS_TERMCAP_me=$'\e[0m' +export LESS_TERMCAP_se=$'\e[0m' +export LESS_TERMCAP_so=$'\e[01;33m' +export LESS_TERMCAP_ue=$'\e[0m' +export LESS_TERMCAP_us=$'\e[1;4;31m' \ No newline at end of file From 00030bfed58660fd1161793274eca9b18e49e1b3 Mon Sep 17 00:00:00 2001 From: Gurkirat Singh Date: Wed, 27 Nov 2019 19:04:23 +0530 Subject: [PATCH 058/388] added laravel completions --- completion/available/laravel.completion.bash | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 completion/available/laravel.completion.bash diff --git a/completion/available/laravel.completion.bash b/completion/available/laravel.completion.bash new file mode 100644 index 00000000..bf24f67e --- /dev/null +++ b/completion/available/laravel.completion.bash @@ -0,0 +1,16 @@ +#!/usr/bin/bash + +if command -v laravel > /dev/null; then + __laravel_completion() { + local OPTS=("-h --help -q --quiet --ansi --no-ansi -n --no-interaction -v -vv -vvv --verbose help list new") + COMPREPLY=() + for _opt_ in ${OPTS[@]}; do + if [[ "$_opt_" == "$2"* ]]; then + COMPREPLY+=("$_opt_") + fi + done + } + + complete -F __laravel_completion laravel +fi + From a6e912854af3e10054173973837acccddde76504 Mon Sep 17 00:00:00 2001 From: Eduardo Bellido Bellido Date: Mon, 2 Dec 2019 08:36:57 +0100 Subject: [PATCH 059/388] Show NodeJS version in Powerline themes (#1438) Currently, only nvm is supported. --- themes/base.theme.bash | 16 ++++++++++++++++ themes/powerline-multiline/README.md | 1 + .../powerline-multiline.theme.bash | 7 ++++++- themes/powerline-naked/README.md | 1 + .../powerline-naked/powerline-naked.theme.bash | 7 ++++++- themes/powerline-plain/README.md | 1 + .../powerline-plain/powerline-plain.theme.bash | 9 +++++++-- themes/powerline/README.md | 1 + themes/powerline/powerline.base.bash | 7 +++++++ themes/powerline/powerline.theme.bash | 7 ++++++- 10 files changed, 52 insertions(+), 5 deletions(-) diff --git a/themes/base.theme.bash b/themes/base.theme.bash index 8d90f043..d193191e 100644 --- a/themes/base.theme.bash +++ b/themes/base.theme.bash @@ -62,6 +62,9 @@ SCM_SVN_CHAR='⑆' SCM_NONE='NONE' SCM_NONE_CHAR='○' +NVM_THEME_PROMPT_PREFIX=' |' +NVM_THEME_PROMPT_SUFFIX='|' + RVM_THEME_PROMPT_PREFIX=' |' RVM_THEME_PROMPT_SUFFIX='|' @@ -306,6 +309,19 @@ function hg_prompt_vars { fi } +function nvm_version_prompt { + local node + if declare -f -F nvm &> /dev/null; then + node=$(nvm current 2> /dev/null) + [[ "${node}" == "system" ]] && return + echo -e "${NVM_THEME_PROMPT_PREFIX}${node}${NVM_THEME_PROMPT_SUFFIX}" + fi +} + +function node_version_prompt { + echo -e "$(nvm_version_prompt)" +} + function rvm_version_prompt { if which rvm &> /dev/null; then rvm=$(rvm-prompt) || return diff --git a/themes/powerline-multiline/README.md b/themes/powerline-multiline/README.md index ee6095dd..965c593a 100644 --- a/themes/powerline-multiline/README.md +++ b/themes/powerline-multiline/README.md @@ -56,6 +56,7 @@ The contents of both prompt sides can be "reordered", all the "segments" (every * `python_venv` - Python virtual environment information (`virtualenv`, `venv` and `conda` supported) * `ruby` - Current ruby version if using `rvm` +* `node` - Current node version (only `nvm` is supported) * `scm` - Version control information, `git` * `user_info` - Current user * `wd` - Working directory, like `cwd` but doesn't show the full folder diff --git a/themes/powerline-multiline/powerline-multiline.theme.bash b/themes/powerline-multiline/powerline-multiline.theme.bash index ad64fb18..dcd1a51b 100644 --- a/themes/powerline-multiline/powerline-multiline.theme.bash +++ b/themes/powerline-multiline/powerline-multiline.theme.bash @@ -29,6 +29,11 @@ SCM_THEME_PROMPT_STAGED_COLOR=30 SCM_THEME_PROMPT_UNSTAGED_COLOR=92 SCM_THEME_PROMPT_COLOR=${SCM_THEME_PROMPT_CLEAN_COLOR} +NVM_THEME_PROMPT_PREFIX="" +NVM_THEME_PROMPT_SUFFIX="" +NODE_THEME_PROMPT_COLOR=22 +NODE_CHAR=${POWERLINE_NODE_CHAR:="❲n❳ "} + RVM_THEME_PROMPT_PREFIX="" RVM_THEME_PROMPT_SUFFIX="" RBENV_THEME_PROMPT_PREFIX="" @@ -57,7 +62,7 @@ IN_VIM_THEME_PROMPT_TEXT="vim" HOST_THEME_PROMPT_COLOR=0 -POWERLINE_LEFT_PROMPT=${POWERLINE_LEFT_PROMPT:="scm python_venv ruby cwd"} +POWERLINE_LEFT_PROMPT=${POWERLINE_LEFT_PROMPT:="scm python_venv ruby node cwd"} POWERLINE_RIGHT_PROMPT=${POWERLINE_RIGHT_PROMPT:="in_vim clock battery user_info"} safe_append_prompt_command __powerline_prompt_command diff --git a/themes/powerline-naked/README.md b/themes/powerline-naked/README.md index da5e254b..1f16c296 100644 --- a/themes/powerline-naked/README.md +++ b/themes/powerline-naked/README.md @@ -54,6 +54,7 @@ The contents of the prompt can be "reordered", all the "segments" (every piece o * `python_venv` - Python virtual environment information (`virtualenv`, `venv` and `conda` supported) * `ruby` - Current ruby version if using `rvm` +* `node` - Current node version (only `nvm` is supported) * `scm` - Version control information, `git` * `user_info` - Current user * `wd` - Working directory, like `cwd` but doesn't show the full folder diff --git a/themes/powerline-naked/powerline-naked.theme.bash b/themes/powerline-naked/powerline-naked.theme.bash index 81025c84..6b8859bd 100644 --- a/themes/powerline-naked/powerline-naked.theme.bash +++ b/themes/powerline-naked/powerline-naked.theme.bash @@ -26,6 +26,11 @@ SCM_THEME_PROMPT_STAGED_COLOR=30 SCM_THEME_PROMPT_UNSTAGED_COLOR=92 SCM_THEME_PROMPT_COLOR=${SCM_THEME_PROMPT_CLEAN_COLOR} +NVM_THEME_PROMPT_PREFIX="" +NVM_THEME_PROMPT_SUFFIX="" +NODE_CHAR=${POWERLINE_NODE_CHAR:="❲n❳ "} +NODE_THEME_PROMPT_COLOR=22 + RVM_THEME_PROMPT_PREFIX="" RVM_THEME_PROMPT_SUFFIX="" RBENV_THEME_PROMPT_PREFIX="" @@ -57,6 +62,6 @@ IN_VIM_THEME_PROMPT_TEXT="vim" HOST_THEME_PROMPT_COLOR=254 -POWERLINE_PROMPT=${POWERLINE_PROMPT:="user_info scm python_venv ruby cwd"} +POWERLINE_PROMPT=${POWERLINE_PROMPT:="user_info scm python_venv ruby node cwd"} safe_append_prompt_command __powerline_prompt_command diff --git a/themes/powerline-plain/README.md b/themes/powerline-plain/README.md index 701b9fa1..6ea21a18 100644 --- a/themes/powerline-plain/README.md +++ b/themes/powerline-plain/README.md @@ -52,6 +52,7 @@ The contents of the prompt can be "reordered", all the "segments" (every piece o * `python_venv` - Python virtual environment information (`virtualenv`, `venv` and `conda` supported) * `ruby` - Current ruby version if using `rvm` +* `node` - Current node version (only `nvm` is supported) * `scm` - Version control information, `git` * `user_info` - Current user * `wd` - Working directory, like `cwd` but doesn't show the full folder diff --git a/themes/powerline-plain/powerline-plain.theme.bash b/themes/powerline-plain/powerline-plain.theme.bash index f9538c2a..c3ce1817 100644 --- a/themes/powerline-plain/powerline-plain.theme.bash +++ b/themes/powerline-plain/powerline-plain.theme.bash @@ -21,6 +21,11 @@ SCM_THEME_PROMPT_STAGED_COLOR=30 SCM_THEME_PROMPT_UNSTAGED_COLOR=92 SCM_THEME_PROMPT_COLOR=${SCM_THEME_PROMPT_CLEAN_COLOR} +NVM_THEME_PROMPT_PREFIX="" +NVM_THEME_PROMPT_SUFFIX="" +NODE_CHAR=${POWERLINE_NODE_CHAR:="❲n❳ "} +NODE_THEME_PROMPT_COLOR=22 + RVM_THEME_PROMPT_PREFIX="" RVM_THEME_PROMPT_SUFFIX="" RBENV_THEME_PROMPT_PREFIX="" @@ -52,6 +57,6 @@ IN_VIM_THEME_PROMPT_TEXT="vim" HOST_THEME_PROMPT_COLOR=0 -POWERLINE_PROMPT=${POWERLINE_PROMPT:="user_info scm python_venv ruby cwd"} +POWERLINE_PROMPT=${POWERLINE_PROMPT:="user_info scm python_venv ruby node cwd"} -safe_append_prompt_command __powerline_prompt_command \ No newline at end of file +safe_append_prompt_command __powerline_prompt_command diff --git a/themes/powerline/README.md b/themes/powerline/README.md index 974bcbeb..acb51d9f 100644 --- a/themes/powerline/README.md +++ b/themes/powerline/README.md @@ -56,6 +56,7 @@ The contents of the prompt can be "reordered", all the "segments" (every piece o * `python_venv` - Python virtual environment information (`virtualenv`, `venv` and `conda` supported) * `ruby` - Current ruby version if using `rvm` +* `node` - Current node version (only `nvm` is supported) * `scm` - Version control information, `git` * `user_info` - Current user * `wd` - Working directory, like `cwd` but doesn't show the full folder diff --git a/themes/powerline/powerline.base.bash b/themes/powerline/powerline.base.bash index 9e668a6c..5fe6614d 100644 --- a/themes/powerline/powerline.base.bash +++ b/themes/powerline/powerline.base.bash @@ -40,6 +40,13 @@ function __powerline_user_info_prompt { [[ -n "${user_info}" ]] && echo "${user_info}|${color}" } +function __powerline_node_prompt { + local node_version="" + + node_version="$(node_version_prompt)" + [[ -n "${node_version}" ]] && echo "${NODE_CHAR}${node_version}|${NODE_THEME_PROMPT_COLOR}" +} + function __powerline_ruby_prompt { local ruby_version="" diff --git a/themes/powerline/powerline.theme.bash b/themes/powerline/powerline.theme.bash index 377e6f8e..bff8a6ca 100644 --- a/themes/powerline/powerline.theme.bash +++ b/themes/powerline/powerline.theme.bash @@ -24,6 +24,11 @@ SCM_THEME_PROMPT_STAGED_COLOR=30 SCM_THEME_PROMPT_UNSTAGED_COLOR=92 SCM_THEME_PROMPT_COLOR=${SCM_THEME_PROMPT_CLEAN_COLOR} +NVM_THEME_PROMPT_PREFIX="" +NVM_THEME_PROMPT_SUFFIX="" +NODE_CHAR=${POWERLINE_NODE_CHAR:="❲n❳ "} +NODE_THEME_PROMPT_COLOR=22 + RVM_THEME_PROMPT_PREFIX="" RVM_THEME_PROMPT_SUFFIX="" RBENV_THEME_PROMPT_PREFIX="" @@ -55,7 +60,7 @@ IN_VIM_THEME_PROMPT_TEXT="vim" HOST_THEME_PROMPT_COLOR=0 -POWERLINE_PROMPT=${POWERLINE_PROMPT:="user_info scm python_venv ruby cwd"} +POWERLINE_PROMPT=${POWERLINE_PROMPT:="user_info scm python_venv ruby node cwd"} HISTORY_AUTOSAVE=${HISTORY_AUTOSAVE:-0} From 7460ee0496919926bd80d681dc143435ec71202d Mon Sep 17 00:00:00 2001 From: Youssef El Saadany Date: Fri, 6 Dec 2019 15:06:13 +0100 Subject: [PATCH 060/388] New Vi-mode theme --- themes/ramses/ramses.theme.bash | 109 ++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 themes/ramses/ramses.theme.bash diff --git a/themes/ramses/ramses.theme.bash b/themes/ramses/ramses.theme.bash new file mode 100644 index 00000000..37fd00f1 --- /dev/null +++ b/themes/ramses/ramses.theme.bash @@ -0,0 +1,109 @@ +SCM_THEME_PROMPT_PREFIX="" +SCM_THEME_PROMPT_SUFFIX="" + +SCM_THEME_PROMPT_DIRTY=" ${bold_red}✗${normal}" +SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓${normal}" +SCM_GIT_CHAR="${bold_green}±${normal}" +SCM_SVN_CHAR="${bold_cyan}⑆${normal}" +SCM_HG_CHAR="${bold_red}☿${normal}" + +#Mysql Prompt +export MYSQL_PS1="(\u@\h) [\d]> " + +case $TERM in + xterm*) + TITLEBAR="\[\033]0;\w\007\]" + ;; + *) + TITLEBAR="" + ;; +esac + +PS3=">> " + +__my_rvm_ruby_version() { + local gemset=$(echo $GEM_HOME | awk -F'@' '{print $2}') + [ "$gemset" != "" ] && gemset="@$gemset" + local version=$(echo $MY_RUBY_HOME | awk -F'-' '{print $2}') + local full="$version$gemset" + [ "$full" != "" ] && echo "[$full]" +} + +is_vim_shell() { + if [ ! -z "$VIMRUNTIME" ] + then + echo "[${cyan}vim shell${normal}]" + fi +} + +modern_scm_prompt() { + CHAR=$(scm_char) + if [ $CHAR = $SCM_NONE_CHAR ] + then + return + else + echo "[$(scm_char)][$(scm_prompt_info)]" + fi +} + +# show chroot if exist +chroot(){ + if [ -n "$debian_chroot" ] + then + my_ps_chroot="${bold_cyan}$debian_chroot${normal}"; + echo "($my_ps_chroot)"; + fi + } + +# show virtualenvwrapper +my_ve(){ + + 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)"; + fi + echo ""; + } + +prompt() { + + my_ps_host="${green}\h${normal}"; + # yes, these are the the same for now ... + my_ps_host_root="${green}\h${normal}"; + + my_ps_user="${bold_green}\u${normal}" + my_ps_root="${bold_red}\u${normal}"; + + if [ -n "$VIRTUAL_ENV" ] + then + ve=`basename $VIRTUAL_ENV`; + fi + + # nice prompt + case "`id -u`" in + 0) PS1="${TITLEBAR}┌─$(my_ve)$(chroot)[$my_ps_root][$my_ps_host_root]$(modern_scm_prompt)$(__my_rvm_ruby_version)[${cyan}\w${normal}] +▪ " + ;; + *) PS1="${TITLEBAR}┌─$(my_ve)$(chroot)[$my_ps_user][$my_ps_host]$(modern_scm_prompt)$(__my_rvm_ruby_version) +|─[${bold_purple}\w${normal}] +▪ " + ;; + esac +} + +PS2="▪ " + +# vi mode +set -o vi +bind 'set vi-ins-mode-string "└+"' +bind 'set vi-cmd-mode-string "└─"' +bind 'set show-mode-in-prompt on' +bind '"jj":vi-movement-mode' +VIMRUNTIME='true' + +safe_append_prompt_command prompt From db2c6683f13a02716cd0f068e6726f414ce58ca4 Mon Sep 17 00:00:00 2001 From: David Farrell Date: Sun, 3 Nov 2019 22:56:40 -0800 Subject: [PATCH 061/388] Makes all powerline vars configurable Makes all powerline vars configurable Makes all powerline vars configurable Makes all powerline vars configurable --- .../powerline-multiline.theme.bash | 42 +++++++++--------- .../powerline-naked.theme.bash | 44 +++++++++---------- .../powerline-plain.theme.bash | 40 ++++++++--------- themes/powerline/powerline.theme.bash | 42 +++++++++--------- 4 files changed, 83 insertions(+), 85 deletions(-) diff --git a/themes/powerline-multiline/powerline-multiline.theme.bash b/themes/powerline-multiline/powerline-multiline.theme.bash index dcd1a51b..d80628bb 100644 --- a/themes/powerline-multiline/powerline-multiline.theme.bash +++ b/themes/powerline-multiline/powerline-multiline.theme.bash @@ -1,6 +1,5 @@ #!/usr/bin/env bash - . "$BASH_IT/themes/powerline-multiline/powerline-multiline.base.bash" PROMPT_CHAR=${POWERLINE_PROMPT_CHAR:="❯"} @@ -11,22 +10,22 @@ POWERLINE_RIGHT_END=${POWERLINE_RIGHT_END:=""} POWERLINE_PADDING=${POWERLINE_PADDING:=2} USER_INFO_SSH_CHAR=${POWERLINE_USER_INFO_SSH_CHAR:=" "} -USER_INFO_THEME_PROMPT_COLOR=32 -USER_INFO_THEME_PROMPT_COLOR_SUDO=202 +USER_INFO_THEME_PROMPT_COLOR=${POWERLINE_USER_INFO_COLOR:=32} +USER_INFO_THEME_PROMPT_COLOR_SUDO=${POWERLINE_USER_INFO_COLOR_SUDO:=202} PYTHON_VENV_CHAR=${POWERLINE_PYTHON_VENV_CHAR:="❲p❳ "} CONDA_PYTHON_VENV_CHAR=${POWERLINE_CONDA_PYTHON_VENV_CHAR:="❲c❳ "} -PYTHON_VENV_THEME_PROMPT_COLOR=35 +PYTHON_VENV_THEME_PROMPT_COLOR=${POWERLINE_PYTHON_VENV_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 -SCM_THEME_PROMPT_DIRTY_COLOR=88 -SCM_THEME_PROMPT_STAGED_COLOR=30 -SCM_THEME_PROMPT_UNSTAGED_COLOR=92 +SCM_THEME_PROMPT_CLEAN_COLOR=${POWERLINE_SCM_CLEAN_COLOR:=25} +SCM_THEME_PROMPT_DIRTY_COLOR=${POWERLINE_SCM_DIRTY_COLOR:=88} +SCM_THEME_PROMPT_STAGED_COLOR=${POWERLINE_SCM_STAGED_COLOR:=30} +SCM_THEME_PROMPT_UNSTAGED_COLOR=${POWERLINE_SCM_UNSTAGED_COLOR:=92} SCM_THEME_PROMPT_COLOR=${SCM_THEME_PROMPT_CLEAN_COLOR} NVM_THEME_PROMPT_PREFIX="" @@ -38,29 +37,32 @@ RVM_THEME_PROMPT_PREFIX="" RVM_THEME_PROMPT_SUFFIX="" RBENV_THEME_PROMPT_PREFIX="" RBENV_THEME_PROMPT_SUFFIX="" -RUBY_THEME_PROMPT_COLOR=161 +RUBY_THEME_PROMPT_COLOR=${POWERLINE_RUBY_COLOR:=161} RUBY_CHAR=${POWERLINE_RUBY_CHAR:="❲r❳ "} -AWS_PROFILE_CHAR="${POWERLINE_AWS_PROFILE_CHAR:=❲aws❳ }" -AWS_PROFILE_PROMPT_COLOR=208 +KUBERNETES_CONTEXT_THEME_CHAR=${POWERLINE_KUBERNETES_CONTEXT_CHAR:="⎈ "} +KUBERNETES_CONTEXT_THEME_PROMPT_COLOR=${POWERLINE_KUBERNETES_CONTEXT_COLOR:=26} -CWD_THEME_PROMPT_COLOR=240 +AWS_PROFILE_CHAR=${POWERLINE_AWS_PROFILE_CHAR:="❲aws❳ "} +AWS_PROFILE_PROMPT_COLOR=${POWERLINE_AWS_PROFILE_COLOR:=208} -LAST_STATUS_THEME_PROMPT_COLOR=196 +CWD_THEME_PROMPT_COLOR=${POWERLINE_CWD_COLOR:=240} -CLOCK_THEME_PROMPT_COLOR=240 +LAST_STATUS_THEME_PROMPT_COLOR=${POWERLINE_LAST_STATUS_COLOR:=196} + +CLOCK_THEME_PROMPT_COLOR=${POWERLINE_CLOCK_COLOR:=240} BATTERY_AC_CHAR=${BATTERY_AC_CHAR:="⚡"} -BATTERY_STATUS_THEME_PROMPT_GOOD_COLOR=70 -BATTERY_STATUS_THEME_PROMPT_LOW_COLOR=208 -BATTERY_STATUS_THEME_PROMPT_CRITICAL_COLOR=160 +BATTERY_STATUS_THEME_PROMPT_GOOD_COLOR=${POWERLINE_BATTERY_GOOD_COLOR:=70} +BATTERY_STATUS_THEME_PROMPT_LOW_COLOR=${POWERLINE_BATTERY_LOW_COLOR:=208} +BATTERY_STATUS_THEME_PROMPT_CRITICAL_COLOR=${POWERLINE_BATTERY_CRITICAL_COLOR:=160} THEME_CLOCK_FORMAT=${THEME_CLOCK_FORMAT:="%H:%M:%S"} -IN_VIM_THEME_PROMPT_COLOR=245 -IN_VIM_THEME_PROMPT_TEXT="vim" +IN_VIM_THEME_PROMPT_COLOR=${POWERLINE_IN_VIM_COLOR:=245} +IN_VIM_THEME_PROMPT_TEXT=${POWERLINE_IN_VIM_TEXT:="vim"} -HOST_THEME_PROMPT_COLOR=0 +HOST_THEME_PROMPT_COLOR=${POWERLINE_HOST_COLOR:=0} POWERLINE_LEFT_PROMPT=${POWERLINE_LEFT_PROMPT:="scm python_venv ruby node cwd"} POWERLINE_RIGHT_PROMPT=${POWERLINE_RIGHT_PROMPT:="in_vim clock battery user_info"} diff --git a/themes/powerline-naked/powerline-naked.theme.bash b/themes/powerline-naked/powerline-naked.theme.bash index 6b8859bd..c20f8c43 100644 --- a/themes/powerline-naked/powerline-naked.theme.bash +++ b/themes/powerline-naked/powerline-naked.theme.bash @@ -1,29 +1,27 @@ #!/usr/bin/env bash -POWERLINE_LEFT_SEPARATOR=${POWERLINE_LEFT_SEPARATOR:=""} - . "$BASH_IT/themes/powerline-naked/powerline-naked.base.bash" PROMPT_CHAR=${POWERLINE_PROMPT_CHAR:=""} +POWERLINE_LEFT_SEPARATOR=${POWERLINE_LEFT_SEPARATOR:=""} USER_INFO_SSH_CHAR=${POWERLINE_USER_INFO_SSH_CHAR:=" "} -USER_INFO_THEME_PROMPT_COLOR=240 -USER_INFO_THEME_PROMPT_COLOR_SUDO=202 +USER_INFO_THEME_PROMPT_COLOR=${POWERLINE_USER_INFO_COLOR:=240} +USER_INFO_THEME_PROMPT_COLOR_SUDO=${POWERLINE_USER_INFO_COLOR_SUDO:=202} PYTHON_VENV_CHAR=${POWERLINE_PYTHON_VENV_CHAR:="❲p❳ "} CONDA_PYTHON_VENV_CHAR=${POWERLINE_CONDA_PYTHON_VENV_CHAR:="❲c❳ "} -PYTHON_VENV_THEME_PROMPT_COLOR=35 +PYTHON_VENV_THEME_PROMPT_COLOR=${POWERLINE_PYTHON_VENV_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 -SCM_THEME_PROMPT_CLEAN_COLOR=25 -SCM_THEME_PROMPT_DIRTY_COLOR=88 -SCM_THEME_PROMPT_STAGED_COLOR=30 -SCM_THEME_PROMPT_UNSTAGED_COLOR=92 +SCM_THEME_PROMPT_CLEAN_COLOR=${POWERLINE_SCM_CLEAN_COLOR:=25} +SCM_THEME_PROMPT_DIRTY_COLOR=${POWERLINE_SCM_DIRTY_COLOR:=88} +SCM_THEME_PROMPT_STAGED_COLOR=${POWERLINE_SCM_STAGED_COLOR:=30} +SCM_THEME_PROMPT_UNSTAGED_COLOR=${POWERLINE_SCM_UNSTAGED_COLOR:=92} SCM_THEME_PROMPT_COLOR=${SCM_THEME_PROMPT_CLEAN_COLOR} NVM_THEME_PROMPT_PREFIX="" @@ -35,32 +33,32 @@ RVM_THEME_PROMPT_PREFIX="" RVM_THEME_PROMPT_SUFFIX="" RBENV_THEME_PROMPT_PREFIX="" RBENV_THEME_PROMPT_SUFFIX="" -RUBY_THEME_PROMPT_COLOR=161 +RUBY_THEME_PROMPT_COLOR=${POWERLINE_RUBY_COLOR:=161} RUBY_CHAR=${POWERLINE_RUBY_CHAR:="❲r❳ "} KUBERNETES_CONTEXT_THEME_CHAR=${POWERLINE_KUBERNETES_CONTEXT_CHAR:="⎈ "} -KUBERNETES_CONTEXT_THEME_PROMPT_COLOR=26 +KUBERNETES_CONTEXT_THEME_PROMPT_COLOR=${POWERLINE_KUBERNETES_CONTEXT_COLOR:=26} -AWS_PROFILE_CHAR="${POWERLINE_AWS_PROFILE_CHAR:=❲aws❳ }" -AWS_PROFILE_PROMPT_COLOR=208 +AWS_PROFILE_CHAR=${POWERLINE_AWS_PROFILE_CHAR:="❲aws❳ "} +AWS_PROFILE_PROMPT_COLOR=${POWERLINE_AWS_PROFILE_COLOR:=208} -CWD_THEME_PROMPT_COLOR=254 +CWD_THEME_PROMPT_COLOR=${POWERLINE_CWD_COLOR:=254} -LAST_STATUS_THEME_PROMPT_COLOR=124 +LAST_STATUS_THEME_PROMPT_COLOR=${POWERLINE_LAST_STATUS_COLOR:=124} -CLOCK_THEME_PROMPT_COLOR=240 +CLOCK_THEME_PROMPT_COLOR=${POWERLINE_CLOCK_COLOR:=240} BATTERY_AC_CHAR=${BATTERY_AC_CHAR:="⚡"} -BATTERY_STATUS_THEME_PROMPT_GOOD_COLOR=70 -BATTERY_STATUS_THEME_PROMPT_LOW_COLOR=208 -BATTERY_STATUS_THEME_PROMPT_CRITICAL_COLOR=160 +BATTERY_STATUS_THEME_PROMPT_GOOD_COLOR=${POWERLINE_BATTERY_GOOD_COLOR:=70} +BATTERY_STATUS_THEME_PROMPT_LOW_COLOR=${POWERLINE_BATTERY_LOW_COLOR:=208} +BATTERY_STATUS_THEME_PROMPT_CRITICAL_COLOR=${POWERLINE_BATTERY_CRITICAL_COLOR:=160} THEME_CLOCK_FORMAT=${THEME_CLOCK_FORMAT:="%H:%M:%S"} -IN_VIM_THEME_PROMPT_COLOR=245 -IN_VIM_THEME_PROMPT_TEXT="vim" +IN_VIM_THEME_PROMPT_COLOR=${POWERLINE_IN_VIM_COLOR:=245} +IN_VIM_THEME_PROMPT_TEXT=${POWERLINE_IN_VIM_TEXT:="vim"} -HOST_THEME_PROMPT_COLOR=254 +HOST_THEME_PROMPT_COLOR=${POWERLINE_HOST_COLOR:=254} POWERLINE_PROMPT=${POWERLINE_PROMPT:="user_info scm python_venv ruby node cwd"} diff --git a/themes/powerline-plain/powerline-plain.theme.bash b/themes/powerline-plain/powerline-plain.theme.bash index c3ce1817..cf1a163f 100644 --- a/themes/powerline-plain/powerline-plain.theme.bash +++ b/themes/powerline-plain/powerline-plain.theme.bash @@ -3,22 +3,22 @@ . "$BASH_IT/themes/powerline-plain/powerline-plain.base.bash" USER_INFO_SSH_CHAR=${POWERLINE_USER_INFO_SSH_CHAR:="⌁ "} -USER_INFO_THEME_PROMPT_COLOR=32 -USER_INFO_THEME_PROMPT_COLOR_SUDO=202 +USER_INFO_THEME_PROMPT_COLOR=${POWERLINE_USER_INFO_COLOR:=32} +USER_INFO_THEME_PROMPT_COLOR_SUDO=${POWERLINE_USER_INFO_COLOR_SUDO:=202} PYTHON_VENV_CHAR=${POWERLINE_PYTHON_VENV_CHAR:="ⓔ "} CONDA_PYTHON_VENV_CHAR=${POWERLINE_CONDA_PYTHON_VENV_CHAR:="ⓔ "} -PYTHON_VENV_THEME_PROMPT_COLOR=35 +PYTHON_VENV_THEME_PROMPT_COLOR=${POWERLINE_PYTHON_VENV_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 -SCM_THEME_PROMPT_DIRTY_COLOR=88 -SCM_THEME_PROMPT_STAGED_COLOR=30 -SCM_THEME_PROMPT_UNSTAGED_COLOR=92 +SCM_THEME_PROMPT_CLEAN_COLOR=${POWERLINE_SCM_CLEAN_COLOR:=25} +SCM_THEME_PROMPT_DIRTY_COLOR=${POWERLINE_SCM_DIRTY_COLOR:=88} +SCM_THEME_PROMPT_STAGED_COLOR=${POWERLINE_SCM_STAGED_COLOR:=30} +SCM_THEME_PROMPT_UNSTAGED_COLOR=${POWERLINE_SCM_UNSTAGED_COLOR:=92} SCM_THEME_PROMPT_COLOR=${SCM_THEME_PROMPT_CLEAN_COLOR} NVM_THEME_PROMPT_PREFIX="" @@ -30,32 +30,32 @@ RVM_THEME_PROMPT_PREFIX="" RVM_THEME_PROMPT_SUFFIX="" RBENV_THEME_PROMPT_PREFIX="" RBENV_THEME_PROMPT_SUFFIX="" -RUBY_THEME_PROMPT_COLOR=161 +RUBY_THEME_PROMPT_COLOR=${POWERLINE_RUBY_COLOR:=161} RUBY_CHAR=${POWERLINE_RUBY_CHAR:="💎 "} KUBERNETES_CONTEXT_THEME_CHAR=${POWERLINE_KUBERNETES_CONTEXT_CHAR:="⎈ "} -KUBERNETES_CONTEXT_THEME_PROMPT_COLOR=26 +KUBERNETES_CONTEXT_THEME_PROMPT_COLOR=${POWERLINE_KUBERNETES_CONTEXT_COLOR:=26} -AWS_PROFILE_CHAR="${POWERLINE_AWS_PROFILE_CHAR:=❲aws❳ }" -AWS_PROFILE_PROMPT_COLOR=208 +AWS_PROFILE_CHAR=${POWERLINE_AWS_PROFILE_CHAR:="❲aws❳ "} +AWS_PROFILE_PROMPT_COLOR=${POWERLINE_AWS_PROFILE_COLOR:=208} -CWD_THEME_PROMPT_COLOR=240 +CWD_THEME_PROMPT_COLOR=${POWERLINE_CWD_COLOR:=240} -LAST_STATUS_THEME_PROMPT_COLOR=52 +LAST_STATUS_THEME_PROMPT_COLOR=${POWERLINE_LAST_STATUS_COLOR:=52} -CLOCK_THEME_PROMPT_COLOR=240 +CLOCK_THEME_PROMPT_COLOR=${POWERLINE_CLOCK_COLOR:=240} BATTERY_AC_CHAR=${BATTERY_AC_CHAR:="+ "} -BATTERY_STATUS_THEME_PROMPT_GOOD_COLOR=70 -BATTERY_STATUS_THEME_PROMPT_LOW_COLOR=208 -BATTERY_STATUS_THEME_PROMPT_CRITICAL_COLOR=160 +BATTERY_STATUS_THEME_PROMPT_GOOD_COLOR=${POWERLINE_BATTERY_GOOD_COLOR:=70} +BATTERY_STATUS_THEME_PROMPT_LOW_COLOR=${POWERLINE_BATTERY_LOW_COLOR:=208} +BATTERY_STATUS_THEME_PROMPT_CRITICAL_COLOR=${POWERLINE_BATTERY_CRITICAL_COLOR:=160} THEME_CLOCK_FORMAT=${THEME_CLOCK_FORMAT:="%H:%M:%S"} -IN_VIM_THEME_PROMPT_COLOR=245 -IN_VIM_THEME_PROMPT_TEXT="vim" +IN_VIM_THEME_PROMPT_COLOR=${POWERLINE_IN_VIM_COLOR:=245} +IN_VIM_THEME_PROMPT_TEXT=${POWERLINE_IN_VIM_TEXT:="vim"} -HOST_THEME_PROMPT_COLOR=0 +HOST_THEME_PROMPT_COLOR=${POWERLINE_HOST_COLOR:=0} POWERLINE_PROMPT=${POWERLINE_PROMPT:="user_info scm python_venv ruby node cwd"} diff --git a/themes/powerline/powerline.theme.bash b/themes/powerline/powerline.theme.bash index bff8a6ca..ace88ebe 100644 --- a/themes/powerline/powerline.theme.bash +++ b/themes/powerline/powerline.theme.bash @@ -6,22 +6,22 @@ PROMPT_CHAR=${POWERLINE_PROMPT_CHAR:=""} POWERLINE_LEFT_SEPARATOR=${POWERLINE_LEFT_SEPARATOR:=""} USER_INFO_SSH_CHAR=${POWERLINE_USER_INFO_SSH_CHAR:=" "} -USER_INFO_THEME_PROMPT_COLOR=32 -USER_INFO_THEME_PROMPT_COLOR_SUDO=202 +USER_INFO_THEME_PROMPT_COLOR=${POWERLINE_USER_INFO_COLOR:=32} +USER_INFO_THEME_PROMPT_COLOR_SUDO=${POWERLINE_USER_INFO_COLOR_SUDO:=202} PYTHON_VENV_CHAR=${POWERLINE_PYTHON_VENV_CHAR:="❲p❳ "} CONDA_PYTHON_VENV_CHAR=${POWERLINE_CONDA_PYTHON_VENV_CHAR:="❲c❳ "} -PYTHON_VENV_THEME_PROMPT_COLOR=35 +PYTHON_VENV_THEME_PROMPT_COLOR=${POWERLINE_PYTHON_VENV_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 -SCM_THEME_PROMPT_DIRTY_COLOR=88 -SCM_THEME_PROMPT_STAGED_COLOR=30 -SCM_THEME_PROMPT_UNSTAGED_COLOR=92 +SCM_THEME_PROMPT_CLEAN_COLOR=${POWERLINE_SCM_CLEAN_COLOR:=25} +SCM_THEME_PROMPT_DIRTY_COLOR=${POWERLINE_SCM_DIRTY_COLOR:=88} +SCM_THEME_PROMPT_STAGED_COLOR=${POWERLINE_SCM_STAGED_COLOR:=30} +SCM_THEME_PROMPT_UNSTAGED_COLOR=${POWERLINE_SCM_UNSTAGED_COLOR:=92} SCM_THEME_PROMPT_COLOR=${SCM_THEME_PROMPT_CLEAN_COLOR} NVM_THEME_PROMPT_PREFIX="" @@ -33,35 +33,33 @@ RVM_THEME_PROMPT_PREFIX="" RVM_THEME_PROMPT_SUFFIX="" RBENV_THEME_PROMPT_PREFIX="" RBENV_THEME_PROMPT_SUFFIX="" -RUBY_THEME_PROMPT_COLOR=161 +RUBY_THEME_PROMPT_COLOR=${POWERLINE_RUBY_COLOR:=161} RUBY_CHAR=${POWERLINE_RUBY_CHAR:="❲r❳ "} KUBERNETES_CONTEXT_THEME_CHAR=${POWERLINE_KUBERNETES_CONTEXT_CHAR:="⎈ "} -KUBERNETES_CONTEXT_THEME_PROMPT_COLOR=26 +KUBERNETES_CONTEXT_THEME_PROMPT_COLOR=${POWERLINE_KUBERNETES_CONTEXT_COLOR:=26} -AWS_PROFILE_CHAR="${POWERLINE_AWS_PROFILE_CHAR:=❲aws❳ }" -AWS_PROFILE_PROMPT_COLOR=208 +AWS_PROFILE_CHAR=${POWERLINE_AWS_PROFILE_CHAR:="❲aws❳ "} +AWS_PROFILE_PROMPT_COLOR=${POWERLINE_AWS_PROFILE_COLOR:=208} -CWD_THEME_PROMPT_COLOR=240 +CWD_THEME_PROMPT_COLOR=${POWERLINE_CWD_COLOR:=240} -LAST_STATUS_THEME_PROMPT_COLOR=52 +LAST_STATUS_THEME_PROMPT_COLOR=${POWERLINE_LAST_STATUS_COLOR:=52} -CLOCK_THEME_PROMPT_COLOR=240 +CLOCK_THEME_PROMPT_COLOR=${POWERLINE_CLOCK_COLOR:=240} BATTERY_AC_CHAR=${BATTERY_AC_CHAR:="⚡"} -BATTERY_STATUS_THEME_PROMPT_GOOD_COLOR=70 -BATTERY_STATUS_THEME_PROMPT_LOW_COLOR=208 -BATTERY_STATUS_THEME_PROMPT_CRITICAL_COLOR=160 +BATTERY_STATUS_THEME_PROMPT_GOOD_COLOR=${POWERLINE_BATTERY_GOOD_COLOR:=70} +BATTERY_STATUS_THEME_PROMPT_LOW_COLOR=${POWERLINE_BATTERY_LOW_COLOR:=208} +BATTERY_STATUS_THEME_PROMPT_CRITICAL_COLOR=${POWERLINE_BATTERY_CRITICAL_COLOR:=160} THEME_CLOCK_FORMAT=${THEME_CLOCK_FORMAT:="%H:%M:%S"} -IN_VIM_THEME_PROMPT_COLOR=245 -IN_VIM_THEME_PROMPT_TEXT="vim" +IN_VIM_THEME_PROMPT_COLOR=${POWERLINE_IN_VIM_COLOR:=245} +IN_VIM_THEME_PROMPT_TEXT=${POWERLINE_IN_VIM_TEXT:="vim"} -HOST_THEME_PROMPT_COLOR=0 +HOST_THEME_PROMPT_COLOR=${POWERLINE_HOST_COLOR:=0} POWERLINE_PROMPT=${POWERLINE_PROMPT:="user_info scm python_venv ruby node cwd"} -HISTORY_AUTOSAVE=${HISTORY_AUTOSAVE:-0} - safe_append_prompt_command __powerline_prompt_command From 921cfea68d2deb4db039119e2684dbc46a9ae67c Mon Sep 17 00:00:00 2001 From: David Farrell Date: Wed, 18 Dec 2019 19:32:49 -0800 Subject: [PATCH 062/388] Makes NODE vars configurable --- themes/powerline-multiline/powerline-multiline.theme.bash | 2 +- themes/powerline-naked/powerline-naked.theme.bash | 2 +- themes/powerline-plain/powerline-plain.theme.bash | 2 +- themes/powerline/powerline.theme.bash | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/themes/powerline-multiline/powerline-multiline.theme.bash b/themes/powerline-multiline/powerline-multiline.theme.bash index d80628bb..e90b494e 100644 --- a/themes/powerline-multiline/powerline-multiline.theme.bash +++ b/themes/powerline-multiline/powerline-multiline.theme.bash @@ -30,8 +30,8 @@ SCM_THEME_PROMPT_COLOR=${SCM_THEME_PROMPT_CLEAN_COLOR} NVM_THEME_PROMPT_PREFIX="" NVM_THEME_PROMPT_SUFFIX="" -NODE_THEME_PROMPT_COLOR=22 NODE_CHAR=${POWERLINE_NODE_CHAR:="❲n❳ "} +NODE_THEME_PROMPT_COLOR=${POWERLINE_NODE_COLOR:=22} RVM_THEME_PROMPT_PREFIX="" RVM_THEME_PROMPT_SUFFIX="" diff --git a/themes/powerline-naked/powerline-naked.theme.bash b/themes/powerline-naked/powerline-naked.theme.bash index c20f8c43..2a5b7b26 100644 --- a/themes/powerline-naked/powerline-naked.theme.bash +++ b/themes/powerline-naked/powerline-naked.theme.bash @@ -27,7 +27,7 @@ SCM_THEME_PROMPT_COLOR=${SCM_THEME_PROMPT_CLEAN_COLOR} NVM_THEME_PROMPT_PREFIX="" NVM_THEME_PROMPT_SUFFIX="" NODE_CHAR=${POWERLINE_NODE_CHAR:="❲n❳ "} -NODE_THEME_PROMPT_COLOR=22 +NODE_THEME_PROMPT_COLOR=${POWERLINE_NODE_COLOR:=22} RVM_THEME_PROMPT_PREFIX="" RVM_THEME_PROMPT_SUFFIX="" diff --git a/themes/powerline-plain/powerline-plain.theme.bash b/themes/powerline-plain/powerline-plain.theme.bash index cf1a163f..4d539470 100644 --- a/themes/powerline-plain/powerline-plain.theme.bash +++ b/themes/powerline-plain/powerline-plain.theme.bash @@ -24,7 +24,7 @@ SCM_THEME_PROMPT_COLOR=${SCM_THEME_PROMPT_CLEAN_COLOR} NVM_THEME_PROMPT_PREFIX="" NVM_THEME_PROMPT_SUFFIX="" NODE_CHAR=${POWERLINE_NODE_CHAR:="❲n❳ "} -NODE_THEME_PROMPT_COLOR=22 +NODE_THEME_PROMPT_COLOR=${POWERLINE_NODE_COLOR:=22} RVM_THEME_PROMPT_PREFIX="" RVM_THEME_PROMPT_SUFFIX="" diff --git a/themes/powerline/powerline.theme.bash b/themes/powerline/powerline.theme.bash index ace88ebe..26182a82 100644 --- a/themes/powerline/powerline.theme.bash +++ b/themes/powerline/powerline.theme.bash @@ -27,7 +27,7 @@ SCM_THEME_PROMPT_COLOR=${SCM_THEME_PROMPT_CLEAN_COLOR} NVM_THEME_PROMPT_PREFIX="" NVM_THEME_PROMPT_SUFFIX="" NODE_CHAR=${POWERLINE_NODE_CHAR:="❲n❳ "} -NODE_THEME_PROMPT_COLOR=22 +NODE_THEME_PROMPT_COLOR=${POWERLINE_NODE_COLOR:=22} RVM_THEME_PROMPT_PREFIX="" RVM_THEME_PROMPT_SUFFIX="" From 7c73b22e75ac7cceffaec9bc88b6c20d5b5436b6 Mon Sep 17 00:00:00 2001 From: Hongyi Zhao Date: Thu, 19 Dec 2019 16:45:39 +0800 Subject: [PATCH 063/388] fix completion/available/brew.completion.bash for the git-clone based installation --- completion/available/brew.completion.bash | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/completion/available/brew.completion.bash b/completion/available/brew.completion.bash index 5cbd1595..572c9389 100644 --- a/completion/available/brew.completion.bash +++ b/completion/available/brew.completion.bash @@ -8,4 +8,11 @@ if which brew >/dev/null 2>&1; then if [ -f "$BREW_PREFIX"/Library/Contributions/brew_bash_completion.sh ]; then . "$BREW_PREFIX"/Library/Contributions/brew_bash_completion.sh fi + + # For the git-clone based installation, see here for more info: + # https://github.com/Bash-it/bash-it/issues/1458 + # https://docs.brew.sh/Shell-Completion + if [ -f "$BREW_PREFIX"/completions/bash/brew ]; then + . "$BREW_PREFIX"/completions/bash/brew + fi fi From 6f2376daa23930387e95891777776344f5ba481c Mon Sep 17 00:00:00 2001 From: Hongyi Zhao Date: Thu, 19 Dec 2019 16:53:24 +0800 Subject: [PATCH 064/388] touch up completion/available/brew.completion.bash --- completion/available/brew.completion.bash | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/completion/available/brew.completion.bash b/completion/available/brew.completion.bash index 572c9389..9d010f05 100644 --- a/completion/available/brew.completion.bash +++ b/completion/available/brew.completion.bash @@ -1,18 +1,13 @@ if which brew >/dev/null 2>&1; then BREW_PREFIX=$(brew --prefix) - if [ -f "$BREW_PREFIX"/etc/bash_completion.d/brew ]; then . "$BREW_PREFIX"/etc/bash_completion.d/brew - fi - - if [ -f "$BREW_PREFIX"/Library/Contributions/brew_bash_completion.sh ]; then + elif [ -f "$BREW_PREFIX"/Library/Contributions/brew_bash_completion.sh ]; then . "$BREW_PREFIX"/Library/Contributions/brew_bash_completion.sh - fi - - # For the git-clone based installation, see here for more info: - # https://github.com/Bash-it/bash-it/issues/1458 - # https://docs.brew.sh/Shell-Completion - if [ -f "$BREW_PREFIX"/completions/bash/brew ]; then + elif [ -f "$BREW_PREFIX"/completions/bash/brew ]; then + # For the git-clone based installation, see here for more info: + # https://github.com/Bash-it/bash-it/issues/1458 + # https://docs.brew.sh/Shell-Completion . "$BREW_PREFIX"/completions/bash/brew fi fi From ac7d8779114a335d5041a85cbf46f3e81e1d68ae Mon Sep 17 00:00:00 2001 From: Radoslaw Smigielski Date: Thu, 19 Dec 2019 21:05:59 +0000 Subject: [PATCH 065/388] New theme for Python developers Colorful theme for Python developers with no external requirements. --- themes/radek/README.md | 19 +++++++++++++++++++ themes/radek/radek.theme.bash | 19 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 themes/radek/README.md create mode 100644 themes/radek/radek.theme.bash diff --git a/themes/radek/README.md b/themes/radek/README.md new file mode 100644 index 00000000..2dfff808 --- /dev/null +++ b/themes/radek/README.md @@ -0,0 +1,19 @@ +# Powerline Theme + +A colorful theme for Python developers. +It does not have any requirments. + +## Provided Information + +* Current username and hostname +* Current path +* Git repository status +* Current Python environment (venv, Conda ) +* Current Python version + +## Examples + +```bash +[radek@photon][~/src/nokia2/cbis] ±[master → origin ↑1 {1}✓][venv-cbis][py-3.7.5] +→ +``` diff --git a/themes/radek/radek.theme.bash b/themes/radek/radek.theme.bash new file mode 100644 index 00000000..bc47b011 --- /dev/null +++ b/themes/radek/radek.theme.bash @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +GIT_THEME_PROMPT_DIRTY="${red}✗" +GIT_THEME_PROMPT_CLEAN="${bold_green}✓" +GIT_THEME_PROMPT_PREFIX="${bold_cyan}[" +GIT_THEME_PROMPT_SUFFIX="${bold_cyan}]" + +VIRTUALENV_THEME_PROMPT_PREFIX="${bold_green}[" +VIRTUALENV_THEME_PROMPT_SUFFIX="${bold_green}]" +CONDAENV_THEME_PROMPT_PREFIX="${bold_green}[" +CONDAENV_THEME_PROMPT_SUFFIX="${bold_green}]" +PYTHON_THEME_PROMPT_PREFIX="${bold_green}[" +PYTHON_THEME_PROMPT_SUFFIX="${bold_green}]" + +function prompt_command() { + PS1="\n${bold_white}[\u@\h]${bold_yellow}[\w] ${bold_cyan}$(scm_prompt_char_info)$(python_version_prompt)${green}\n→${reset_color} " +} + +safe_append_prompt_command prompt_command From 4721cdfdac31e6e519d88a001e24171d135fa344 Mon Sep 17 00:00:00 2001 From: Muhammad Muhammad Ibrahim Date: Fri, 27 Dec 2019 05:40:57 +0200 Subject: [PATCH 066/388] Update bundler completion from @mernen --- completion/available/bundler.completion.bash | 247 ++++++++++++++++--- 1 file changed, 218 insertions(+), 29 deletions(-) diff --git a/completion/available/bundler.completion.bash b/completion/available/bundler.completion.bash index cdb7cf54..4ad04bdc 100644 --- a/completion/available/bundler.completion.bash +++ b/completion/available/bundler.completion.bash @@ -1,7 +1,7 @@ #! bash # bash completion for the `bundle` command. # -# Copyright (c) 2011-2013 Daniel Luz . +# Copyright (c) 2011-2017 Daniel Luz . # Distributed under the MIT license. # http://mernen.com/projects/completion-ruby # @@ -9,28 +9,166 @@ # . completion-bundle __bundle() { - local cur=$2 - local prev=$3 - local bundle_command - __bundle_get_command - COMPREPLY=() + local bundle_bin=("${_RUBY_COMMAND_PREFIX[@]}" "$1") + local cur prev + _get_comp_words_by_ref -n : cur prev + local bundle_command + local bundle_command_index + __bundle_get_command + COMPREPLY=() - local options - if [[ $cur = -* ]]; then - options="--no-color --verbose" - 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 - console open viz init gem" - fi - fi - COMPREPLY=($(compgen -W "$options" -- "$cur")) + local options + if [[ $cur = -* && $bundle_command != exec ]]; then + options="-V --help --no-color --no-no-color --verbose --no-verbose" + case $bundle_command in + "") + options="$options --version";; + check) + options="$options --dry-run --gemfile --path -r --retry";; + clean) + options="$options --dry-run --force";; + config) + options="$options --local --global --delete";; + doctor) + options="$options --gemfile --quiet --no-quiet";; + gem) + options="$options -b -e -t --bin --coc --no-coc --edit --exe + --no-exe --ext --no-ext --mit --no-mit --test";; + init) + options="$options --gemspec";; + install) + options="$options --binstubs --clean --deployment --force --frozen + --full-index --gemfile --jobs --local --no-cache + --no-prune --path --quiet --retry --shebang --standalone + --system --trust-policy --with --without";; + lock) + options="$options --add-platform --conservative --full-index + --local --lockfile --major --minor --patch --print + --remove-platform --strict --update";; + package) + options="$options --all --all-platforms";; + platform) + options="$options --ruby";; + show) + options="$options --outdated --paths --no-paths";; + update) + options="$options --bundler --conservative --force --full-index + --group --jobs --local --major --minor --patch --quiet + --ruby --source --strict";; + viz) + options="$options -f -F -R -v -W --file --format --requirements + --no-requirements --version --no-version --without";; + esac + else + case $bundle_command in + "" | help) + options="help install update package exec config + check show outdated console open lock viz init gem + platform clean doctor" + ;; + check | install) + case $prev in + --binstubs | --path) + _filedir -d + return;; + --standalone | --with | --without) + __bundle_complete_groups + return;; + --trust-policy) + options="HighSecurity MediumSecurity LowSecurity + AlmostNoSecurity NoSecurity";; + esac + ;; + config) + case $prev in + config | --*) + case $cur in + local.*) + options=($(__bundle_exec_ruby 'puts Bundler.definition.specs.to_hash.keys')) + options=("${options[*]/#/local.}") + ;; + *) + options=(path frozen without bin gemfile ssl_ca_cert + ssl_client_cert cache_path disable_multisource + ignore_messages retry redirect timeout + force_ruby_platform specific_platform + disable_checksum_validation disable_version_check + allow_offline_install auto_install + cache_all_platforms cache_all clean console + disable_exec_load disable_local_branch_check + disable_shared_gems jobs major_deprecations + no_install no_prune only_update_to_newer_versions + plugins shebang silence_root_warning + ssl_verify_mode system_bindir user_agent) + # We want to suggest the options above as complete words, + # and also "local." and "mirror." as prefixes + # To achieve that, disable automatic space insertion, + # insert it manually, then add the non-spaced prefixes + compopt -o nospace + options=("${options[@]/%/ }") + # And add prefix suggestions + options+=(local. mirror.) + # Override $IFS for completion to work + local IFS=$'\n' + COMPREPLY=($(compgen -W '${options[@]}' -- "$cur")) + return + ;; + esac + ;; + path | local.*) + _filedir -d + return;; + esac + ;; + exec) + if [[ $COMP_CWORD -eq $bundle_command_index ]]; then + # Figure out Bundler's binaries dir + local bundler_bin=$(__bundle_exec_ruby 'puts Bundler.bundle_path + "bin"') + if [[ -d $bundler_bin ]]; then + local binaries=("$bundler_bin"/*) + # If there are binaries, strip directory name and use them + [[ -f "$binaries" ]] && options="${binaries[@]##*/}" + else + # No binaries found; use full command completion + COMPREPLY=($(compgen -c -- "$cur")) + return + fi + else + local _RUBY_COMMAND_PREFIX=("${bundle_bin[@]}" exec) + _command_offset $bundle_command_index + return + fi + ;; + gem) + case $prev in + -e | --edit) + COMPREPLY=($(compgen -c -- "$cur")) + return;; + -t | --test) + options="minitest rspec";; + esac + ;; + update) + case $prev in + --group) + __bundle_complete_groups + return;; + *) + options=($(__bundle_exec_ruby 'puts Bundler.definition.specs.to_hash.keys')) + esac + ;; + viz) + case $prev in + -F | --format) + options="dot jpg png svg";; + -W | --without) + __bundle_complete_groups + return;; + esac + ;; + esac + fi + COMPREPLY=($(compgen -W "${options[*]}" -- "$cur")) } __bundle_get_command() { @@ -41,25 +179,76 @@ __bundle_get_command() { case $arg in [^-]*) bundle_command=$arg + bundle_command_index=$((i + 1)) return;; --version) - # command-killer + # Command-killer bundle_command=- return;; --help) bundle_command=help + bundle_command_index=$((i + 1)) return;; esac done } +# Provides completion for Bundler group names. +# +# Multiple groups can be entered, separated either by spaces or by colons. +# Input is read from $cur, and the result is directly written to $COMPREPLY. +__bundle_complete_groups() { + # Group being currently written + local cur_group=${cur##*[ :]} + # All groups written before + local prefix=${cur%"$cur_group"} + local groups=$(__bundle_exec_ruby 'puts Bundler.definition.dependencies.map(&:groups).reduce(:|).map(&:to_s)') + if [[ ! $groups ]]; then + COMPREPLY=() + return + fi + # Duplicate "default" and anything already in $prefix, so that `uniq` + # strips it; groups may be separated by ':', ' ', or '\ ' + local excluded=$'\ndefault\n'${prefix//[: \'\"\\]/$'\n'} + # Include them twice to ensure they are duplicates + groups=$groups$excluded$excluded + COMPREPLY=($(compgen -W "$(sort <<<"$groups" | uniq -u)" -- "$cur_group")) + # Prepend prefix to all entries + COMPREPLY=("${COMPREPLY[@]/#/$prefix}") + __ltrim_colon_completions "$cur" +} -complete -F __bundle -o bashdefault -o default bundle -# vim: ai ft=sh sw=4 sts=2 et +# __bundle_exec_ruby