Merge pull request #1444 from davidpfarrell/history-command-number

Adds history + command line number to powerline themes
pull/1449/head
Nils Winkler 2019-12-30 17:03:11 +01:00 committed by GitHub
commit 185083eadb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 48 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 time
* Current shell level * Current shell level
* Current dirstack level (`pushd` / `popd`) * Current dirstack level (`pushd` / `popd`)
* Current history number
* Current command number
* An indicator when connected by SSH * 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 `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 * 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. 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 * `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 * `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: Two variables can be defined to set the order of the prompt segments:

View File

@ -72,6 +72,12 @@ SHLVL_THEME_PROMPT_CHAR=${POWERLINE_SHLVL_CHAR:="§"}
DIRSTACK_THEME_PROMPT_COLOR=${POWERLINE_DIRSTACK_COLOR:=${CWD_THEME_PROMPT_COLOR}} DIRSTACK_THEME_PROMPT_COLOR=${POWERLINE_DIRSTACK_COLOR:=${CWD_THEME_PROMPT_COLOR}}
DIRSTACK_THEME_PROMPT_CHAR=${POWERLINE_DIRSTACK_CHAR:="←"} 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_LEFT_PROMPT=${POWERLINE_LEFT_PROMPT:="scm python_venv ruby node 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"} POWERLINE_RIGHT_PROMPT=${POWERLINE_RIGHT_PROMPT:="in_vim clock battery user_info"}

View File

@ -11,6 +11,8 @@ A colorful theme, where shows a lot information about your shell session.
* Current time * Current time
* Current shell level * Current shell level
* Current dirstack level (`pushd` / `popd`) * Current dirstack level (`pushd` / `popd`)
* Current history number
* Current command number
* An indicator when connected by SSH * 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 `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 * 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. 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 * `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 * `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: A variable can be defined to set the order of the prompt segments:

View File

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

View File

@ -9,6 +9,8 @@ A colorful theme, where shows a lot information about your shell session.
* Current time * Current time
* Current shell level * Current shell level
* Current dirstack level (`pushd` / `popd`) * Current dirstack level (`pushd` / `popd`)
* Current history number
* Current command number
* An indicator when connected by SSH * 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 `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 * 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. 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 * `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 * `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: A variable can be defined to set the order of the prompt segments:

View File

@ -63,6 +63,12 @@ SHLVL_THEME_PROMPT_CHAR=${POWERLINE_SHLVL_CHAR:="§"}
DIRSTACK_THEME_PROMPT_COLOR=${POWERLINE_DIRSTACK_COLOR:=${CWD_THEME_PROMPT_COLOR}} DIRSTACK_THEME_PROMPT_COLOR=${POWERLINE_DIRSTACK_COLOR:=${CWD_THEME_PROMPT_COLOR}}
DIRSTACK_THEME_PROMPT_CHAR=${POWERLINE_DIRSTACK_CHAR:="←"} 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"} POWERLINE_PROMPT=${POWERLINE_PROMPT:="user_info scm python_venv ruby node cwd"}
safe_append_prompt_command __powerline_prompt_command safe_append_prompt_command __powerline_prompt_command

View File

@ -13,6 +13,8 @@ A colorful theme, where shows a lot information about your shell session.
* Current time * Current time
* Current shell level * Current shell level
* Current dirstack level (`pushd` / `popd`) * Current dirstack level (`pushd` / `popd`)
* Current history number
* Current command number
* An indicator when connected by SSH * 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 `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 * 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. 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 * `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 * `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: A variable can be defined to set the order of the prompt segments:

View File

@ -181,6 +181,14 @@ function __powerline_dirstack_prompt {
fi 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 { function __powerline_left_segment {
local OLD_IFS="${IFS}"; IFS="|" local OLD_IFS="${IFS}"; IFS="|"
local params=( $1 ) 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_COLOR=${POWERLINE_DIRSTACK_COLOR:=${CWD_THEME_PROMPT_COLOR}}
DIRSTACK_THEME_PROMPT_CHAR=${POWERLINE_DIRSTACK_CHAR:="←"} 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"} POWERLINE_PROMPT=${POWERLINE_PROMPT:="user_info scm python_venv ruby node cwd"}
safe_append_prompt_command __powerline_prompt_command safe_append_prompt_command __powerline_prompt_command