mirror of
https://github.com/oh-my-fish/theme-bobthefish.git
synced 2024-10-27 20:34:23 +00:00
Clean up theme_vcs_ignore_paths
implementation.
- realpath isn't necessary for $PWD - match subdirectories of all ignore paths (otherwise the vcs segment is missing for the directory itself, but shows in subdirectories, which is weird) - check whether $theme_vsc_ignore_paths is set to save a command substitution
This commit is contained in:
parent
2673d2c39d
commit
162062b3ac
@ -171,7 +171,7 @@ variables to set the colors of the prompt. See the "Colors" section of
|
||||
|
||||
|
||||
**VCS options**
|
||||
- `set -g theme_vcs_ignore_paths /some/path/* /some/other/path`. Tells bobthefish to ignore paths for Git or Mercurial. Supports glob patterns.
|
||||
- `set -g theme_vcs_ignore_paths /some/path /some/other/path{foo,bar}`. Ignore project paths for Git or Mercurial. Supports glob patterns.
|
||||
|
||||
### Overrides
|
||||
|
||||
|
@ -93,17 +93,21 @@ function __bobthefish_pretty_parent -S -a current_dir -d 'Print a parent directo
|
||||
end
|
||||
|
||||
function __ignore_vcs_dir -d 'Identifies if dir is to be ignored for VCS highlighting'
|
||||
for path_ in $theme_vcs_ignore_paths
|
||||
if [ (string match (realpath $path_ ^/dev/null) (realpath $PWD ^/dev/null)) ]
|
||||
echo 1
|
||||
break
|
||||
end
|
||||
for p in $theme_vcs_ignore_paths
|
||||
set ignore_path (realpath $p ^/dev/null)
|
||||
string match $ignore_path $PWD >/dev/null
|
||||
or string match $ignore_path'/*' $PWD >/dev/null
|
||||
and echo 1
|
||||
and return
|
||||
end
|
||||
end
|
||||
|
||||
function __bobthefish_git_project_dir -S -d 'Print the current git project base directory'
|
||||
[ "$theme_display_git" = 'no' ]; and return
|
||||
[ (__ignore_vcs_dir) ]; and return
|
||||
|
||||
set -q theme_vcs_ignore_paths
|
||||
and [ (__ignore_vcs_dir) ]
|
||||
and return
|
||||
|
||||
if [ "$theme_git_worktree_support" != 'yes' ]
|
||||
command git rev-parse --show-toplevel ^/dev/null
|
||||
@ -149,7 +153,10 @@ end
|
||||
|
||||
function __bobthefish_hg_project_dir -S -d 'Print the current hg project base directory'
|
||||
[ "$theme_display_hg" = 'yes' ]; or return
|
||||
[ (__ignore_vcs_dir) ]; and return
|
||||
|
||||
set -q theme_vcs_ignore_paths
|
||||
and [ (__ignore_vcs_dir) ]
|
||||
and return
|
||||
|
||||
set -l d $PWD
|
||||
while not [ $d = / ]
|
||||
|
Loading…
Reference in New Issue
Block a user