diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..06b9a8a --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 Nelson Chen + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/fish_greeting.fish b/fish_greeting.fish new file mode 100644 index 0000000..80f0157 --- /dev/null +++ b/fish_greeting.fish @@ -0,0 +1,12 @@ +# Set global color styles, for example: +# +# function test_theme_error +# set_color -o red +# end +# +# function test_theme_normal +# set_color normal +# + +function fish_greeting +end diff --git a/fish_prompt.fish b/fish_prompt.fish index 9c03087..93025fd 100644 --- a/fish_prompt.fish +++ b/fish_prompt.fish @@ -1,47 +1,34 @@ -function __caret_color - if [ $USER = "root" ] - echo -n "red" - else - echo -n "magenta" - end -end - -function __return_code - echo "unimpted" -end - function fish_prompt - echo (set_color -o cyan)(whoami)(set_color normal)(set_color yellow)@(set_color -o blue)(hostname| cut -d . -f 1)(set_color normal):(set_color -o green)(__zsh_percent_tilde)(set_color normal) - echo -n (set_color (__caret_color))(__zsh_percent_hash)' '(set_color normal) -end + set user (set_color --bold cyan)(whoami)(set_color normal) -function fish_right_prompt -d "Write out the right prompt" - echo -ns (__return_code)" "(date "+%D")" - "(date "+%T") -end + set machine (set_color --bold blue)(hostname| cut -d . -f 1)(set_color normal) -### Polyfills + set -l realhome ~ + set directory (set_color --bold green)(echo $PWD | sed -e "s|^$realhome|~|")(set_color normal) -## ZSH polyfills -# http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html + set -g __fish_git_prompt_show_informative_status 'yes' + set -g __fish_git_prompt_showcolorhints 'yes' + set color_bold_red (set_color --bold red) + set color_bold_yellow (set_color --bold yellow) + set color_bold_cyan (set_color --bold cyan) + set color_reset (set_color normal) + set -g __fish_git_prompt_char_dirtystate "$color_bold_red±$color_reset" + set -g __fish_git_prompt_char_cleanstate "$color_bold_red♥$color_reset" + set -g __fish_git_prompt_char_stagedstate "$color_bold_yellow●$color_reset" + set -g __fish_git_prompt_char_stagedstate "$color_bold_cyan…$color_reset" + set -g __fish_git_prompt_char_stateseparator ' ' + # I have *no* idea why this works. Maybe set_color just ignores the second bold? + set -g __fish_git_prompt_color_branch "--bold" "--bold" "yellow" + set color_bold_magenta (set_color --bold magenta) + set git (__fish_git_prompt "$color_bold_magenta^$color_reset%s") -# It's like prompt_pwd, but not exactly. -function __zsh_percent_tilde - pwd -end + echo -s $user (set_color yellow)'@' $machine ':' $directory $git -# $ for luser, # for superuser -function __zsh_percent_hash if [ $USER = "root" ] - echo -n "#" + set caret (set_color red ) "#" else - echo -n "\$" + set caret (set_color magenta) "\$" end + + echo -s $caret ' '(set_color normal) end - -## Oh-my-zsh polyfills -# https://github.com/robbyrussell/oh-my-zsh/blob/master/lib/git.zsh - -function __omz_git_prompt_info - echo -n "unimplemented" -end - diff --git a/fish_right_prompt.fish b/fish_right_prompt.fish new file mode 100644 index 0000000..b41482b --- /dev/null +++ b/fish_right_prompt.fish @@ -0,0 +1,11 @@ +function fish_right_prompt -d "Write out the right prompt" + set -l last_status $status + + if test $last_status -ne 0 + set_color --bold red + echo -ns $last_status ' :( ' + set_color normal + end + + echo -ns (date "+%D")" - "(date "+%l:%M %p") +end diff --git a/fish_title.fish b/fish_title.fish new file mode 100644 index 0000000..a267373 --- /dev/null +++ b/fish_title.fish @@ -0,0 +1,3 @@ +function fish_title +# Customize the title bar of the terminal window. +end