lint: fish_indent all sample prompts

This commit is contained in:
Kurtis Rader 2016-11-01 19:19:45 -07:00
parent e73226d7e8
commit c10952c354
17 changed files with 399 additions and 397 deletions

View File

@ -39,29 +39,10 @@ function fish_prompt -d "Write out the prompt"
set git_info "(git$git_status$git_branch"(set_color white)")" set git_info "(git$git_status$git_branch"(set_color white)")"
end end
set_color -b black set_color -b black
printf '%s%s%s%s%s%s%s%s%s%s%s%s%s'\ 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) (echo $PWD | sed -e "s|^$HOME|~|") (set_color white) $git_info (set_color white) '❱' (set_color white)
(set_color -o white) \
'❰' \
(set_color green) \
$USER \
(set_color white) \
'❙' \
(set_color yellow) \
(echo $PWD | sed -e "s|^$HOME|~|") \
(set_color white) \
$git_info \
(set_color white) \
'❱' \
(set_color white)
if test $laststatus -eq 0 if test $laststatus -eq 0
printf "%s✔%s≻%s " \ printf "%s✔%s≻%s " (set_color -o green) (set_color white) (set_color normal)
(set_color -o green)\
(set_color white) \
(set_color normal)
else else
printf "%s✘%s≻%s " \ printf "%s✘%s≻%s " (set_color -o red) (set_color white) (set_color normal)
(set_color -o red) \
(set_color white) \
(set_color normal)
end end
end end

View File

@ -36,9 +36,12 @@ function fish_prompt --description 'Write out the prompt'
# initialize our new variables # initialize our new variables
if not set -q __fish_classic_git_prompt_initialized if not set -q __fish_classic_git_prompt_initialized
set -qU fish_color_user; or set -U fish_color_user -o green set -qU fish_color_user
set -qU fish_color_host; or set -U fish_color_host -o cyan or set -U fish_color_user -o green
set -qU fish_color_status; or set -U fish_color_status red set -qU fish_color_host
or set -U fish_color_host -o cyan
set -qU fish_color_status
or set -U fish_color_status red
set -U __fish_classic_git_prompt_initialized set -U __fish_classic_git_prompt_initialized
end end
end end

View File

@ -11,10 +11,17 @@ function fish_prompt --description 'Write out the prompt, prepending the Debian
end end
# Set variable identifying the chroot you work in (used in the prompt below) # Set variable identifying the chroot you work in (used in the prompt below)
if begin; not set -q debian_chroot; and test -r /etc/debian_chroot; end if begin
not set -q debian_chroot
and test -r /etc/debian_chroot
end
set debian_chroot (cat /etc/debian_chroot) set debian_chroot (cat /etc/debian_chroot)
end end
if begin; not set -q __fish_debian_chroot_prompt; and set -q debian_chroot; and test -n $debian_chroot; end if begin
not set -q __fish_debian_chroot_prompt
and set -q debian_chroot
and test -n $debian_chroot
end
set -g __fish_debian_chroot_prompt "($debian_chroot)" set -g __fish_debian_chroot_prompt "($debian_chroot)"
end end

View File

@ -2,8 +2,11 @@
# author: Guilhem "Nim" Saurel https://github.com/nim65s/dotfiles/ # author: Guilhem "Nim" Saurel https://github.com/nim65s/dotfiles/
function fish_prompt function fish_prompt
and set retc green; or set retc red and set retc green
tty|string match -q -r tty; and set tty tty; or set tty pts or set retc red
tty | string match -q -r tty
and set tty tty
or set tty pts
set_color $retc set_color $retc
if [ $tty = tty ] if [ $tty = tty ]

View File

@ -14,7 +14,8 @@ function fish_prompt
end end
function _is_git_repo function _is_git_repo
type -q git; or return 1 type -q git
or return 1
git status -s >/dev/null ^/dev/null git status -s >/dev/null ^/dev/null
end end
@ -27,7 +28,8 @@ function fish_prompt
end end
function _is_hg_repo function _is_hg_repo
type -q hg; or return 1 type -q hg
or return 1
hg summary >/dev/null ^/dev/null hg summary >/dev/null ^/dev/null
end end

View File

@ -2,8 +2,10 @@
# author: Ivan Tham <ivanthamjunhoe@gmail.com> # author: Ivan Tham <ivanthamjunhoe@gmail.com>
function fish_prompt function fish_prompt
test $SSH_TTY; and printf (set_color red)$USER(set_color brwhite)'@'(set_color yellow)(prompt_hostname)' ' test $SSH_TTY
test $USER = 'root'; and echo (set_color red)"#" and printf (set_color red)$USER(set_color brwhite)'@'(set_color yellow)(prompt_hostname)' '
test $USER = 'root'
and echo (set_color red)"#"
# Main # Main
echo -n (set_color cyan)(prompt_pwd) (set_color red)''(set_color yellow)''(set_color green)' ' echo -n (set_color cyan)(prompt_pwd) (set_color red)''(set_color yellow)''(set_color green)' '
@ -11,7 +13,8 @@ end
function fish_right_prompt function fish_right_prompt
# last status # last status
test $status != 0; and printf (set_color red)"⏎ " test $status != 0
and printf (set_color red)"⏎ "
if git rev-parse ^/dev/null if git rev-parse ^/dev/null
# Magenta if branch detached else green # Magenta if branch detached else green
@ -23,7 +26,8 @@ function fish_right_prompt
git name-rev --name-only HEAD git name-rev --name-only HEAD
# Merging state # Merging state
git merge -q ^ /dev/null; or printf ':'(set_color red)'merge' git merge -q ^/dev/null
or printf ':'(set_color red)'merge'
printf ' ' printf ' '
# Symbols # Symbols

View File

@ -6,8 +6,10 @@ function fish_prompt -d "Write out the prompt"
set -l pwd (echo -n $PWD | sed "s/^$home_escaped/~/" | sed 's/ /%20/g') set -l pwd (echo -n $PWD | sed "s/^$home_escaped/~/" | sed 's/ /%20/g')
set -l prompt_symbol '' set -l prompt_symbol ''
switch $USER switch $USER
case root toor; set prompt_symbol '#' case root toor
case '*'; set prompt_symbol '$' set prompt_symbol '#'
case '*'
set prompt_symbol '$'
end end
printf "[%s@%s %s%s%s]%s " $USER (prompt_hostname) (set_color $fish_color_cwd) $pwd (set_color normal) $prompt_symbol printf "[%s@%s %s%s%s]%s " $USER (prompt_hostname) (set_color $fish_color_cwd) $pwd (set_color normal) $prompt_symbol
end end