fish config

This commit is contained in:
Fabian Becker 2023-12-10 16:16:59 +01:00
parent 33031165b5
commit 6085f0ffb8
4 changed files with 106 additions and 0 deletions

View File

@ -0,0 +1 @@
source ~/.asdf/asdf.fish

11
.config/fish/config.fish Normal file
View File

@ -0,0 +1,11 @@
if status is-interactive
# Commands to run in interactive sessions can go here
end
function multicd
echo cd (string repeat -n (math (string length -- $argv[1]) - 1) ../)
end
abbr --add dotdot --regex '^\.\.+$' --function multicd
abbr -a -- gst 'git status'
abbr -a -- gca 'git commit --amend'
abbr -a -- gpf 'git push -f'
abbr -a -- gp 'git pull'

View File

@ -0,0 +1,43 @@
# This file contains fish universal variable definitions.
# VERSION: 3.0
SETUVAR __fish_initialized:3400
SETUVAR fish_color_autosuggestion:4c566a
SETUVAR fish_color_cancel:\x2d\x2dreverse
SETUVAR fish_color_command:81a1c1
SETUVAR fish_color_comment:434c5e
SETUVAR fish_color_cwd:green
SETUVAR fish_color_cwd_root:red
SETUVAR fish_color_end:88c0d0
SETUVAR fish_color_error:ebcb8b
SETUVAR fish_color_escape:00a6b2
SETUVAR fish_color_history_current:\x2d\x2dbold
SETUVAR fish_color_host:normal
SETUVAR fish_color_host_remote:\x1d
SETUVAR fish_color_keyword:\x1d
SETUVAR fish_color_match:\x2d\x2dbackground\x3dbrblue
SETUVAR fish_color_normal:normal
SETUVAR fish_color_operator:00a6b2
SETUVAR fish_color_option:\x1d
SETUVAR fish_color_param:eceff4
SETUVAR fish_color_quote:a3be8c
SETUVAR fish_color_redirection:b48ead
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_background:\x1d
SETUVAR fish_pager_color_completion:normal
SETUVAR fish_pager_color_description:B3A06D
SETUVAR fish_pager_color_prefix:normal\x1e\x2d\x2dbold\x1e\x2d\x2dunderline
SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan
SETUVAR fish_pager_color_secondary_background:\x1d
SETUVAR fish_pager_color_secondary_completion:\x1d
SETUVAR fish_pager_color_secondary_description:\x1d
SETUVAR fish_pager_color_secondary_prefix:\x1d
SETUVAR fish_pager_color_selected_background:\x2d\x2dbackground\x3dbrblack
SETUVAR fish_pager_color_selected_completion:\x1d
SETUVAR fish_pager_color_selected_description:\x1d
SETUVAR fish_pager_color_selected_prefix:\x1d
SETUVAR fish_user_paths:/opt/homebrew/bin

View File

@ -0,0 +1,51 @@
function fish_prompt --description 'Write out the prompt'
set -l laststatus $status
set -l git_info
if set -l git_branch (command git symbolic-ref HEAD 2>/dev/null | string replace refs/heads/ '')
set git_branch (set_color -o blue)"$git_branch"
set -l git_status
if not command git diff-index --quiet HEAD --
if set -l count (command git rev-list --count --left-right $upstream...HEAD 2>/dev/null)
echo $count | read -l ahead behind
if test "$ahead" -gt 0
set git_status "$git_status"(set_color red)
end
if test "$behind" -gt 0
set git_status "$git_status"(set_color red)
end
end
for i in (git status --porcelain | string sub -l 2 | sort | uniq)
switch $i
case "."
set git_status "$git_status"(set_color green)
case " D"
set git_status "$git_status"(set_color red)
case "*M*"
set git_status "$git_status"(set_color green)
case "*R*"
set git_status "$git_status"(set_color purple)
case "*U*"
set git_status "$git_status"(set_color brown)
case "??"
set git_status "$git_status"(set_color red)
end
end
else
set git_status (set_color green):
end
set git_info "(git$git_status$git_branch"(set_color white)")"
end
# Disable PWD shortening by default.
set -q fish_prompt_pwd_dir_length
or set -lx fish_prompt_pwd_dir_length 0
set_color -b black
printf '%s%s%s%s%s%s%s%s%s%s%s%s%s' (set_color -o white) '❰' (set_color green) $USER (set_color white) '❙' (set_color yellow) (prompt_pwd) (set_color white) $git_info (set_color white) '❱' (set_color white)
if test $laststatus -eq 0
printf "%s✔%s≻%s " (set_color -o green) (set_color white) (set_color normal)
else
printf "%s✘%s≻%s " (set_color -o red) (set_color white) (set_color normal)
end
end