diff --git a/docs/themes-list/powerline-base.rst b/docs/themes-list/powerline-base.rst index 85ba2388..b3907c6b 100644 --- a/docs/themes-list/powerline-base.rst +++ b/docs/themes-list/powerline-base.rst @@ -70,6 +70,7 @@ The contents of the prompt can be "reordered", all the "segments" (every piece o * ``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``\ ) +* ``duration`` - Duration of the last command. See :ref:`Command duration ` for details. * ``gcloud`` - Current gcloud active account * ``hostname`` - Host name of machine * ``in_toolbox`` - Show identifier if running inside a `toolbox `_ diff --git a/themes/powerline-multiline/powerline-multiline.theme.bash b/themes/powerline-multiline/powerline-multiline.theme.bash index a1663e6f..05c04987 100644 --- a/themes/powerline-multiline/powerline-multiline.theme.bash +++ b/themes/powerline-multiline/powerline-multiline.theme.bash @@ -94,6 +94,8 @@ COMMAND_NUMBER_THEME_PROMPT_CHAR=${POWERLINE_COMMAND_NUMBER_CHAR:="#"} GCLOUD_THEME_PROMPT_COLOR=${POWERLINE_GCLOUD_COLOR:=161} GCLOUD_CHAR=${POWERLINE_GCLOUD_CHAR:="❲G❳ "} +COMMAND_DURATION_PROMPT_COLOR=${POWERLINE_COMMAND_DURATION_COLOR:=129} + POWERLINE_LEFT_PROMPT=${POWERLINE_LEFT_PROMPT:="scm python_venv ruby node cwd"} POWERLINE_RIGHT_PROMPT=${POWERLINE_RIGHT_PROMPT:="in_vim clock battery user_info"} diff --git a/themes/powerline/powerline.base.bash b/themes/powerline/powerline.base.bash index 43ee8be1..a3f71642 100644 --- a/themes/powerline/powerline.base.bash +++ b/themes/powerline/powerline.base.bash @@ -210,6 +210,11 @@ function __powerline_command_number_prompt() { echo "${COMMAND_NUMBER_THEME_PROMPT_CHAR}\#|${COMMAND_NUMBER_THEME_PROMPT_COLOR}" } +function __powerline_duration_prompt() { + local duration=$(_command_duration) + [[ -n "$duration" ]] && echo "${duration}|${COMMAND_DURATION_PROMPT_COLOR}" +} + function __powerline_left_segment() { local params IFS="|" read -ra params <<< "${1}" diff --git a/themes/powerline/powerline.theme.bash b/themes/powerline/powerline.theme.bash index 794121b8..6b45d2d0 100644 --- a/themes/powerline/powerline.theme.bash +++ b/themes/powerline/powerline.theme.bash @@ -91,6 +91,8 @@ COMMAND_NUMBER_THEME_PROMPT_CHAR=${POWERLINE_COMMAND_NUMBER_CHAR:="#"} GCLOUD_THEME_PROMPT_COLOR=${POWERLINE_GCLOUD_COLOR:=161} GCLOUD_CHAR=${POWERLINE_GCLOUD_CHAR:="❲G❳ "} +COMMAND_DURATION_PROMPT_COLOR=${POWERLINE_COMMAND_DURATION_COLOR:=129} + POWERLINE_PROMPT=${POWERLINE_PROMPT:="user_info scm python_venv ruby node cwd"} safe_append_prompt_command __powerline_prompt_command