Theme Edan: Update with optional "user & host" info (Usually for a remote host).

Switch using `edan-remote` or `edan-local`
pull/2/head
Amio 10 years ago
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.
![Screenshot of edan theme](https://cloud.githubusercontent.com/assets/215282/2869575/7bd3f828-d278-11e3-91ce-7ff84a5ea1b0.png)
![Screenshot of theme Edan](https://cloud.githubusercontent.com/assets/215282/5837282/b02c0e5c-a1b8-11e4-914f-f4f05e99880a.png)
#### 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)

@ -0,0 +1,5 @@
# Switch environment to "local" for edan.
function edan-local
set -U EDAN_HOST_TYPE "local"
end

@ -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…
Cancel
Save