mirror of
https://github.com/fish-shell/fish-shell
synced 2024-11-11 15:37:24 +00:00
prompts: more concise way of getting the hostname.
This commit is contained in:
parent
35bbc1d7b7
commit
233c443694
12 changed files with 13 additions and 13 deletions
|
@ -5,7 +5,7 @@
|
|||
function fish_fallback_prompt --description "A simple fallback prompt without too much color or special characters for linux VTs"
|
||||
# Just calculate this once, to save a few cycles when displaying the prompt
|
||||
if not set -q __fish_prompt_hostname
|
||||
set -g __fish_prompt_hostname (hostname|cut -d . -f 1)
|
||||
set -g __fish_prompt_hostname (uname -n)
|
||||
end
|
||||
|
||||
set -l color_cwd
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
function fish_prompt --description "Write out the prompt"
|
||||
# Just calculate this once, to save a few cycles when displaying the prompt
|
||||
if not set -q __fish_prompt_hostname
|
||||
set -g __fish_prompt_hostname (hostname|cut -d . -f 1)
|
||||
set -g __fish_prompt_hostname (uname -n)
|
||||
end
|
||||
|
||||
set -l color_cwd
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
function fish_prompt --description "Write out the prompt"
|
||||
# Just calculate this once, to save a few cycles when displaying the prompt
|
||||
if not set -q __fish_prompt_hostname
|
||||
set -g __fish_prompt_hostname (hostname|cut -d . -f 1)
|
||||
set -g __fish_prompt_hostname (uname -n)
|
||||
end
|
||||
|
||||
set -l color_cwd
|
||||
|
|
|
@ -7,7 +7,7 @@ function fish_prompt --description 'Write out the prompt'
|
|||
|
||||
# Just calculate this once, to save a few cycles when displaying the prompt
|
||||
if not set -q __fish_prompt_hostname
|
||||
set -g __fish_prompt_hostname (hostname|cut -d . -f 1)
|
||||
set -g __fish_prompt_hostname (uname -n)
|
||||
end
|
||||
|
||||
set -l normal (set_color normal)
|
||||
|
|
|
@ -12,7 +12,7 @@ function fish_prompt --description "Write out the prompt"
|
|||
|
||||
# Just calculate this once, to save a few cycles when displaying the prompt
|
||||
if not set -q __fish_prompt_hostname
|
||||
set -g __fish_prompt_hostname (hostname|cut -d . -f 1)
|
||||
set -g __fish_prompt_hostname (uname -n)
|
||||
end
|
||||
|
||||
set -l color_cwd
|
||||
|
|
|
@ -5,7 +5,7 @@ function fish_prompt --description 'Write out the prompt, prepending the Debian
|
|||
|
||||
# Just calculate these once, to save a few cycles when displaying the prompt
|
||||
if not set -q __fish_prompt_hostname
|
||||
set -g __fish_prompt_hostname (hostname|cut -d . -f 1)
|
||||
set -g __fish_prompt_hostname (uname -n)
|
||||
end
|
||||
|
||||
if not set -q __fish_prompt_normal
|
||||
|
|
|
@ -8,7 +8,7 @@ function fish_prompt --description 'Write out the prompt'
|
|||
|
||||
# Just calculate these once, to save a few cycles when displaying the prompt
|
||||
if not set -q __fish_prompt_hostname
|
||||
set -g __fish_prompt_hostname (hostname|cut -d . -f 1)
|
||||
set -g __fish_prompt_hostname (uname -n)
|
||||
end
|
||||
|
||||
if not set -q __fish_prompt_normal
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
function fish_prompt --description 'Write out the prompt'
|
||||
# Just calculate these once, to save a few cycles when displaying the prompt
|
||||
if not set -q __fish_prompt_hostname
|
||||
set -g __fish_prompt_hostname (hostname -s)
|
||||
set -g __fish_prompt_hostname (uname -n)
|
||||
end
|
||||
|
||||
if not set -q __fish_prompt_normal
|
||||
|
|
|
@ -12,7 +12,7 @@ function fish_prompt
|
|||
printf ' at '
|
||||
|
||||
set_color magenta
|
||||
printf '%s' (hostname|cut -d . -f 1)
|
||||
printf '%s' (uname -n)
|
||||
set_color normal
|
||||
printf ' in '
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
# author: Matthias
|
||||
function fish_prompt -d "Write out the prompt"
|
||||
if test -z $WINDOW
|
||||
printf '%s%s@%s%s%s%s%s> ' (set_color yellow) (whoami) (set_color purple) (hostname|cut -d . -f 1) (set_color $fish_color_cwd) (prompt_pwd) (set_color normal)
|
||||
printf '%s%s@%s%s%s%s%s> ' (set_color yellow) (whoami) (set_color purple) (uname -n) (set_color $fish_color_cwd) (prompt_pwd) (set_color normal)
|
||||
else
|
||||
printf '%s%s@%s%s%s(%s)%s%s%s> ' (set_color yellow) (whoami) (set_color purple) (hostname|cut -d . -f 1) (set_color white) (echo $WINDOW) (set_color $fish_color_cwd) (prompt_pwd) (set_color normal)
|
||||
printf '%s%s@%s%s%s(%s)%s%s%s> ' (set_color yellow) (whoami) (set_color purple) (uname -n) (set_color white) (echo $WINDOW) (set_color $fish_color_cwd) (prompt_pwd) (set_color normal)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -13,7 +13,7 @@ function fish_prompt --description 'Write out the prompt'
|
|||
|
||||
# Host
|
||||
set_color $fish_color_host
|
||||
echo -n (hostname -s)
|
||||
echo -n (uname -n)
|
||||
set_color normal
|
||||
|
||||
echo -n ':'
|
||||
|
|
|
@ -9,5 +9,5 @@ function fish_prompt -d "Write out the prompt"
|
|||
case root toor; set prompt_symbol '#'
|
||||
case '*'; set prompt_symbol '$'
|
||||
end
|
||||
printf "[%s@%s %s%s%s]%s " $USER (hostname -s) (set_color $fish_color_cwd) $pwd (set_color normal) $prompt_symbol
|
||||
printf "[%s@%s %s%s%s]%s " $USER (uname -n) (set_color $fish_color_cwd) $pwd (set_color normal) $prompt_symbol
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue