This commit is contained in:
Tim Noise
2017-12-16 16:37:27 +11:00
103 changed files with 4669 additions and 609 deletions

View File

@@ -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.
**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
* Current path

View File

@@ -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 {
set +u
if [[ "${1}" != "-" ]]; then
fg="38;5;${1}"
fi
@@ -10,9 +14,16 @@ function set_color {
}
function __powerline_user_info_prompt {
local user_info=${USER}
set +u
local user_info=""
local color=${USER_INFO_THEME_PROMPT_COLOR}
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 sudo -n true >/dev/null 2>&1; then
@@ -22,7 +33,7 @@ function __powerline_user_info_prompt {
;;
*)
if [[ -n "${SSH_CLIENT}" ]]; then
user_info="${USER_INFO_SSH_CHAR}${USER}"
user_info="${USER_INFO_SSH_CHAR}${USER}@${SHORT_HOSTNAME:=$HOSTNAME}"
else
user_info="${USER}"
fi
@@ -34,9 +45,9 @@ function __powerline_user_info_prompt {
function __powerline_ruby_prompt {
local ruby_version=""
if command_exists rvm; then
if _command_exists rvm; then
ruby_version="$(rvm_version_prompt)"
elif command_exists rbenv; then
elif _command_exists rbenv; then
ruby_version=$(rbenv_version_prompt)
fi
@@ -44,6 +55,7 @@ function __powerline_ruby_prompt {
}
function __powerline_python_venv_prompt {
set +u
local python_venv=""
if [[ -n "${CONDA_DEFAULT_ENV}" ]]; then
@@ -93,6 +105,10 @@ function __powerline_hostname_prompt {
echo "$(hostname -s)|${HOST_THEME_PROMPT_COLOR}"
}
function __powerline_wd_prompt {
echo "\W|${CWD_THEME_PROMPT_COLOR}"
}
function __powerline_clock_prompt {
echo "$(date +"${THEME_CLOCK_FORMAT}")|${CLOCK_THEME_PROMPT_COLOR}"
}