Skip to content

Commit f207b7c

Browse files
committed
lib: provide a prompt function for the dirstack
Providing this additional function for prompts allows anyone using pushd/popd/dirs to navigate directory trees to quickly view their stack and find which entry they want to switch to. This degrades gracefully for anyone not using the directory stack since dirs will always display the same as \w when the stack is only one entry deep. The bakke theme has been tweaked to use the new function as an example. Signed-off-by: Joe MacDonald <[email protected]>
1 parent 1c7f6d6 commit f207b7c

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

lib/omb-prompt-base.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,9 @@ function aws_profile {
585585
fi
586586
}
587587

588+
function dirs_prompt {
589+
dirs
590+
}
588591

589592
# Returns true if $1 is a shell function.
590593
_omb_deprecate_function 20000 fn_exists _omb_util_function_exists

themes/bakke/bakke.theme.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function _omb_theme_PROMPT_COMMAND() {
1616
#PS1="${_omb_prompt_bold_teal}$(scm_char)${_omb_prompt_green}$(scm_prompt_info)${_omb_prompt_purple}$(_omb_prompt_print_ruby_env) ${_omb_prompt_olive}\h ${_omb_prompt_reset_color}in ${_omb_prompt_green}\w ${_omb_prompt_reset_color}\n${_omb_prompt_green}→${_omb_prompt_reset_color} "
1717
#PS1="\n${_omb_prompt_purple}\h: ${_omb_prompt_reset_color} ${_omb_prompt_green}\w\n${_omb_prompt_bold_teal}$(scm_char)${_omb_prompt_green}$(scm_prompt_info) ${_omb_prompt_green}→${_omb_prompt_reset_color} "
1818
#PS1="\n${_omb_prompt_teal}\h: ${_omb_prompt_reset_color} ${_omb_prompt_olive}\w\n${_omb_prompt_brown}$(scm_char)${_omb_prompt_brown}$(scm_prompt_info) ${_omb_prompt_green}→${_omb_prompt_reset_color} "
19-
PS1="\n${_omb_prompt_teal}\h: ${_omb_prompt_reset_color} ${_omb_prompt_olive}\w ${_omb_prompt_green}$(scm_prompt_info)\n${_omb_prompt_reset_color}"
19+
PS1="\n${_omb_prompt_teal}\h: ${_omb_prompt_reset_color} ${_omb_prompt_olive}$(dirs_prompt) ${_omb_prompt_green}$(scm_prompt_info)\n${_omb_prompt_reset_color}"
2020
}
2121

2222
_omb_util_add_prompt_command _omb_theme_PROMPT_COMMAND

0 commit comments

Comments
 (0)