fish: rename prompt functions
This commit is contained in:
parent
2738e8d6a9
commit
584034e053
9 changed files with 27 additions and 27 deletions
|
@ -1,4 +1,4 @@
|
||||||
function prompt.add
|
function fish_prompt.add
|
||||||
set -l text $argv[1]
|
set -l text $argv[1]
|
||||||
set -l color $argv[2]
|
set -l color $argv[2]
|
||||||
if test -n "$color"
|
if test -n "$color"
|
|
@ -1,4 +1,4 @@
|
||||||
function prompt.add.pl
|
function fish_prompt.add.pl
|
||||||
set -l color $argv[1]
|
set -l color $argv[1]
|
||||||
set -l text $argv[2]
|
set -l text $argv[2]
|
||||||
set -l sep ''
|
set -l sep ''
|
7
cli/.config/fish/functions/fish_prompt.bang.fish
Normal file
7
cli/.config/fish/functions/fish_prompt.bang.fish
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
function fish_prompt.bang
|
||||||
|
if ! string match -eq linux $TERM
|
||||||
|
fish_prompt.add \n$bang_symbol\ brblack
|
||||||
|
else
|
||||||
|
fish_prompt.add \n\#\ brred
|
||||||
|
end
|
||||||
|
end
|
4
cli/.config/fish/functions/fish_prompt.emoji.fish
Normal file
4
cli/.config/fish/functions/fish_prompt.emoji.fish
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
function fish_prompt.emoji
|
||||||
|
set emoji \U1f41f \U1f420 \U1f421
|
||||||
|
printf $emoji[(random 1 (count $emoji))]
|
||||||
|
end
|
|
@ -1,12 +1,12 @@
|
||||||
function fish_prompt
|
function fish_prompt
|
||||||
set -g prompt_string
|
set -g prompt_string
|
||||||
set -g prev_color
|
set -g prev_color
|
||||||
prompt.add \[ brblack
|
fish_prompt.add \[ brblack
|
||||||
prompt.user
|
fish_prompt.user
|
||||||
prompt.add (prompt_pwd) blue
|
fish_prompt.add (prompt_pwd) blue
|
||||||
prompt.git
|
fish_prompt.git
|
||||||
prompt.add \] brblack
|
fish_prompt.add \] brblack
|
||||||
prompt.bang
|
fish_prompt.bang
|
||||||
|
|
||||||
echo $prompt_string
|
echo $prompt_string
|
||||||
set -e prompt_string
|
set -e prompt_string
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
function prompt.git
|
function fish_prompt.git
|
||||||
set -l is_git_tree (git rev-parse --is-inside-work-tree 2>/dev/null)
|
set -l is_git_tree (git rev-parse --is-inside-work-tree 2>/dev/null)
|
||||||
string match -qe 'true' "$is_git_tree" || return
|
string match -qe 'true' "$is_git_tree" || return
|
||||||
git status --porcelain -bu | while read line
|
git status --porcelain -bu | while read line
|
||||||
|
@ -6,7 +6,7 @@ function prompt.git
|
||||||
set git_branch (string match -r '[^# .]+' "$line")
|
set git_branch (string match -r '[^# .]+' "$line")
|
||||||
string match -qr '\[behind' $line && set git_branch "$git_branch?"
|
string match -qr '\[behind' $line && set git_branch "$git_branch?"
|
||||||
string match -qr '\[ahead' $line && set git_branch "$git_branch!"
|
string match -qr '\[ahead' $line && set git_branch "$git_branch!"
|
||||||
prompt.add "$git_sign $git_branch"
|
fish_prompt.add "$git_sign $git_branch"
|
||||||
else
|
else
|
||||||
string match -qr "^.[MD]" "$line" && set git_count[1] (math $git_count[1] + 1)
|
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 "^[MDARC]." "$line" && set git_count[2] (math $git_count[2] + 1)
|
||||||
|
@ -14,8 +14,8 @@ function prompt.git
|
||||||
string match -qr "^[ADU]{2}" "$line" && set git_count[4] (math $git_count[4] + 1)
|
string match -qr "^[ADU]{2}" "$line" && set git_count[4] (math $git_count[4] + 1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
test -n "$git_count[1]" && prompt.add "$git_count[1]$git_status[1]" "$color_git[1]"
|
test -n "$git_count[1]" && fish_prompt.add "$git_count[1]$git_status[1]" "$color_git[1]"
|
||||||
test -n "$git_count[2]" && prompt.add "$git_count[2]$git_status[2]" "$color_git[2]"
|
test -n "$git_count[2]" && fish_prompt.add "$git_count[2]$git_status[2]" "$color_git[2]"
|
||||||
test -n "$git_count[3]" && prompt.add "$git_count[3]$git_status[3]" "$color_git[3]"
|
test -n "$git_count[3]" && fish_prompt.add "$git_count[3]$git_status[3]" "$color_git[3]"
|
||||||
test -n "$git_count[4]" && prompt.add "$git_count[4]$git_status[4]" "$color_git[4]"
|
test -n "$git_count[4]" && fish_prompt.add "$git_count[4]$git_status[4]" "$color_git[4]"
|
||||||
end
|
end
|
|
@ -1,5 +1,5 @@
|
||||||
function prompt.user
|
function fish_prompt.user
|
||||||
if test -n "$SSH_CONNECTION" || string match -qe root "$USER"
|
if test -n "$SSH_CONNECTION" || string match -qe root "$USER"
|
||||||
prompt.add $USER@$hostname brblack
|
fish_prompt.add $USER@$hostname brblack
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -1,7 +0,0 @@
|
||||||
function prompt.bang
|
|
||||||
if ! string match -eq linux $TERM
|
|
||||||
prompt.add \n$bang_symbol\ brblack
|
|
||||||
else
|
|
||||||
prompt.add \n\#\ brred
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,4 +0,0 @@
|
||||||
function prompt.fishes
|
|
||||||
set fishes \U1f41f \U1f420 \U1f421
|
|
||||||
printf $fishes[(random 1 (count $fishes))]
|
|
||||||
end
|
|
Loading…
Reference in a new issue