mirror of
https://github.com/IlanCosman/tide.git
synced 2024-11-27 03:33:26 +03:00
Initial commit
This commit is contained in:
commit
366adfa35e
3
README.md
Normal file
3
README.md
Normal file
@ -0,0 +1,3 @@
|
||||
# Lean
|
||||
|
||||
A minimal Fish theme based on [Powerlevel10k](https://github.com/romkatv/powerlevel10k/)'s lean style.
|
15
fish_prompt.fish
Normal file
15
fish_prompt.fish
Normal file
@ -0,0 +1,15 @@
|
||||
function fish_prompt --description 'Write out the prompt'
|
||||
set -l last_status $status
|
||||
echo
|
||||
|
||||
echo (lean_pwd)(lean_git_prompt)
|
||||
|
||||
# Prompt character
|
||||
if test $last_status -eq 0
|
||||
set_color $fish_color_command
|
||||
else
|
||||
set_color $fish_color_error
|
||||
end
|
||||
echo -n '❯ '
|
||||
set_color $fish_color_normal
|
||||
end
|
25
install.fish
Normal file
25
install.fish
Normal file
@ -0,0 +1,25 @@
|
||||
# ------------------------Pwd------------------------
|
||||
set -U fish_prompt_pwd_dir_length 0
|
||||
set -U lean_shorten_pwd_margin 5
|
||||
set -U lean_color_end_dirs 00AFFF
|
||||
set -U lean_color_mid_dirs 0087AF
|
||||
|
||||
# ---------------------Git prompt---------------------
|
||||
set -U __fish_git_prompt_show_informative_status true
|
||||
set -U __fish_git_prompt_showstashstate true
|
||||
# -------------Symbols-------------
|
||||
set -U __fish_git_prompt_char_stateseparator ""
|
||||
set -U __fish_git_prompt_char_cleanstate ""
|
||||
set -U __fish_git_prompt_char_upstream_ahead " ⇡"
|
||||
set -U __fish_git_prompt_char_upstream_behind " ⇣"
|
||||
set -U __fish_git_prompt_char_stagedstate " +"
|
||||
set -U __fish_git_prompt_char_dirtystate ' !'
|
||||
set -U __fish_git_prompt_char_untrackedfiles ' ?'
|
||||
set -U __fish_git_prompt_char_stashstate " *"
|
||||
# --------------Colors--------------
|
||||
set -U __fish_git_prompt_color_branch 5FD700
|
||||
set -U __fish_git_prompt_color_upstream 5FD700
|
||||
set -U __fish_git_prompt_color_stagedstate D7AF00
|
||||
set -U __fish_git_prompt_color_dirtystate D7AF00
|
||||
set -U __fish_git_prompt_color_untrackedfiles 00AFFF
|
||||
set -U __fish_git_prompt_color_stashstate 5FD700
|
8
lean_git_prompt.fish
Normal file
8
lean_git_prompt.fish
Normal file
@ -0,0 +1,8 @@
|
||||
function lean_git_prompt
|
||||
set gitPrompt (fish_git_prompt)
|
||||
|
||||
set gitPrompt (string replace "(" "" $gitPrompt)
|
||||
set gitPrompt (string replace ")" "" $gitPrompt)
|
||||
|
||||
echo $gitPrompt
|
||||
end
|
61
lean_pwd.fish
Normal file
61
lean_pwd.fish
Normal file
@ -0,0 +1,61 @@
|
||||
function lean_pwd
|
||||
set pwdSplit (string split "/" (_shorten_pwd))
|
||||
set pwdSplitLength (count $pwdSplit)
|
||||
|
||||
if test $pwdSplit[1] != "~"
|
||||
set_color -o $lean_color_end_dirs
|
||||
echo -n "/"
|
||||
set_color $fish_color_normal
|
||||
else
|
||||
set_color -o $lean_color_end_dirs
|
||||
echo -n $pwdSplit[1]
|
||||
set_color $fish_color_normal
|
||||
|
||||
if test $pwdSplitLength -gt 1
|
||||
set_color $lean_color_mid_dirs
|
||||
echo -n "/"
|
||||
set_color $fish_color_normal
|
||||
end
|
||||
end
|
||||
|
||||
set_color $lean_color_mid_dirs
|
||||
echo -n (string join "/" $pwdSplit[2..-2])
|
||||
if test $pwdSplitLength -gt 2
|
||||
echo -n "/"
|
||||
end
|
||||
set_color $fish_color_normal
|
||||
|
||||
set_color -o $lean_color_end_dirs
|
||||
if test $pwdSplitLength -gt 1
|
||||
echo -n $pwdSplit[-1]
|
||||
end
|
||||
set_color $fish_color_normal
|
||||
end
|
||||
|
||||
function _shorten_pwd
|
||||
set fish_prompt_pwd_dir_length 0
|
||||
set lengthPromptPwd (string length (prompt_pwd))
|
||||
set shortenPwdLength (math $COLUMNS-$lean_shorten_pwd_margin)
|
||||
|
||||
if test $lengthPromptPwd -gt $shortenPwdLength
|
||||
set smallestAbsoluteDiff $lengthPromptPwd
|
||||
|
||||
for promptPwdDirLength in 4 5 6 7 8 9 10 0
|
||||
set fish_prompt_pwd_dir_length $promptPwdDirLength
|
||||
set lengthPromptPwd (string length (prompt_pwd))
|
||||
|
||||
if test $lengthPromptPwd -lt $shortenPwdLength
|
||||
set absoluteDiff (math "abs($shortenPwdLength-$lengthPromptPwd)")
|
||||
|
||||
if test $absoluteDiff -lt $smallestAbsoluteDiff
|
||||
set smallestAbsoluteDiff $absoluteDiff
|
||||
set bestPromptPwdDirLength $promptPwdDirLength
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
set fish_prompt_pwd_dir_length $bestPromptPwdDirLength
|
||||
end
|
||||
|
||||
echo (prompt_pwd)
|
||||
end
|
Loading…
Reference in New Issue
Block a user