Add fish functions
This commit is contained in:
parent
b2a8f9857a
commit
46e6a2d46a
9 changed files with 65 additions and 0 deletions
32
fish/functions/fish_right_prompt.fish
Normal file
32
fish/functions/fish_right_prompt.fish
Normal file
|
@ -0,0 +1,32 @@
|
|||
function fish_right_prompt
|
||||
set -g __fish_git_prompt_showdirtystate 1
|
||||
set -g __fish_git_prompt_showuntrackedfiles 1
|
||||
set -g __fish_git_prompt_showupstream informative
|
||||
set -g __fish_git_prompt_showcolorhints 1
|
||||
set -g __fish_git_prompt_use_informative_chars 1
|
||||
# Unfortunately this only works if we have a sensible locale
|
||||
string match -qi "*.utf-8" -- $LANG $LC_CTYPE $LC_ALL
|
||||
and set -g __fish_git_prompt_char_dirtystate \U1F4a9
|
||||
set -g __fish_git_prompt_char_untrackedfiles "?"
|
||||
|
||||
# The git prompt's default format is ' (%s)'.
|
||||
# We don't want the leading space.
|
||||
set -l vcs (fish_vcs_prompt '(%s)' 2>/dev/null)
|
||||
|
||||
set -l d (set_color brgrey)(date "+%R")(set_color normal)
|
||||
|
||||
set -l duration "$cmd_duration$CMD_DURATION"
|
||||
if test $duration -gt 100
|
||||
set duration (math $duration / 1000)s
|
||||
else
|
||||
set duration
|
||||
end
|
||||
|
||||
set -q VIRTUAL_ENV_DISABLE_PROMPT
|
||||
or set -g VIRTUAL_ENV_DISABLE_PROMPT true
|
||||
set -q VIRTUAL_ENV
|
||||
and set -l venv (string replace -r '.*/' '' -- "$VIRTUAL_ENV")
|
||||
|
||||
set_color normal
|
||||
string join " " -- $venv $duration $vcs $d
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue