Allow hiding project parent paths.

Set `theme_show_project_parent` to `no` to suppress the parent directory and path entirely when inside a Git or Mercurial project.

Fixes #358
pull/359/head
Justin Hileman 2 months ago
parent 39cf45635b
commit 25b9c582c9

@ -107,6 +107,7 @@ set -g default_user your_normal_user
set -g theme_color_scheme dark
set -g fish_prompt_pwd_dir_length 0
set -g theme_project_dir_length 1
set -g theme_show_project_parent yes
set -g theme_newline_cursor yes
set -g theme_newline_prompt '$ '
```
@ -140,6 +141,7 @@ set -g theme_newline_prompt '$ '
- `theme_use_abbreviated_branch_name`. Set to `yes` to truncate git branch names in the prompt.
- `fish_prompt_pwd_dir_length`. bobthefish respects the Fish `$fish_prompt_pwd_dir_length` setting to abbreviate the prompt path. Set to `0` to show the full path, `1` (default) to show only the first character of each parent directory name, or any other number to show up to that many characters.
- `theme_project_dir_length`. The same as `$fish_prompt_pwd_dir_length`, but for the path relative to the current project root. Defaults to `0`; set to any other number to show an abbreviated path.
- `theme_show_project_parent`. Set to `no` to only show the project directory name, and not its parent path, when inside a project.
- `theme_newline_cursor`. Use `yes` to have cursor start on a new line. By default the prompt is only one line. When working with long directories it may be preferrend to have cursor on the next line. Setting this to `clean` instead of `yes` suppresses the caret on the new line.
- `theme_newline_prompt`. Use a custom prompt with newline cursor. By default this is the chevron right glyph or `>` when powerline fonts are disabled.

@ -51,6 +51,7 @@
# set -g theme_color_scheme dark
# set -g fish_prompt_pwd_dir_length 0
# set -g theme_project_dir_length 1
# set -g theme_show_project_parent no
# set -g theme_newline_cursor yes
# ==============================
@ -358,7 +359,7 @@ function __bobthefish_start_segment -S -d 'Start a prompt segment'
set __bobthefish_current_bg $bg
end
function __bobthefish_path_segment -S -a segment_dir -d 'Display a shortened form of a directory'
function __bobthefish_path_segment -S -a segment_dir -a path_type -d 'Display a shortened form of a directory'
set -l segment_color $color_path
set -l segment_basename_color $color_path_basename
@ -382,7 +383,9 @@ function __bobthefish_path_segment -S -a segment_dir -d 'Display a shortened for
set directory (__bobthefish_basename "$segment_dir")
end
echo -n $parent
[ "$theme_show_project_parent" != "no" -o "$path_type" != "project" ]
and echo -n $parent
set_color -b $segment_basename_color
echo -ns $directory ' '
end
@ -1057,7 +1060,7 @@ function __bobthefish_prompt_hg -S -a hg_root_dir -a real_pwd -d 'Display the ac
set flag_colors $color_repo_dirty
end
__bobthefish_path_segment $hg_root_dir
__bobthefish_path_segment $hg_root_dir project
__bobthefish_start_segment $flag_colors
echo -ns $hg_glyph ' '
@ -1117,7 +1120,7 @@ function __bobthefish_prompt_git -S -a git_root_dir -a real_pwd -d 'Display the
set flag_colors $color_repo_staged
end
__bobthefish_path_segment $git_root_dir
__bobthefish_path_segment $git_root_dir project
__bobthefish_start_segment $flag_colors
echo -ns (__bobthefish_git_branch) $flags ' '
@ -1199,7 +1202,7 @@ function __bobthefish_prompt_git -S -a git_root_dir -a real_pwd -d 'Display the
end
function __bobthefish_prompt_dir -S -a real_pwd -d 'Display a shortened form of the current directory'
__bobthefish_path_segment "$real_pwd"
__bobthefish_path_segment "$real_pwd" pwd
end
@ -1225,7 +1228,7 @@ function fish_prompt -d 'bobthefish, a fish theme optimized for awesome'
# Start each line with a blank slate
set -l __bobthefish_current_bg
set -l real_pwd (__bobthefish_pwd)
# Status flags and input mode

Loading…
Cancel
Save