1
1
Fork 0

Prefer Fossil branch over Git branch in prompt

This commit is contained in:
Jonathan Schleifer 2020-05-28 23:17:45 +00:00
parent 1c7c719fa5
commit 5b0d6744de
2 changed files with 6 additions and 6 deletions

View file

@ -7,11 +7,11 @@ function fish_prompt --description 'Write out the prompt'
set suffix '>' set suffix '>'
end end
set -l branch (git symbolic-ref HEAD 2>/dev/null) set -l branch (fossil branch current 2>/dev/null)
set branch (string replace -r "^refs/heads/" "" $branch)
if test -z "$branch" if test -z "$branch"
set branch (fossil branch current 2>/dev/null) set branch (git symbolic-ref HEAD 2>/dev/null)
set branch (string replace -r "^refs/heads/" "" $branch)
end end
set -l vcs set -l vcs

6
zshrc
View file

@ -103,11 +103,11 @@ set_prompt
__precmd() { __precmd() {
__update_terminal_cwd __update_terminal_cwd
local branch=$(git symbolic-ref HEAD 2>/dev/null) local branch=$(fossil branch current 2>/dev/null)
branch=${branch##refs/heads/}
if [ -z "$branch" ]; then if [ -z "$branch" ]; then
branch=$(fossil branch current 2>/dev/null) branch=$(git symbolic-ref HEAD 2>/dev/null)
branch=${branch##refs/heads/}
fi fi
set_prompt $branch set_prompt $branch