Merge remote-tracking branch 'upstream/master'
commit
3e5889a348
|
|
@ -0,0 +1,2 @@
|
||||||
|
*.sh text eol=lf
|
||||||
|
*.bash text eol=lf
|
||||||
21
README.md
21
README.md
|
|
@ -140,17 +140,28 @@ For custom scripts, and aliases, just create the following files (they'll be ign
|
||||||
|
|
||||||
Anything in the custom directory will be ignored, with the exception of `custom/example.bash`.
|
Anything in the custom directory will be ignored, with the exception of `custom/example.bash`.
|
||||||
|
|
||||||
Alternately, if you would like to keep your custom scripts under version control, you can set BASH_IT_CUSTOM in your `~/.bashrc` to another location outside of the `~/.bash_it` folder.
|
Alternately, if you would like to keep your custom scripts under version control, you can set `BASH_IT_CUSTOM` in your `~/.bashrc` to another location outside of the `~/.bash_it` folder.
|
||||||
|
|
||||||
## Themes
|
## Themes
|
||||||
|
|
||||||
There are a few Bash-it themes. If you've created your own custom prompts, I'd love it if you shared with everyone else! Just submit a Pull Request.
|
There are over 50+ Bash-it themes to pick from in `.bash_it/themes`. The default theme is `bobby`. Set `BASH_IT_THEME` to the theme name you want, or if you've developed your own custom theme outside of `.bash_it/themes`, point the `BASH_IT_THEME` variable directly to the theme file.
|
||||||
|
|
||||||
You can see the theme screenshots [here](https://github.com/Bash-it/bash-it/wiki/Themes).
|
Examples:
|
||||||
|
|
||||||
Alternatively, you can preview the themes in your own shell using `BASH_PREVIEW=true reload`.
|
```bash
|
||||||
|
# Use the "powerline-multiline" theme
|
||||||
|
export BASH_IT_THEME="powerline-multiline"
|
||||||
|
|
||||||
**NOTE**: Bash-it and some themes use UTF-8 characters, so to avoid extrange behaviors in your terminal, set your locale to `LC_ALL=en_US.UTF-8` or the equivalent to your language if isn't American English.
|
# Use a theme outside of the Bash-it folder
|
||||||
|
export BASH_IT_THEME="/home/foo/my_theme/my_theme.theme.bash"
|
||||||
|
```
|
||||||
|
|
||||||
|
You can easily preview the themes in your own shell using `BASH_PREVIEW=true reload`.
|
||||||
|
|
||||||
|
If you've created your own custom prompts, we'd love it if you shared 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 isn't American English.
|
||||||
|
|
||||||
## Uninstalling
|
## Uninstalling
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ alias dki='docker images' # List Docker images
|
||||||
alias dkrmac='docker rm $(docker ps -a -q)' # Delete all Docker containers
|
alias dkrmac='docker rm $(docker ps -a -q)' # Delete all Docker containers
|
||||||
alias dkrmlc='docker-remove-most-recent-container' # Delete most recent (i.e., last) Docker container
|
alias dkrmlc='docker-remove-most-recent-container' # Delete most recent (i.e., last) Docker container
|
||||||
alias dkrmui='docker images -q -f dangling=true |xargs -r docker rmi' # Delete all untagged Docker images
|
alias dkrmui='docker images -q -f dangling=true |xargs -r docker rmi' # Delete all untagged Docker images
|
||||||
|
alias dkrmall='docker-remove-stale-assets' # Delete all untagged images and exited containers
|
||||||
alias dkrmli='docker-remove-most-recent-image' # Delete most recent (i.e., last) Docker image
|
alias dkrmli='docker-remove-most-recent-image' # Delete most recent (i.e., last) Docker image
|
||||||
alias dkrmi='docker-remove-images' # Delete images for supplied IDs or all if no IDs are passed as arguments
|
alias dkrmi='docker-remove-images' # Delete images for supplied IDs or all if no IDs are passed as arguments
|
||||||
alias dkideps='docker-image-dependencies' # Output a graph of image dependencies using Graphiz
|
alias dkideps='docker-image-dependencies' # Output a graph of image dependencies using Graphiz
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,13 @@ fi
|
||||||
alias md='mkdir -p'
|
alias md='mkdir -p'
|
||||||
alias rd='rmdir'
|
alias rd='rmdir'
|
||||||
|
|
||||||
|
# Common misspellings of bash-it
|
||||||
|
alias shit='bash-it'
|
||||||
|
alias batshit='bash-it'
|
||||||
|
alias bashit='bash-it'
|
||||||
|
alias bash_it='bash-it'
|
||||||
|
alias bash_ti='bash-it'
|
||||||
|
|
||||||
# Display whatever file is regular file or folder
|
# Display whatever file is regular file or folder
|
||||||
catt() {
|
catt() {
|
||||||
for i in "$@"; do
|
for i in "$@"; do
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ alias gus='git reset HEAD'
|
||||||
alias gpristine='git reset --hard && git clean -dfx'
|
alias gpristine='git reset --hard && git clean -dfx'
|
||||||
alias gclean='git clean -fd'
|
alias gclean='git clean -fd'
|
||||||
alias gm="git merge"
|
alias gm="git merge"
|
||||||
|
alias gmv='git mv'
|
||||||
alias g='git'
|
alias g='git'
|
||||||
alias get='git'
|
alias get='git'
|
||||||
alias gst='git status'
|
alias gst='git status'
|
||||||
|
|
@ -33,6 +34,7 @@ alias gpom='git push origin master'
|
||||||
alias gr='git remote'
|
alias gr='git remote'
|
||||||
alias grv='git remote -v'
|
alias grv='git remote -v'
|
||||||
alias gra='git remote add'
|
alias gra='git remote add'
|
||||||
|
alias gd='git diff'
|
||||||
alias gdv='git diff -w "$@" | vim -R -'
|
alias gdv='git diff -w "$@" | vim -R -'
|
||||||
alias gc='git commit -v'
|
alias gc='git commit -v'
|
||||||
alias gca='git commit -v -a'
|
alias gca='git commit -v -a'
|
||||||
|
|
@ -42,6 +44,7 @@ alias gcam='git commit -a -m'
|
||||||
alias gb='git branch'
|
alias gb='git branch'
|
||||||
alias gba='git branch -a'
|
alias gba='git branch -a'
|
||||||
alias gbt='git branch --track'
|
alias gbt='git branch --track'
|
||||||
|
alias gbm='git branch -m'
|
||||||
alias gcount='git shortlog -sn'
|
alias gcount='git shortlog -sn'
|
||||||
alias gcp='git cherry-pick'
|
alias gcp='git cherry-pick'
|
||||||
alias gco='git checkout'
|
alias gco='git checkout'
|
||||||
|
|
@ -67,6 +70,10 @@ alias gnew="git log HEAD@{1}..HEAD@{0}"
|
||||||
# Add uncommitted and unstaged changes to the last commit
|
# Add uncommitted and unstaged changes to the last commit
|
||||||
alias gcaa="git commit -a --amend -C HEAD"
|
alias gcaa="git commit -a --amend -C HEAD"
|
||||||
alias ggui="git gui"
|
alias ggui="git gui"
|
||||||
|
alias gcam="git commit -am"
|
||||||
|
alias gcsam="git commit -S -am"
|
||||||
|
alias gstd="git stash drop"
|
||||||
|
alias gstl="git stash list"
|
||||||
|
|
||||||
case $OSTYPE in
|
case $OSTYPE in
|
||||||
darwin*)
|
darwin*)
|
||||||
|
|
@ -76,19 +83,3 @@ case $OSTYPE in
|
||||||
alias gtls='git tag -l | sort -V'
|
alias gtls='git tag -l | sort -V'
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [ -z "$EDITOR" ]; then
|
|
||||||
case $OSTYPE in
|
|
||||||
linux*)
|
|
||||||
alias gd='git diff | vim -R -'
|
|
||||||
;;
|
|
||||||
darwin*)
|
|
||||||
alias gd='git diff | mate'
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
alias gd='git diff'
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
else
|
|
||||||
alias gd="git diff | $EDITOR"
|
|
||||||
fi
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ alias nits='npm install-test --save'
|
||||||
alias nitd='npm install-test --save-dev'
|
alias nitd='npm install-test --save-dev'
|
||||||
alias nu='npm uninstall'
|
alias nu='npm uninstall'
|
||||||
alias nus='npm uninstall --save'
|
alias nus='npm uninstall --save'
|
||||||
alias nud='npm uninstall --save-dev'
|
alias nusd='npm uninstall --save-dev'
|
||||||
alias np='npm publish'
|
alias np='npm publish'
|
||||||
alias nup='npm unpublish'
|
alias nup='npm unpublish'
|
||||||
alias nlk='npm link'
|
alias nlk='npm link'
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ alias textedit='open -a TextEdit'
|
||||||
alias hex='open -a "Hex Fiend"'
|
alias hex='open -a "Hex Fiend"'
|
||||||
alias skype='open -a Skype'
|
alias skype='open -a Skype'
|
||||||
alias mou='open -a Mou'
|
alias mou='open -a Mou'
|
||||||
alias subl='open -a Sublime\ Text --args'
|
alias subl='open -a Sublime\ Text'
|
||||||
|
|
||||||
if [ -s /usr/bin/firefox ] ; then
|
if [ -s /usr/bin/firefox ] ; then
|
||||||
unalias firefox
|
unalias firefox
|
||||||
|
|
|
||||||
|
|
@ -110,4 +110,10 @@ _bash-it-comp()
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Activate completion for bash-it and its common misspellings
|
||||||
complete -F _bash-it-comp bash-it
|
complete -F _bash-it-comp bash-it
|
||||||
|
complete -F _bash-it-comp bash-ti
|
||||||
|
complete -F _bash-it-comp shit
|
||||||
|
complete -F _bash-it-comp bashit
|
||||||
|
complete -F _bash-it-comp batshit
|
||||||
|
complete -F _bash-it-comp bash_it
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
|
||||||
|
. <(ng completion --bash)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
|
||||||
|
# pip bash completion start
|
||||||
|
_pip_completion()
|
||||||
|
{
|
||||||
|
COMPREPLY=( $( COMP_WORDS="${COMP_WORDS[*]}" \
|
||||||
|
COMP_CWORD=$COMP_CWORD \
|
||||||
|
PIP_AUTO_COMPLETE=1 $1 ) )
|
||||||
|
}
|
||||||
|
complete -o default -F _pip_completion pip3
|
||||||
|
# pip bash completion end
|
||||||
|
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
# Bash completion support for RVM.
|
||||||
|
# Source: https://rvm.io/workflow/completion
|
||||||
|
|
||||||
|
[[ -r $rvm_path/scripts/completion ]] && . $rvm_path/scripts/completion
|
||||||
|
|
@ -9,7 +9,9 @@ fi
|
||||||
|
|
||||||
# Load the theme
|
# Load the theme
|
||||||
if [[ $BASH_IT_THEME ]]; then
|
if [[ $BASH_IT_THEME ]]; then
|
||||||
if [[ -f "$CUSTOM_THEME_DIR/$BASH_IT_THEME/$BASH_IT_THEME.theme.bash" ]]; then
|
if [[ -f $BASH_IT_THEME ]]; then
|
||||||
|
source $BASH_IT_THEME
|
||||||
|
elif [[ -f "$CUSTOM_THEME_DIR/$BASH_IT_THEME/$BASH_IT_THEME.theme.bash" ]]; then
|
||||||
source "$CUSTOM_THEME_DIR/$BASH_IT_THEME/$BASH_IT_THEME.theme.bash"
|
source "$CUSTOM_THEME_DIR/$BASH_IT_THEME/$BASH_IT_THEME.theme.bash"
|
||||||
else
|
else
|
||||||
source "$BASH_IT/themes/$BASH_IT_THEME/$BASH_IT_THEME.theme.bash"
|
source "$BASH_IT/themes/$BASH_IT_THEME/$BASH_IT_THEME.theme.bash"
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,20 @@ about-plugin 'Helpers to more easily work with Docker'
|
||||||
function docker-remove-most-recent-container() {
|
function docker-remove-most-recent-container() {
|
||||||
about 'attempt to remove the most recent container from docker ps -a'
|
about 'attempt to remove the most recent container from docker ps -a'
|
||||||
group 'docker'
|
group 'docker'
|
||||||
docker ps -a | head -2 | tail -1 | awk '{print $NF}' | xargs docker rm
|
docker ps -ql | xargs docker rm
|
||||||
}
|
}
|
||||||
|
|
||||||
function docker-remove-most-recent-image() {
|
function docker-remove-most-recent-image() {
|
||||||
about 'attempt to remove the most recent image from docker images'
|
about 'attempt to remove the most recent image from docker images'
|
||||||
group 'docker'
|
group 'docker'
|
||||||
docker images | head -2 | tail -1 | awk '{print $3}' | xargs docker rmi
|
docker images -q | head -1 | xargs docker rmi
|
||||||
|
}
|
||||||
|
|
||||||
|
function docker-remove-stale-assets() {
|
||||||
|
about 'attempt to remove exited containers and dangling images'
|
||||||
|
group 'docker'
|
||||||
|
docker ps --filter status=exited -q | xargs docker rm --volumes
|
||||||
|
docker images --filter dangling=true -q | xargs docker rmi
|
||||||
}
|
}
|
||||||
|
|
||||||
function docker-enter() {
|
function docker-enter() {
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ function pyedit() {
|
||||||
example '$ pyedit requests'
|
example '$ pyedit requests'
|
||||||
group 'python'
|
group 'python'
|
||||||
|
|
||||||
xpyc=`python -c "import sys; stdout = sys.stdout; sys.stdout = sys.stderr; import $1; stdout.write($1.__file__)"`
|
xpyc=`python -c "import os, sys; f = open(os.devnull, 'w'); sys.stderr = f; module = __import__('$1'); sys.stdout.write(module.__file__)"`
|
||||||
|
|
||||||
if [ "$xpyc" == "" ]; then
|
if [ "$xpyc" == "" ]; then
|
||||||
echo "Python module $1 not found"
|
echo "Python module $1 not found"
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,8 @@ SCM_THEME_BRANCH_TRACK_PREFIX=' → '
|
||||||
SCM_THEME_BRANCH_GONE_PREFIX=' ⇢ '
|
SCM_THEME_BRANCH_GONE_PREFIX=' ⇢ '
|
||||||
SCM_THEME_CURRENT_USER_PREFFIX=' ☺︎ '
|
SCM_THEME_CURRENT_USER_PREFFIX=' ☺︎ '
|
||||||
SCM_THEME_CURRENT_USER_SUFFIX=''
|
SCM_THEME_CURRENT_USER_SUFFIX=''
|
||||||
|
SCM_THEME_CHAR_PREFIX=''
|
||||||
|
SCM_THEME_CHAR_SUFFIX=''
|
||||||
|
|
||||||
THEME_BATTERY_PERCENTAGE_CHECK=${THEME_BATTERY_PERCENTAGE_CHECK:=true}
|
THEME_BATTERY_PERCENTAGE_CHECK=${THEME_BATTERY_PERCENTAGE_CHECK:=true}
|
||||||
|
|
||||||
|
|
@ -92,6 +94,16 @@ function scm_prompt_vars {
|
||||||
function scm_prompt_info {
|
function scm_prompt_info {
|
||||||
scm
|
scm
|
||||||
scm_prompt_char
|
scm_prompt_char
|
||||||
|
scm_prompt_info_common
|
||||||
|
}
|
||||||
|
|
||||||
|
function scm_prompt_char_info {
|
||||||
|
scm_prompt_char
|
||||||
|
echo -ne "${SCM_THEME_CHAR_PREFIX}${SCM_CHAR}${SCM_THEME_CHAR_SUFFIX}"
|
||||||
|
scm_prompt_info_common
|
||||||
|
}
|
||||||
|
|
||||||
|
function scm_prompt_info_common {
|
||||||
SCM_DIRTY=0
|
SCM_DIRTY=0
|
||||||
SCM_STATE=''
|
SCM_STATE=''
|
||||||
|
|
||||||
|
|
@ -429,7 +441,7 @@ function hg_prompt_info() {
|
||||||
|
|
||||||
function scm_char {
|
function scm_char {
|
||||||
scm_prompt_char
|
scm_prompt_char
|
||||||
echo -e "$SCM_CHAR"
|
echo -e "${SCM_THEME_CHAR_PREFIX}${SCM_CHAR}${SCM_THEME_CHAR_SUFFIX}"
|
||||||
}
|
}
|
||||||
|
|
||||||
function prompt_char {
|
function prompt_char {
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
SCM_THEME_PROMPT_DIRTY=" ${red}✗"
|
SCM_THEME_PROMPT_DIRTY=" ${red}✗"
|
||||||
SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓"
|
SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓"
|
||||||
SCM_THEME_PROMPT_PREFIX=" |"
|
SCM_THEME_PROMPT_PREFIX=" ${green}|"
|
||||||
SCM_THEME_PROMPT_SUFFIX="${green}|"
|
SCM_THEME_PROMPT_SUFFIX="${green}|"
|
||||||
|
|
||||||
GIT_THEME_PROMPT_DIRTY=" ${red}✗"
|
GIT_THEME_PROMPT_DIRTY=" ${red}✗"
|
||||||
|
|
@ -23,7 +23,7 @@ __bobby_clock() {
|
||||||
|
|
||||||
function prompt_command() {
|
function prompt_command() {
|
||||||
#PS1="${bold_cyan}$(scm_char)${green}$(scm_prompt_info)${purple}$(ruby_version_prompt) ${yellow}\h ${reset_color}in ${green}\w ${reset_color}\n${green}→${reset_color} "
|
#PS1="${bold_cyan}$(scm_char)${green}$(scm_prompt_info)${purple}$(ruby_version_prompt) ${yellow}\h ${reset_color}in ${green}\w ${reset_color}\n${green}→${reset_color} "
|
||||||
PS1="\n$(battery_char) $(__bobby_clock)${yellow}$(ruby_version_prompt) ${purple}\h ${reset_color}in ${green}\w\n${bold_cyan}$(scm_char)${green}$(scm_prompt_info) ${green}→${reset_color} "
|
PS1="\n$(battery_char) $(__bobby_clock)${yellow}$(ruby_version_prompt) ${purple}\h ${reset_color}in ${green}\w\n${bold_cyan}$(scm_prompt_char_info) ${green}→${reset_color} "
|
||||||
}
|
}
|
||||||
|
|
||||||
THEME_SHOW_CLOCK_CHAR=${THEME_SHOW_CLOCK_CHAR:-"true"}
|
THEME_SHOW_CLOCK_CHAR=${THEME_SHOW_CLOCK_CHAR:-"true"}
|
||||||
|
|
|
||||||
|
|
@ -189,7 +189,7 @@ yellow="\[\e[0;33m\]"
|
||||||
blue="\[\e[0;34m\]"
|
blue="\[\e[0;34m\]"
|
||||||
purple="\[\e[0;35m\]"
|
purple="\[\e[0;35m\]"
|
||||||
cyan="\[\e[0;36m\]"
|
cyan="\[\e[0;36m\]"
|
||||||
white="\[\e[0;37;1m\]"
|
white="\[\e[0;37m\]"
|
||||||
orange="\[\e[0;91m\]"
|
orange="\[\e[0;91m\]"
|
||||||
|
|
||||||
bold_black="\[\e[30;1m\]"
|
bold_black="\[\e[30;1m\]"
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,60 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# One line prompt showing the following configurable information
|
||||||
|
# for git:
|
||||||
|
# time (virtual_env) username@hostname pwd git_char|git_branch git_dirty_status|→
|
||||||
|
#
|
||||||
|
# The → arrow shows the exit status of the last command:
|
||||||
|
# - bold green: 0 exit status
|
||||||
|
# - bold red: non-zero exit status
|
||||||
|
#
|
||||||
|
# Example outside git repo:
|
||||||
|
# 07:45:05 user@host ~ →
|
||||||
|
#
|
||||||
|
# Example inside clean git repo:
|
||||||
|
# 07:45:05 user@host .bash_it ±|master|→
|
||||||
|
#
|
||||||
|
# Example inside dirty git repo:
|
||||||
|
# 07:45:05 user@host .bash_it ±|master ✗|→
|
||||||
|
#
|
||||||
|
# Example with virtual environment:
|
||||||
|
# 07:45:05 (venv) user@host ~ →
|
||||||
|
#
|
||||||
|
|
||||||
|
SCM_NONE_CHAR=''
|
||||||
|
SCM_THEME_PROMPT_DIRTY=" ${red}✗"
|
||||||
|
SCM_THEME_PROMPT_CLEAN=""
|
||||||
|
SCM_THEME_PROMPT_PREFIX="${green}|"
|
||||||
|
SCM_THEME_PROMPT_SUFFIX="${green}|"
|
||||||
|
SCM_GIT_SHOW_MINIMAL_INFO=true
|
||||||
|
|
||||||
|
CLOCK_THEME_PROMPT_PREFIX=''
|
||||||
|
CLOCK_THEME_PROMPT_SUFFIX=' '
|
||||||
|
THEME_SHOW_CLOCK=true
|
||||||
|
THEME_CLOCK_COLOR=${THEME_CLOCK_COLOR:-"$bold_blue"}
|
||||||
|
THEME_CLOCK_FORMAT=${THEME_CLOCK_FORMAT:-"%I:%M:%S"}
|
||||||
|
|
||||||
|
VIRTUALENV_THEME_PROMPT_PREFIX='('
|
||||||
|
VIRTUALENV_THEME_PROMPT_SUFFIX=') '
|
||||||
|
|
||||||
|
function prompt_command() {
|
||||||
|
# This needs to be first to save last command return code
|
||||||
|
local RC="$?"
|
||||||
|
|
||||||
|
hostname="${bold_black}\u@\h"
|
||||||
|
virtualenv="${white}$(virtualenv_prompt)"
|
||||||
|
|
||||||
|
# Set return status color
|
||||||
|
if [[ ${RC} == 0 ]]; then
|
||||||
|
ret_status="${bold_green}"
|
||||||
|
else
|
||||||
|
ret_status="${bold_red}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Append new history lines to history file
|
||||||
|
history -a
|
||||||
|
|
||||||
|
PS1="$(clock_prompt)${virtualenv}${hostname} ${bold_cyan}\W $(scm_prompt_char_info)${ret_status}→ ${normal}"
|
||||||
|
}
|
||||||
|
|
||||||
|
safe_append_prompt_command prompt_command
|
||||||
|
|
@ -4,6 +4,8 @@ A colorful theme, where shows a lot information about your shell session.
|
||||||
|
|
||||||
**IMPORTANT:** This theme requires that [a font with the Powerline symbols](https://github.com/powerline/fonts) needs to be used in your terminal emulator, otherwise the prompt won't be displayed correctly, i.e. some of the additional icons and characters will be missing. Please follow your operating system's instructions to install one of the fonts from the above link and select it in your terminal emulator.
|
**IMPORTANT:** This theme requires that [a font with the Powerline symbols](https://github.com/powerline/fonts) needs to be used in your terminal emulator, otherwise the prompt won't be displayed correctly, i.e. some of the additional icons and characters will be missing. Please follow your operating system's instructions to install one of the fonts from the above link and select it in your terminal emulator.
|
||||||
|
|
||||||
|
**NOTICE:** The default behavior of this theme assumes that you have sudo privileges on your workstation. If that is not the case (e.g. if you are running on a corporate network where `sudo` usage is tracked), you can set the flag 'export THEME_CHECK_SUDO=false' in your `~/.bashrc` or `~/.bash_profile` to disable the Powerline theme's `sudo` check. This will apply to all `powerline*` themes.
|
||||||
|
|
||||||
## Provided Information
|
## Provided Information
|
||||||
|
|
||||||
* Current path
|
* Current path
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,8 @@
|
||||||
|
# Define this here so it can be used by all of the Powerline themes
|
||||||
|
THEME_CHECK_SUDO=${THEME_CHECK_SUDO:=true}
|
||||||
|
|
||||||
function set_color {
|
function set_color {
|
||||||
|
set +u
|
||||||
if [[ "${1}" != "-" ]]; then
|
if [[ "${1}" != "-" ]]; then
|
||||||
fg="38;5;${1}"
|
fg="38;5;${1}"
|
||||||
fi
|
fi
|
||||||
|
|
@ -10,11 +14,14 @@ function set_color {
|
||||||
}
|
}
|
||||||
|
|
||||||
function __powerline_user_info_prompt {
|
function __powerline_user_info_prompt {
|
||||||
|
set +u
|
||||||
local user_info=""
|
local user_info=""
|
||||||
local color=${USER_INFO_THEME_PROMPT_COLOR}
|
local color=${USER_INFO_THEME_PROMPT_COLOR}
|
||||||
|
|
||||||
if sudo -n uptime 2>&1 | grep -q "load"; then
|
if [[ "${THEME_CHECK_SUDO}" = true ]]; then
|
||||||
color=${USER_INFO_THEME_PROMPT_COLOR_SUDO}
|
if sudo -n uptime 2>&1 | grep -q "load"; then
|
||||||
|
color=${USER_INFO_THEME_PROMPT_COLOR_SUDO}
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
case "${POWERLINE_PROMPT_USER_INFO_MODE}" in
|
case "${POWERLINE_PROMPT_USER_INFO_MODE}" in
|
||||||
"sudo")
|
"sudo")
|
||||||
|
|
@ -46,6 +53,7 @@ function __powerline_ruby_prompt {
|
||||||
}
|
}
|
||||||
|
|
||||||
function __powerline_python_venv_prompt {
|
function __powerline_python_venv_prompt {
|
||||||
|
set +u
|
||||||
local python_venv=""
|
local python_venv=""
|
||||||
|
|
||||||
if [[ -n "${CONDA_DEFAULT_ENV}" ]]; then
|
if [[ -n "${CONDA_DEFAULT_ENV}" ]]; then
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,9 @@ SCM_GIT_CHAR="${green}±${normal}"
|
||||||
SCM_SVN_CHAR="${bold_cyan}⑆${normal}"
|
SCM_SVN_CHAR="${bold_cyan}⑆${normal}"
|
||||||
SCM_HG_CHAR="${bold_red}☿${normal}"
|
SCM_HG_CHAR="${bold_red}☿${normal}"
|
||||||
|
|
||||||
|
VIRTUALENV_THEME_PROMPT_PREFIX="("
|
||||||
|
VIRTUALENV_THEME_PROMPT_SUFFIX=")"
|
||||||
|
|
||||||
### TODO: openSUSE has already colors enabled, check if those differs from stock
|
### TODO: openSUSE has already colors enabled, check if those differs from stock
|
||||||
# LS colors, made with http://geoff.greer.fm/lscolors/
|
# LS colors, made with http://geoff.greer.fm/lscolors/
|
||||||
# export LSCOLORS="Gxfxcxdxbxegedabagacad"
|
# export LSCOLORS="Gxfxcxdxbxegedabagacad"
|
||||||
|
|
@ -33,9 +36,9 @@ pure_prompt() {
|
||||||
|
|
||||||
# make it work
|
# make it work
|
||||||
case $(id -u) in
|
case $(id -u) in
|
||||||
0) PS1="$ps_root@$ps_host$(scm_prompt):$ps_path$ps_root_mark"
|
0) PS1="$(virtualenv_prompt)$ps_root@$ps_host$(scm_prompt):$ps_path$ps_root_mark"
|
||||||
;;
|
;;
|
||||||
*) PS1="$ps_user@$ps_host$(scm_prompt):$ps_path$ps_user_mark"
|
*) PS1="$(virtualenv_prompt)$ps_user@$ps_host$(scm_prompt):$ps_path$ps_user_mark"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue