merge latest upstream

pull/1141/head
Ethan Edwards 2018-04-30 13:36:39 -05:00
commit 10d075c9c5
29 changed files with 299 additions and 90 deletions

View File

@ -4,7 +4,9 @@ about-alias 'pbcopy and pbpaste shortcuts to linux'
case $OSTYPE in
linux*)
XCLIP=$(command -v xclip)
[[ $XCLIP ]] && alias pbcopy="$XCLIP -selection clipboard" && alias pbpaste="$XCLIP -selection clipboard -o"
[[ $XCLIP ]] && \
alias pbcopy="$XCLIP -selection clipboard" && \
alias pbpaste="$XCLIP -selection clipboard -o"
;;
esac

View File

@ -18,5 +18,5 @@ alias nod='npm outdated'
alias nrb='npm rebuild'
alias nud='npm update'
alias nr='npm run'
alias nls='npm list'
alias nlsg='npm list --global'
alias nls='npm list --depth=0 2>/dev/null'
alias nlsg='npm list -g --depth=0 2>/dev/null'

View File

@ -11,5 +11,5 @@ alias vasrv="vault server"
alias vas="vault status"
alias vav="vault version"
alias vaw="vault write"
alias vag="vault auth -method=github"
alias vag="vault login -method=github"
alias varv="vault read -field=value"

View File

@ -5,15 +5,18 @@ about-alias 'yarn package manager aliases'
alias ya='yarn'
alias yai='yarn init'
alias yaa='yarn add'
alias yaga='yarn global add'
alias yaad='yarn add --dev'
alias yau='yarn upgrade'
alias yarm='yarn remove'
alias yagrm='yarn global remove'
alias yaod='yarn outdated'
alias yapa='yarn pack'
alias yap='yarn publish'
alias yasu='yarn self-update'
alias yaru='yarn run'
alias yat='yarn test'
alias yas='yarn serve'
alias yacc='yarn cache clean'
alias yack='yarn check'
alias yals='yarn list'

View File

@ -60,6 +60,8 @@ done
source "${BASH_IT}/themes/colors.theme.bash"
# shellcheck source=./themes/githelpers.theme.bash
source "${BASH_IT}/themes/githelpers.theme.bash"
# shellcheck source=./themes/p4helpers.theme.bash
source "${BASH_IT}/themes/p4helpers.theme.bash"
# shellcheck source=./themes/base.theme.bash
source "${BASH_IT}/themes/base.theme.bash"

View File

View File

@ -0,0 +1,31 @@
# Invoke (pyinvoke.org) tab-completion script to be sourced with Bash shell.
# https://github.com/pyinvoke/invoke/blob/master/completion/bash
_complete_invoke() {
local candidates
# COMP_WORDS contains the entire command string up til now (including
# program name).
# We hand it to Invoke so it can figure out the current context: spit back
# core options, task names, the current task's options, or some combo.
candidates=`invoke --complete -- ${COMP_WORDS[*]}`
# `compgen -W` takes list of valid options & a partial word & spits back
# possible matches. Necessary for any partial word completions (vs
# completions performed when no partial words are present).
#
# $2 is the current word or token being tabbed on, either empty string or a
# partial word, and thus wants to be compgen'd to arrive at some subset of
# our candidate list which actually matches.
#
# COMPREPLY is the list of valid completions handed back to `complete`.
COMPREPLY=( $(compgen -W "${candidates}" -- $2) )
}
# Tell shell builtin to use the above for completing 'inv'/'invoke':
# * -F: use given function name to generate completions.
# * -o default: when function generates no results, use filenames.
# * positional args: program names to complete for.
complete -F _complete_invoke -o default invoke inv

View File

@ -1 +1 @@
[[ -x "$(which pipenv)" ]] && source <(env _PIPENV_COMPLETE="source-bash" pipenv)
[[ -x "$(which pipenv)" ]] && eval "$(pipenv --completion)"

View File

@ -1,35 +1,65 @@
#!/usr/bin/env bash
# Bash Terraform completion
# Source: https://gist.github.com/cornfeedhobo/8bc08747ec3add1fc5adb2edb7cd68d3
#
# Bash completion for the terraform command
#
# Copyright (C) 2018 Vangelis Tasoulas
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
_terraform() {
local cur prev words cword opts
_get_comp_words_by_ref -n : cur prev words cword
COMPREPLY=()
opts=""
_terraform()
{
local cur prev words cword opts
_get_comp_words_by_ref -n : cur prev words cword
COMPREPLY=()
opts=""
if [[ ${cur} == -* ]] ; then
compopt -o nospace
fi
if [[ ${cword} -eq 1 ]] ; then
if [[ ${cword} -eq 1 ]] ; then
if [[ ${cur} == -* ]] ; then
opts="--help --version"
else
opts="$(terraform --help | grep -vE '(usage|Available|^$)' | awk '{print $1}')"
fi
fi
# Options that do not start with a hyphen, are always starting with four spaces.
opts="$(terraform --help | grep -E '^\s\s\s\s\S' | awk '{print $1}')"
opts="${opts} --help --version"
if [[ ${cword} -gt 1 ]] ; then
if [[ ${cword} -eq 2 && ${prev} == '--help' ]] ; then
opts="$(terraform --help | grep -vE '(usage|Available|^$)' | awk '{print $1}')"
else
opts="$(terraform --help "${words[1]}" | grep '^ *-[a-z]' | awk '{print $1}' | awk -F '=' '{if ($0 ~ /=/) {print $1"="} else {print $1" "}}')"
fi
fi
elif [[ ${cword} -gt 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
if [[ ${cword} -eq 2 && ${prev} == '--help' ]] ; then
opts="$(terraform --help | grep -E '^\s\s\s\s\S' | awk '{print $1}')"
elif [[ ${words[1]} != "--help" && ${words[1]} != "--version" && ${words[1]} != "version" ]] ; then
# Some commands accept hyphened parameters, ...
opts="$(terraform --help "${words[1]}" | grep -E '^\s+-' | awk '{print $1}' | awk -F '=' '{ if ($0 ~ /=/) {print $1"="} else {print $1} }')"
# but some other commands accept non-hyphened parameters.
opts="${opts} $(terraform --help "${words[1]}" | grep -E '^\s\s\s\s\S' | awk '{print $1}')"
# All of the commands accept the --help parameter which is not listed
# by the 'terraform --help <command>
opts="${opts} --help"
fi
fi
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
if [[ ${#COMPREPLY[*]} -eq 1 ]] ; then
if [[ ${COMPREPLY[0]} == *= ]] ; then
# When only one completion is left, check if there is an equal sign.
# If an equal sign, then add no space after the autocompleted word.
compopt -o nospace
fi
fi
return 0
}
complete -F _terraform terraform

View File

@ -167,7 +167,7 @@ then
done
else
echo ""
echo -e "\033[0;32mEnabling sane defaults\033[0m"
echo -e "\033[0;32mEnabling reasonable defaults\033[0m"
_enable-completion bash-it
_enable-completion system
_enable-plugin base

View File

@ -248,6 +248,7 @@ _bash-it-version() {
echo "Current git SHA: $BASH_IT_GIT_VERSION_INFO"
echo "$BASH_IT_GIT_URL/commit/$BASH_IT_GIT_SHA"
echo "Compare to latest: $BASH_IT_GIT_URL/compare/$BASH_IT_GIT_SHA...master"
cd - &> /dev/null || return
}

View File

@ -29,7 +29,7 @@ function alias_completion {
(( ${#completions[@]} == 0 )) && return 0
# create temporary file for wrapper functions and completions
local tmp_file; tmp_file="$(mktemp -t "${namespace}-${RANDOM}XXX.tmp")" || return 1
local tmp_file; tmp_file="$(mktemp -t "${namespace}-${RANDOM}XXXXXX")" || return 1
local completion_loader; completion_loader="$(complete -p -D 2>/dev/null | sed -Ene 's/.* -F ([^ ]*).*/\1/p')"
@ -56,7 +56,7 @@ function alias_completion {
continue
fi
fi
local new_completion="$(complete -p "$alias_cmd")"
local new_completion="$(complete -p "$alias_cmd" 2>/dev/null)"
# create a wrapper inserting the alias arguments if any
if [[ -n $alias_args ]]; then
@ -77,8 +77,10 @@ function alias_completion {
fi
# replace completion trigger by alias
new_completion="${new_completion% *} $alias_name"
echo "$new_completion" >> "$tmp_file"
if [[ -n $new_completion ]]; then
new_completion="${new_completion% *} $alias_name"
echo "$new_completion" >> "$tmp_file"
fi
done < <(alias -p | sed -Ene "s/$alias_regex/\2 '\3' '\4'/p")
source "$tmp_file" && rm -f "$tmp_file"
}; alias_completion

View File

@ -5,7 +5,7 @@ explain () {
about 'explain any bash command via mankier.com manpage API'
param '1: Name of the command to explain'
example '$ explain # interactive mode. Type commands to explain in REPL'
example '$ explain 'cmd -o | ...' # one quoted command to explain it.'
example '$ explain '"'"'cmd -o | ...'"'"' # one quoted command to explain it.'
group 'explain'
if [ "$#" -eq 0 ]; then

View File

@ -18,11 +18,11 @@ fe() {
[[ -n "$files" ]] && ${EDITOR:-vim} "${files[@]}"
}
fd() {
fcd() {
about "cd to the selected directory"
group "fzf"
param "1: Directory to browse, or . if omitted"
example "fd aliases"
example "fcd aliases"
local dir
dir=$(find ${1:-.} -path '*/\.*' -prune \

View File

@ -0,0 +1,10 @@
cite about-plugin
about-plugin 'load nodenv, if you are using it'
export NODENV_ROOT="$HOME/.nodenv"
pathmunge "$NODENV_ROOT/bin"
[[ `which nodenv` ]] && eval "$(nodenv init -)"
# Load the auto-completion script if nodenv was loaded.
[[ -e $NODENV_ROOT/completions/nodenv.bash ]] && source $NODENV_ROOT/completions/nodenv.bash

View File

@ -98,5 +98,18 @@ function prevcurl() {
curl "$*" | open -fa $PREVIEW
}
function refresh-launchpad() {
about 'Reset launchpad layout in macOS'
example '$ refresh-launchpad'
group 'osx'
if [ $(uname) = "Darwin" ];then
defaults write com.apple.dock ResetLaunchPad -bool TRUE
killall Dock
else
echo "Sorry, this only works on Mac OS X"
fi
}
# Make this backwards compatible
alias pcurl='prevcurl'

View File

@ -1,9 +1,13 @@
# make sure virtualenvwrapper is enabled if available
cite about-plugin
about-plugin 'virtualenvwrapper helper functions'
about-plugin 'virtualenvwrapper and pyenv-virtualenvwrapper helper functions'
[[ `which virtualenvwrapper.sh` ]] && . virtualenvwrapper.sh
if _command_exists pyenv; then
pyenv virtualenvwrapper
else
[[ `which virtualenvwrapper.sh` ]] && . virtualenvwrapper.sh
fi
function mkvenv {

View File

@ -42,6 +42,12 @@ SCM_GIT_STAGED_CHAR="S:"
SCM_GIT_STASH_CHAR_PREFIX="{"
SCM_GIT_STASH_CHAR_SUFFIX="}"
SCM_P4='p4'
SCM_P4_CHAR='⌛'
SCM_P4_CHANGES_CHAR='C:'
SCM_P4_DEFAULT_CHAR='D:'
SCM_P4_OPENED_CHAR='O:'
SCM_HG='hg'
SCM_HG_CHAR='☿'
@ -69,20 +75,22 @@ RBFU_THEME_PROMPT_SUFFIX='|'
function scm {
if [[ "$SCM_CHECK" = false ]]; then SCM=$SCM_NONE
elif [[ -f .git/HEAD ]]; then SCM=$SCM_GIT
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 [[ -d .hg ]]; then SCM=$SCM_HG
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 ]]; then SCM=$SCM_SVN
elif [[ -d .svn ]] && which svn &> /dev/null; then SCM=$SCM_SVN
else SCM=$SCM_NONE
fi
}
function scm_prompt_char {
if [[ -z ${SCM:-} ]]; then scm; fi
if [[ ${SCM:-} == $SCM_GIT ]]; then SCM_CHAR=$SCM_GIT_CHAR
elif [[ ${SCM:-} == $SCM_HG ]]; then SCM_CHAR=$SCM_HG_CHAR
elif [[ ${SCM:-} == $SCM_SVN ]]; then SCM_CHAR=$SCM_SVN_CHAR
if [[ -z $SCM ]]; then scm; fi
if [[ $SCM == $SCM_GIT ]]; then SCM_CHAR=$SCM_GIT_CHAR
elif [[ $SCM == $SCM_P4 ]]; then SCM_CHAR=$SCM_P4_CHAR
elif [[ $SCM == $SCM_HG ]]; then SCM_CHAR=$SCM_HG_CHAR
elif [[ $SCM == $SCM_SVN ]]; then SCM_CHAR=$SCM_SVN_CHAR
else SCM_CHAR=$SCM_NONE_CHAR
fi
}
@ -92,9 +100,10 @@ function scm_prompt_vars {
scm_prompt_char
SCM_DIRTY=0
SCM_STATE=''
[[ ${SCM:-} == $SCM_GIT ]] && git_prompt_vars && return
[[ ${SCM:-} == $SCM_HG ]] && hg_prompt_vars && return
[[ ${SCM:-} == $SCM_SVN ]] && svn_prompt_vars && return
[[ $SCM == $SCM_GIT ]] && git_prompt_vars && return
[[ $SCM == $SCM_P4 ]] && p4_prompt_vars && return
[[ $SCM == $SCM_HG ]] && hg_prompt_vars && return
[[ $SCM == $SCM_SVN ]] && svn_prompt_vars && return
}
function scm_prompt_info {
@ -125,8 +134,9 @@ function scm_prompt_info_common {
fi
# TODO: consider adding minimal status information for hg and svn
[[ ${SCM:-} == ${SCM_HG} ]] && hg_prompt_info && return
[[ ${SCM:-} == ${SCM_SVN} ]] && svn_prompt_info && return
[[ ${SCM} == ${SCM_P4} ]] && p4_prompt_info && return
[[ ${SCM} == ${SCM_HG} ]] && hg_prompt_info && return
[[ ${SCM} == ${SCM_SVN} ]] && svn_prompt_info && return
}
function git_prompt_minimal_info {
@ -193,6 +203,26 @@ function git_prompt_vars {
SCM_CHANGE=$(_git-short-sha 2>/dev/null || echo "")
}
function p4_prompt_vars {
IFS=$'\t' read -r \
opened_count non_default_changes default_count \
add_file_count edit_file_count delete_file_count \
<<< "$(_p4-opened-counts)"
if [[ "${opened_count}" -gt 0 ]]; then
SCM_DIRTY=1
SCM_STATE=${SCM_THEME_PROMPT_DIRTY}
[[ "${opened_count}" -gt 0 ]] && SCM_BRANCH+=" ${SCM_P4_OPENED_CHAR}${opened_count}"
[[ "${non_default_changes}" -gt 0 ]] && SCM_BRANCH+=" ${SCM_P4_CHANGES_CHAR}${non_default_changes}"
[[ "${default_count}" -gt 0 ]] && SCM_BRANCH+=" ${SCM_P4_DEFAULT_CHAR}${default_count}"
else
SCM_DIRTY=0
SCM_STATE=${SCM_THEME_PROMPT_DIRTY}
fi
SCM_PREFIX=${P4_THEME_PROMPT_PREFIX:-$SCM_THEME_PROMPT_PREFIX}
SCM_SUFFIX=${P4_THEME_PROMPT_SUFFIX:-$SCM_THEME_PROMPT_SUFFIX}
}
function svn_prompt_vars {
if [[ -n $(svn status 2> /dev/null) ]]; then
SCM_DIRTY=1
@ -363,6 +393,11 @@ function git_prompt_info {
echo -e "${SCM_PREFIX}${SCM_BRANCH}${SCM_STATE}${SCM_SUFFIX}"
}
function p4_prompt_info() {
p4_prompt_vars
echo -e "${SCM_PREFIX}${SCM_BRANCH}:${SCM_CHANGE}${SCM_STATE}${SCM_SUFFIX}"
}
function svn_prompt_info {
svn_prompt_vars
echo -e "${SCM_PREFIX}${SCM_BRANCH}${SCM_STATE}${SCM_SUFFIX}"

View File

@ -0,0 +1,45 @@
#!/usr/bin/env bash
function _p4-opened {
timeout 2.0s p4 opened -s 2> /dev/null
}
function _p4-opened-counts {
# Return the following counts seperated by tabs:
# - count of opened files
# - count of pending changesets (other than defaults)
# - count of files in the default changeset
# - count of opened files in add mode
# - count of opened files in edit mode
# - count of opened files in delete mode
_p4-opened | awk '
BEGIN {
opened=0;
type_array["edit"]=0;
type_array["add"]=0;
type_array["delete"]=0;
change_array["change"]=0;
}
{
# p4 opened prints one file per line, and all lines begin with "//"
# Here is an examples:
#
# $ p4 opened
# //depot/some/file.py#4 - edit change 716431 (text)
# //depot/another/file.py - edit default change (text)
# //now/add/a/newfile.sh - add change 435645 (text+k)
#
#
if ($1 ~ /^\/\//) {
opened += 1
change_array[$5] += 1
type_array[$3] += 1
}
}
END {
default_changes=change_array["change"];
non_default_changes=length(change_array) - 1;
print opened "\t" non_default_changes "\t" default_changes "\t" type_array["add"] "\t" type_array["edit"] "\t" type_array["delete"]
}
'
}

View File

@ -46,14 +46,19 @@ The time/date is printed by the `date` command, so refer to its man page to chan
The contents of both prompt sides can be "reordered", all the "segments" (every piece of information) can take any place. The currently available segments are:
* battery
* clock
* cwd
* in_vim
* python_venv
* ruby
* scm
* user_info
* `battery` - Battery information (you'll need to enable the `battery` plugin)
* `clock` - Current time in `HH:MM:SS` format
* `cwd` - Current working directory including full folder hierarchy (c.f. `wd`)
* `hostname` - Host name of machine
* `in_vim` - Show identifier if running in `:terminal` from vim
* `last_status` - Exit status of last run command
* `python_venv` - Python virtual environment information (`virtualenv`, `venv`
and `conda` supported)
* `ruby` - Current ruby version if using `rvm`
* `scm` - Version control information, `git`
* `user_info` - Current user
* `wd` - Working directory, like `cwd` but doesn't show the full folder
hierarchy, only the directory you're currently in.
Two variables can be defined to set the order of the prompt segments:

View File

@ -51,6 +51,8 @@ THEME_CLOCK_FORMAT=${THEME_CLOCK_FORMAT:="%H:%M:%S"}
IN_VIM_THEME_PROMPT_COLOR=245
IN_VIM_THEME_PROMPT_TEXT="vim"
HOST_THEME_PROMPT_COLOR=0
POWERLINE_LEFT_PROMPT=${POWERLINE_LEFT_PROMPT:="scm python_venv ruby cwd"}
POWERLINE_RIGHT_PROMPT=${POWERLINE_RIGHT_PROMPT:="in_vim clock battery user_info"}

View File

@ -42,16 +42,21 @@ The time/date is printed by the `date` command, so refer to its man page to chan
The contents of the prompt can be "reordered", all the "segments" (every piece of information) can take any place. The currently available segments are:
* battery
* clock
* cwd
* in_vim
* python_venv
* ruby
* scm
* user_info
* `battery` - Battery information (you'll need to enable the `battery` plugin)
* `clock` - Current time in `HH:MM:SS` format
* `cwd` - Current working directory including full folder hierarchy (c.f. `wd`)
* `hostname` - Host name of machine
* `in_vim` - Show identifier if running in `:terminal` from vim
* `last_status` - Exit status of last run command
* `python_venv` - Python virtual environment information (`virtualenv`, `venv`
and `conda` supported)
* `ruby` - Current ruby version if using `rvm`
* `scm` - Version control information, `git`
* `user_info` - Current user
* `wd` - Working directory, like `cwd` but doesn't show the full folder
hierarchy, only the directory you're currently in.
A variables can be defined to set the order of the prompt segments:
A variable can be defined to set the order of the prompt segments:
POWERLINE_PROMPT="user_info scm python_venv ruby cwd"

View File

@ -4,7 +4,7 @@ function __powerline_left_segment {
local OLD_IFS="${IFS}"; IFS="|"
local params=( $1 )
IFS="${OLD_IFS}"
local separator_char=""
local separator_char="${POWERLINE_LEFT_SEPARATOR}"
local separator=""
if [[ "${SEGMENTS_AT_LEFT}" -gt 0 ]]; then

View File

@ -1,9 +1,10 @@
#!/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
@ -47,6 +48,8 @@ THEME_CLOCK_FORMAT=${THEME_CLOCK_FORMAT:="%H:%M:%S"}
IN_VIM_THEME_PROMPT_COLOR=245
IN_VIM_THEME_PROMPT_TEXT="vim"
HOST_THEME_PROMPT_COLOR=254
POWERLINE_PROMPT=${POWERLINE_PROMPT:="user_info scm python_venv ruby cwd"}
safe_append_prompt_command __powerline_prompt_command

View File

@ -40,16 +40,21 @@ The time/date is printed by the `date` command, so refer to its man page to chan
The contents of the prompt can be "reordered", all the "segments" (every piece of information) can take any place. The currently available segments are:
* battery
* clock
* cwd
* in_vim
* python_venv
* ruby
* scm
* user_info
* `battery` - Battery information (you'll need to enable the `battery` plugin)
* `clock` - Current time in `HH:MM:SS` format
* `cwd` - Current working directory including full folder hierarchy (c.f. `wd`)
* `hostname` - Host name of machine
* `in_vim` - Show identifier if running in `:terminal` from vim
* `last_status` - Exit status of last run command
* `python_venv` - Python virtual environment information (`virtualenv`, `venv`
and `conda` supported)
* `ruby` - Current ruby version if using `rvm`
* `scm` - Version control information, `git`
* `user_info` - Current user
* `wd` - Working directory, like `cwd` but doesn't show the full folder
hierarchy, only the directory you're currently in.
A variables can be defined to set the order of the prompt segments:
A variable can be defined to set the order of the prompt segments:
POWERLINE_PROMPT="user_info scm python_venv ruby cwd"

View File

@ -43,6 +43,8 @@ THEME_CLOCK_FORMAT=${THEME_CLOCK_FORMAT:="%H:%M:%S"}
IN_VIM_THEME_PROMPT_COLOR=245
IN_VIM_THEME_PROMPT_TEXT="vim"
HOST_THEME_PROMPT_COLOR=0
POWERLINE_PROMPT=${POWERLINE_PROMPT:="user_info scm python_venv ruby cwd"}
safe_append_prompt_command __powerline_prompt_command

View File

@ -44,16 +44,21 @@ The time/date is printed by the `date` command, so refer to its man page to chan
The contents of the prompt can be "reordered", all the "segments" (every piece of information) can take any place. The currently available segments are:
* battery
* clock
* cwd
* in_vim
* python_venv
* ruby
* scm
* user_info
* `battery` - Battery information (you'll need to enable the `battery` plugin)
* `clock` - Current time in `HH:MM:SS` format
* `cwd` - Current working directory including full folder hierarchy (c.f. `wd`)
* `hostname` - Host name of machine
* `in_vim` - Show identifier if running in `:terminal` from vim
* `last_status` - Exit status of last run command
* `python_venv` - Python virtual environment information (`virtualenv`, `venv`
and `conda` supported)
* `ruby` - Current ruby version if using `rvm`
* `scm` - Version control information, `git`
* `user_info` - Current user
* `wd` - Working directory, like `cwd` but doesn't show the full folder
hierarchy, only the directory you're currently in.
A variables can be defined to set the order of the prompt segments:
A variable can be defined to set the order of the prompt segments:
POWERLINE_PROMPT="user_info scm python_venv ruby cwd"

View File

@ -84,6 +84,8 @@ function __powerline_scm_prompt {
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}"
fi
echo "${scm_prompt}${scm}|${color}"
fi

View File

@ -46,6 +46,8 @@ THEME_CLOCK_FORMAT=${THEME_CLOCK_FORMAT:="%H:%M:%S"}
IN_VIM_THEME_PROMPT_COLOR=245
IN_VIM_THEME_PROMPT_TEXT="vim"
HOST_THEME_PROMPT_COLOR=0
POWERLINE_PROMPT=${POWERLINE_PROMPT:="user_info scm python_venv ruby cwd"}
safe_append_prompt_command __powerline_prompt_command