omf-theme/fish_prompt.fish

96 lines
2.5 KiB
Fish
Raw Normal View History

2016-11-08 02:06:45 +00:00
# forked from Toaster https://github.com/oh-my-fish/theme-toaster
2014-05-01 09:31:46 +00:00
2016-11-08 02:06:45 +00:00
set __slavic_color_orange FD971F
set __slavic_color_blue 6EC9DD
set __slavic_color_green A6E22E
set __slavic_color_yellow E6DB7E
set __slavic_color_pink F92672
set __slavic_color_grey 554F48
set __slavic_color_white F1F1F1
set __slavic_color_purple 9458FF
set __slavic_color_lilac AE81FF
function __slavic_color_echo
2023-12-17 06:22:41 +00:00
set_color $argv[1]
if test (count $argv) -eq 2
echo -n $argv[2]
end
2014-05-01 09:31:46 +00:00
end
2016-11-08 02:06:45 +00:00
function __slavic_current_folder
2023-12-17 06:22:41 +00:00
if test $PWD = /
echo -n /
else
echo -n $PWD | grep -o -E '[^\/]+$'
end
2014-05-01 09:31:46 +00:00
end
2016-11-08 02:06:45 +00:00
function __slavic_git_status_codes
2023-12-17 06:22:41 +00:00
echo (git status --porcelain 2>/dev/null | sed -E 's/(^.{3}).*/\1/' | tr -d ' \n')
2014-05-01 09:31:46 +00:00
end
2016-11-08 02:06:45 +00:00
function __slavic_git_branch_name
2023-12-17 06:22:41 +00:00
echo (git rev-parse --abbrev-ref HEAD 2>/dev/null)
2014-05-01 09:31:46 +00:00
end
2016-11-08 02:06:45 +00:00
function __slavic_rainbow
2023-12-17 06:22:41 +00:00
if echo $argv[1] | grep -q -e $argv[3]
__slavic_color_echo $argv[2] 彡ミ
end
2014-05-01 09:31:46 +00:00
end
2016-11-08 02:06:45 +00:00
function __slavic_git_status_icons
2023-12-17 06:22:41 +00:00
set -l git_status (__slavic_git_status_codes)
2014-05-01 09:31:46 +00:00
2023-12-17 06:22:41 +00:00
__slavic_rainbow $git_status $__slavic_color_pink D
__slavic_rainbow $git_status $__slavic_color_orange R
__slavic_rainbow $git_status $__slavic_color_white C
__slavic_rainbow $git_status $__slavic_color_green A
__slavic_rainbow $git_status $__slavic_color_blue U
__slavic_rainbow $git_status $__slavic_color_lilac M
__slavic_rainbow $git_status $__slavic_color_grey '?'
2014-05-01 09:31:46 +00:00
end
2016-11-08 02:06:45 +00:00
function __slavic_git_status
2023-12-17 06:22:41 +00:00
# In git
if test -n (__slavic_git_branch_name)
2014-05-01 09:31:46 +00:00
2023-12-17 06:22:41 +00:00
__slavic_color_echo $__slavic_color_blue " ☭ "
__slavic_color_echo $__slavic_color_white (__slavic_git_branch_name)
2014-05-01 09:31:46 +00:00
2023-12-17 06:22:41 +00:00
if test -n (__slavic_git_status_codes)
__slavic_color_echo $__slavic_color_pink ' ●'
__slavic_color_echo $__slavic_color_white ' (^._.^)ノ'
__slavic_git_status_icons
else
__slavic_color_echo $__slavic_color_green ' ○'
end
2014-05-01 09:31:46 +00:00
end
end
2020-04-23 00:21:38 +00:00
function fish_mode_prompt
2023-12-17 06:22:41 +00:00
set_color $__slavic_color_lilac
printf '['
switch $fish_bind_mode
case default
set_color red
printf n
case insert
set_color green
printf i
case visual
set_color magenta
printf v
end
set_color $__slavic_color_lilac
printf '] '
2020-04-23 00:21:38 +00:00
end
function fish_prompt
2023-12-17 06:22:41 +00:00
__slavic_color_echo $__slavic_color_purple (prompt_pwd)
__slavic_git_status
2016-11-07 23:58:10 +00:00
2023-12-17 06:22:41 +00:00
echo
__slavic_color_echo $__slavic_color_pink "▶ "
2014-05-01 09:31:46 +00:00
end