mirror of
https://github.com/oh-my-fish/oh-my-fish.git
synced 2025-03-03 22:07:25 +08:00
Theme Edan: Update with optional "user & host" info (Usually for a remote host).
Switch using `edan-remote` or `edan-local`
This commit is contained in:
parent
c004cb57e4
commit
e237441a8b
@ -1,14 +1,14 @@
|
||||
## edan
|
||||
## Theme Edan
|
||||
|
||||
Inspired by idan, a functional, uncluttered fish theme with usability perks for git users and python developers.
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
#### Characteristics
|
||||
|
||||
##### Left Prompt
|
||||
|
||||
* User & host (hidden by default, execute `edan-remote` to show, `edan-local` to hide)
|
||||
* Current python virtualenv (if applicable)
|
||||
* Truncated CWD (just the current folder name)
|
||||
* Git branch and dirty state (if applicable)
|
||||
|
5
themes/edan/edan-local.fish
Normal file
5
themes/edan/edan-local.fish
Normal file
@ -0,0 +1,5 @@
|
||||
# Switch environment to "local" for edan.
|
||||
|
||||
function edan-local
|
||||
set -U EDAN_HOST_TYPE "local"
|
||||
end
|
5
themes/edan/edan-remote.fish
Normal file
5
themes/edan/edan-remote.fish
Normal file
@ -0,0 +1,5 @@
|
||||
# Switch environment to "remote" for edan.
|
||||
|
||||
function edan-remote
|
||||
set -U EDAN_HOST_TYPE 'remote'
|
||||
end
|
@ -1,5 +1,6 @@
|
||||
# name: iden
|
||||
# fish theme: edan
|
||||
# Display the following bits on the left:
|
||||
# * User & host (hidden by default, execute `edan-remote`to show, `edan-local` to hide)
|
||||
# * Virtualenv name (if applicable, see https://github.com/adambrenecki/virtualfish)
|
||||
# * Current directory name
|
||||
# * Git branch and dirty state (if inside a git repo)
|
||||
@ -12,8 +13,17 @@ function _is_git_dirty
|
||||
echo (command git status -s --ignore-submodules=dirty ^/dev/null)
|
||||
end
|
||||
|
||||
function _user_host
|
||||
if [ (id -u) = "0" ];
|
||||
echo -n (set_color -o red)
|
||||
else
|
||||
echo -n (set_color -o blue)
|
||||
end
|
||||
echo -n $USER°(hostname|cut -d . -f 1) (set color normal)
|
||||
end
|
||||
|
||||
function fish_prompt
|
||||
set fish_greeting ""
|
||||
set fish_greeting
|
||||
set -l cyan (set_color -o cyan)
|
||||
set -l yellow (set_color -o yellow)
|
||||
set -l red (set_color -o red)
|
||||
@ -30,7 +40,12 @@ function fish_prompt
|
||||
|
||||
# Display [venvname] if in a virtualenv
|
||||
if set -q VIRTUAL_ENV
|
||||
echo -n -s (set_color -b cyan black) '[' (basename "$VIRTUAL_ENV") ']' $normal ' '
|
||||
echo -n -s (set_color -b cyan black) '[' (basename "$VIRTUAL_ENV") ']' $normal ' '
|
||||
end
|
||||
|
||||
# Display [user & host] when on remote host
|
||||
if [ "$EDAN_HOST_TYPE" = "remote" ]
|
||||
_user_host; echo -n ': '
|
||||
end
|
||||
|
||||
# Display the current directory name
|
||||
|
Loading…
x
Reference in New Issue
Block a user