1
0
Fork 0

fish: initial commit

This commit is contained in:
Von Random 2023-01-25 02:20:39 +02:00
parent 0e0793d0be
commit 936e6d3357
2 changed files with 78 additions and 0 deletions

48
fish/config.fish Normal file
View file

@ -0,0 +1,48 @@
if status is-interactive
set prompt_sep_a \ue0b0
set prompt_bang \n\U1f41f\
set color_fg brwhite
set color_git_branch 3c3c3c
set color_git yellow blue red purple
function prompt.add
set color $argv[1]
set text $argv[2]
if test -z "$prompt_string"
set prompt_string (set_color -b $color)(set_color $color_fg) $text
else
set -a prompt_string (set_color -b $color)(set_color $prev_color)$prompt_sep_a(set_color $color_fg) $text
end
set prev_color $color
end
function prompt.git
git rev-parse 2>/dev/null || return
git status --porcelain -bu | while read line
if string match -qr "^##" "$line"
set git_branch (string match -r "\ (.+)\.\.\." "$line")[2]
string match -qr "\[behind" $line && set git_branch "$git_branch?"
string match -qr "\[ahead" $line && set git_branch "$git_branch!"
prompt.add "$color_git_branch" "$git_branch"
else
string match -qr "^.[MD]" "$line" && set git_count[1] (math $git_count[1] + 1)
string match -qr "^[MDARC]." "$line" && set git_count[2] (math $git_count[2] + 1)
string match -qr "^\?\?" "$line" && set git_count[3] (math $git_count[3] + 1)
string match -qr "^[ADU]{2}" "$line" && set git_count[4] (math $git_count[4] + 1)
end
end
test -n "$git_count[1]" && prompt.add "$color_git[1]" "~$git_count[1]"
test -n "$git_count[2]" && prompt.add "$color_git[2]" "+$git_count[2]"
test -n "$git_count[3]" && prompt.add "$color_git[3]" "!$git_count[3]"
test -n "$git_count[4]" && prompt.add "$color_git[4]" "*$git_count[4]"
end
function fish_prompt
set -g prompt_string
set -g prev_color
prompt.add blue (pwd)
prompt.git
prompt.add normal $prompt_bang
echo $prompt_string
set -e prompt_string
end
# Commands to run in interactive sessions can go here
end

30
fish/fish_variables Normal file
View file

@ -0,0 +1,30 @@
# This file contains fish universal variable definitions.
# VERSION: 3.0
SETUVAR __fish_initialized:3100
SETUVAR fish_color_autosuggestion:555\x1ebrblack
SETUVAR fish_color_cancel:\x2dr
SETUVAR fish_color_command:005fd7
SETUVAR fish_color_comment:990000
SETUVAR fish_color_cwd:green
SETUVAR fish_color_cwd_root:red
SETUVAR fish_color_end:009900
SETUVAR fish_color_error:ff0000
SETUVAR fish_color_escape:00a6b2
SETUVAR fish_color_history_current:\x2d\x2dbold
SETUVAR fish_color_host:normal
SETUVAR fish_color_host_remote:yellow
SETUVAR fish_color_normal:normal
SETUVAR fish_color_operator:00a6b2
SETUVAR fish_color_param:00afff
SETUVAR fish_color_quote:999900
SETUVAR fish_color_redirection:00afff
SETUVAR fish_color_search_match:bryellow\x1e\x2d\x2dbackground\x3dbrblack
SETUVAR fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack
SETUVAR fish_color_status:red
SETUVAR fish_color_user:brgreen
SETUVAR fish_color_valid_path:\x2d\x2dunderline
SETUVAR fish_key_bindings:fish_default_key_bindings
SETUVAR fish_pager_color_completion:\x1d
SETUVAR fish_pager_color_description:B3A06D\x1eyellow
SETUVAR fish_pager_color_prefix:normal\x1e\x2d\x2dbold\x1e\x2d\x2dunderline
SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan