Adds history + command line number to powerline themes

pull/1444/head
David Farrell 2019-11-02 00:07:59 -07:00
parent 9b7b33d375
commit ee5e1b63bc
No known key found for this signature in database
GPG Key ID: 1CCA28D0E300B56F
6 changed files with 30 additions and 0 deletions

View File

@ -11,6 +11,8 @@ A colorful multiline theme, where the first line shows information about your sh
* Current time
* Current shell level
* Current dirstack level (`pushd` / `popd`)
* Current history number
* Current command number
* An indicator when connected by SSH
* An indicator when `sudo` has the credentials cached (see the `sudo` manpage for more info about this)
* An indicator when the current shell is inside the Vim editor
@ -69,6 +71,8 @@ The contents of both prompt sides can be "reordered", all the "segments" (every
hierarchy, only the directory you're currently in.
* `shlvl` - Show the current shell level (based on `SHLVL` environment variable), but only if you are not in root shell
* `dirstack` - Show the current dirstack level (based on `DIRSTACK` environment variable), but only if the stack is not empty
* `history_number` - Show current history number
* `command_number` - Show current command number
Two variables can be defined to set the order of the prompt segments:

View File

@ -11,6 +11,8 @@ A colorful theme, where shows a lot information about your shell session.
* Current time
* Current shell level
* Current dirstack level (`pushd` / `popd`)
* Current history number
* Current command number
* An indicator when connected by SSH
* An indicator when `sudo` has the credentials cached (see the `sudo` manpage for more info about this)
* An indicator when the current shell is inside the Vim editor
@ -63,6 +65,8 @@ The contents of the prompt can be "reordered", all the "segments" (every piece o
hierarchy, only the directory you're currently in.
* `shlvl` - Show the current shell level (based on `SHLVL` environment variable), but only if you are not in root shell
* `dirstack` - Show the current dirstack level (based on `DIRSTACK` environment variable), but only if the stack is not empty
* `history_number` - Show current history number
* `command_number` - Show current command number
A variable can be defined to set the order of the prompt segments:

View File

@ -9,6 +9,8 @@ A colorful theme, where shows a lot information about your shell session.
* Current time
* Current shell level
* Current dirstack level (`pushd` / `popd`)
* Current history number
* Current command number
* An indicator when connected by SSH
* An indicator when `sudo` has the credentials cached (see the `sudo` manpage for more info about this)
* An indicator when the current shell is inside the Vim editor
@ -61,6 +63,8 @@ The contents of the prompt can be "reordered", all the "segments" (every piece o
hierarchy, only the directory you're currently in.
* `shlvl` - Show the current shell level (based on `SHLVL` environment variable), but only if you are not in root shell
* `dirstack` - Show the current dirstack level (based on `DIRSTACK` environment variable), but only if the stack is not empty
* `history_number` - Show current history number
* `command_number` - Show current command number
A variable can be defined to set the order of the prompt segments:

View File

@ -13,6 +13,8 @@ A colorful theme, where shows a lot information about your shell session.
* Current time
* Current shell level
* Current dirstack level (`pushd` / `popd`)
* Current history number
* Current command number
* An indicator when connected by SSH
* An indicator when `sudo` has the credentials cached (see the `sudo` manpage for more info about this)
* An indicator when the current shell is inside the Vim editor
@ -69,6 +71,8 @@ The contents of the prompt can be "reordered", all the "segments" (every piece o
hierarchy, only the directory you're currently in.
* `shlvl` - Show the current shell level (based on `SHLVL` environment variable), but only if you are not in root shell
* `dirstack` - Show the current dirstack level (based on `DIRSTACK` environment variable), but only if the stack is not empty
* `history_number` - Show current history number
* `command_number` - Show current command number
A variable can be defined to set the order of the prompt segments:

View File

@ -181,6 +181,14 @@ function __powerline_dirstack_prompt {
fi
}
function __powerline_history_number_prompt {
echo "${HISTORY_NUMBER_THEME_PROMPT_CHAR}\!|${HISTORY_NUMBER_THEME_PROMPT_COLOR}"
}
function __powerline_command_number_prompt {
echo "${COMMAND_NUMBER_THEME_PROMPT_CHAR}\#|${COMMAND_NUMBER_THEME_PROMPT_COLOR}"
}
function __powerline_left_segment {
local OLD_IFS="${IFS}"; IFS="|"
local params=( $1 )

View File

@ -67,6 +67,12 @@ SHLVL_THEME_PROMPT_CHAR=${POWERLINE_SHLVL_CHAR:="§"}
DIRSTACK_THEME_PROMPT_COLOR=${POWERLINE_DIRSTACK_COLOR:=${CWD_THEME_PROMPT_COLOR}}
DIRSTACK_THEME_PROMPT_CHAR=${POWERLINE_DIRSTACK_CHAR:="←"}
HISTORY_NUMBER_THEME_PROMPT_COLOR=${POWERLINE_HISTORY_NUMBER_COLOR:="0"}
HISTORY_NUMBER_THEME_PROMPT_CHAR=${POWERLINE_HISTORY_NUMBER_CHAR:="#"}
COMMAND_NUMBER_THEME_PROMPT_COLOR=${POWERLINE_COMMAND_NUMBER_COLOR:=0}
COMMAND_NUMBER_THEME_PROMPT_CHAR=${POWERLINE_COMMAND_NUMBER_CHAR:="#"}
POWERLINE_PROMPT=${POWERLINE_PROMPT:="user_info scm python_venv ruby node cwd"}
safe_append_prompt_command __powerline_prompt_command