diff --git a/themes/edan/README.md b/themes/edan/README.md index a1a199e..5e06635 100644 --- a/themes/edan/README.md +++ b/themes/edan/README.md @@ -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) diff --git a/themes/edan/edan-local.fish b/themes/edan/edan-local.fish new file mode 100644 index 0000000..0a6c750 --- /dev/null +++ b/themes/edan/edan-local.fish @@ -0,0 +1,5 @@ +# Switch environment to "local" for edan. + +function edan-local + set -U EDAN_HOST_TYPE "local" +end diff --git a/themes/edan/edan-remote.fish b/themes/edan/edan-remote.fish new file mode 100644 index 0000000..f692f6c --- /dev/null +++ b/themes/edan/edan-remote.fish @@ -0,0 +1,5 @@ +# Switch environment to "remote" for edan. + +function edan-remote + set -U EDAN_HOST_TYPE 'remote' +end diff --git a/themes/edan/fish_prompt.fish b/themes/edan/fish_prompt.fish index 292bf04..8a4711c 100644 --- a/themes/edan/fish_prompt.fish +++ b/themes/edan/fish_prompt.fish @@ -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