fish-shell/share/tools/web_config/sample_prompts/nim.fish
Konrad Borowski 6c80a3461c
Add support for toor account.
Currently fish doesn't recognize toor as special. However, it's likely
that on BSD systems, fish shell will be used on toor, not on root (toor
is an intentionally existing account to use more advanced shell on, like
shell).
2014-07-30 11:55:47 +02:00

91 lines
1.8 KiB
Fish
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# name: Nim
# author: Guilhem "Nim" Saurel https://github.com/nim65s/dotfiles/
function fish_prompt
and set retc green; or set retc red
tty|grep -q tty; and set tty tty; or set tty pts
set_color $retc
if [ $tty = tty ]
echo -n .-
else
echo -n '┬─'
end
set_color -o green
echo -n [
if test $USER = root -o $USER = toor
set_color -o red
else
set_color -o yellow
end
echo -n $USER
set_color -o white
echo -n @
if [ -z "$SSH_CLIENT" ]
set_color -o blue
else
set_color -o cyan
end
echo -n (hostname)
set_color -o white
#echo -n :(prompt_pwd)
echo -n :(pwd|sed "s=$HOME=~=")
set_color -o green
echo -n ']'
set_color normal
set_color $retc
if [ $tty = tty ]
echo -n '-'
else
echo -n '─'
end
set_color -o green
echo -n '['
set_color normal
set_color $retc
echo -n (date +%X)
set_color -o green
echo -n ]
# Check if acpi exists
if not set -q __fish_nim_prompt_has_acpi
if type acpi > /dev/null
set -g __fish_nim_prompt_has_acpi ''
else
set -g __fish_nim_prompt_has_acpi '' # empty string
end
end
if test "$__fish_nim_prompt_has_acpi"
if [ (acpi -a 2> /dev/null | grep off) ]
echo -n '─['
set_color -o red
echo -n (acpi -b|cut -d' ' -f 4-)
set_color -o green
echo -n ']'
end
end
echo
set_color normal
for job in (jobs)
set_color $retc
if [ $tty = tty ]
echo -n '; '
else
echo -n '│ '
end
set_color brown
echo $job
end
set_color normal
set_color $retc
if [ $tty = tty ]
echo -n "'->"
else
echo -n '╰─>'
end
set_color -o red
echo -n '$ '
set_color normal
end