Hi,

Here's mine, it is basically the edited stock prompt without the userid check 
(since root on my boxes still use /bin/bash) and with git branch info.

One small little nit-pick is the use of "(hostname|cut -d . -f 1)" in the stock 
prompts. Why run 2 commands when one should suffice ? - hostname -s (don't know 
whether this is because -s is non-standard). Anyways, here it is:

Name: lonetwin

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)
    end

    if not set -q __fish_prompt_normal
        set -g __fish_prompt_normal (set_color normal)
    end

    if not set -q __fish_prompt_cwd
        set -g __fish_prompt_cwd (set_color $fish_color_cwd)
    end

    echo -n -s "$USER" @ "$__fish_prompt_hostname" ' ' "$__fish_prompt_cwd" 
(prompt_pwd) (__fish_git_branch_prompt) "$__fish_prompt_normal" '> '

end

On Tuesday 28 August 2012 02:42 PM, Dave King wrote:
> Here's mine. I will be updating it once I've stolen ideas from here though!
> 
> davbo's - Simple Pythonista Prompt
> 
> # Prompt {{{
> 
> set normal (set_color normal)
> set magenta (set_color magenta)
> set yellow (set_color yellow)
> set green (set_color green)
> set gray (set_color -o black)
> 
> 
> function fish_prompt
>      set_color yellow
>      printf '%s' (whoami)
>      set_color normal
>      printf ' at '
> 
>      set_color magenta
>      printf '%s' (hostname|cut -d . -f 1)
>      set_color normal
>      printf ' in '
> 
>      set_color $fish_color_cwd
>      printf '%s' (prompt_pwd)
>      set_color normal
> 
>      # Line 2
>      echo
>      if test $VIRTUAL_ENV
>          printf "(%s) " (set_color blue)(basename $VIRTUAL_ENV)(set_color 
> normal)
>      end
>      printf '↪ '
>      set_color normal
> end
> 
> # }}}
> 
> note; I partly copied this from here iirc
> https://bitbucket.org/sjl/dotfiles/src/5dd290b11084/fish/config.fish
> 
> On 27 August 2012 16:53, David Frascone <d...@frascone.com> wrote:
>> Here's mine -- mostly stock, but adds last command return code:
>>
>> function fish_prompt --description 'Write out the prompt'
>>      # Save our status
>>      set -l last_status $status
>>
>>      set -l last_status_string ""
>>      if [ $last_status -ne 0 ]
>>          printf "%s(%d)%s " (set_color red --bold) $last_status (set_color
>> normal)
>>      end
>>
>>      # 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)
>>      end
>>
>>      if not set -q __fish_prompt_normal
>>          set -g __fish_prompt_normal (set_color normal)
>>      end
>>
>>      set -l user_prompt '>'
>>      switch $USER
>>          # Set our root colors, if we're root :)
>>          case root
>>              set user_prompt '#'
>>              if not set -q __fish_prompt_cwd
>>                  if set -q fish_color_cwd_root
>>                      set -g __fish_prompt_cwd (set_color
>> $fish_color_cwd_root)
>>                  else
>>                      set -g __fish_prompt_cwd (set_color $fish_color_cwd)
>>                  end
>>              end
>>          case '*'
>>              if not set -q __fish_prompt_cwd
>>                  set -g __fish_prompt_cwd (set_color $fish_color_cwd)
>>              end
>>      end
>>      #printf '%s@%s %s%s%s# ' $USER $__fish_prompt_hostname
>> "$__fish_prompt_cwd" (prompt_pwd) "$__fish_prompt_normal"
>>      #printf "LAST STATUS STRING: $last_status_string \n"
>>      printf '%s@%s %s%s%s%s%s ' $USER $__fish_prompt_hostname
>> "$__fish_prompt_cwd" (prompt_pwd) "$__fish_prompt_normal" $user_prompt
>>
>> end
>>
>> function fish_title
>>      echo $_ ' ' (prompt_pwd)
>> end
>>
>>
>> On Sun, Aug 26, 2012 at 5:06 PM, Guilhem Saurel <guil...@saurel.me> wrote:
>>>
>>> 2012/8/26 ridiculous_fish <corydo...@ridiculousfish.com>
>>>>
>>>> Hello fellow fish fans,
>>>>
>>>> I'm working on a prompt editor, which will include a bunch of sample
>>>> prompts that the user can preview and then use (or edit). I'd like to
>>>> include real prompts contributed by real users, showing the range possible
>>>> prompts.
>>>>
>>>> If you're willing, please send me the following:
>>>>
>>>> - Your fish_prompt function, or file if it contains multiple functions
>>>> - A suggested short name for it, hopefully descriptive ("Minimalist",
>>>> "Git Savvy" ), or evocative ("Lotus Blossom"), or failing that, your name 
>>>> is
>>>> fine ("Richards")
>>>> - If you like, an attribution line ("John Doe's prompt -
>>>> http://www.mysite.com";)
>>>>
>>>> You can send it directly to me at corydo...@ridiculousfish.com, or post
>>>> it to the list if you want to strut your stuff.
>>>>
>>>> For the record, here's my prompt, which I'm calling "Minimalist" (but may
>>>> change it if we get a bunch of minimalist prompts):
>>>>
>>>> function fish_prompt
>>>>          set_color $fish_color_cwd
>>>>          echo -n (basename $PWD)
>>>>          set_color normal
>>>>          echo -n ' ) '
>>>> end
>>>>
>>>> Thanks for any and all contributions!
>>>>
>>>> _fish
>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Live Security Virtual Conference
>>>> Exclusive live event will cover all the ways today's security and
>>>> threat landscape has changed and how IT managers can respond. Discussions
>>>> will include endpoint security, mobile security and the latest in malware
>>>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>>>> _______________________________________________
>>>> Fish-users mailing list
>>>> Fish-users@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/fish-users
>>>
>>>
>>>
>>> Hello,
>>>
>>> Here is mine !
>>>
>>> Name: Nim
>>> Attribution line: Guilhem "Nim" Saurel −
>>> https://github.com/nim65s/dotfiles/
>>>
>>> It changes differents colors when the return of the last command is not 0,
>>> when you are root, and/or when you are in ssh.
>>> It also detects when you are in a tty and use ASCII instead of UTF-8, and
>>> shows some informations about battery and background jobs when useful.
>>>
>>> -----------------------------
>>> function fish_prompt
>>>      and set retc green; or set retc red
>>>      tty|grep -q tty; and set tty tty; or set tty pts
>>>
>>>      set_color $retc
>>>      if [ $tty = tty ]
>>>          echo -n .-
>>>      else
>>>          echo -n '┬─'
>>>      end
>>>      set_color -o green
>>>      echo -n [
>>>      if [ $USER = root ]
>>>          set_color -o red
>>>      else
>>>          set_color -o yellow
>>>      end
>>>      echo -n $USER
>>>      set_color -o white
>>>      echo -n @
>>>      if [ -z "$SSH_CLIENT" ]
>>>          set_color -o blue
>>>      else
>>>          set_color -o cyan
>>>      end
>>>      echo -n (hostname)
>>>      set_color -o white
>>>      #echo -n :(prompt_pwd)
>>>      echo -n :(pwd|sed "s=$HOME=~=")
>>>      set_color -o green
>>>      echo -n ']'
>>>      set_color normal
>>>      set_color $retc
>>>      if [ $tty = tty ]
>>>          echo -n '-'
>>>      else
>>>          echo -n '─'
>>>      end
>>>      set_color -o green
>>>      echo -n '['
>>>      set_color normal
>>>      set_color $retc
>>>      echo -n (date +%X)
>>>      set_color -o green
>>>      echo -n ]
>>>      if [ (acpi -a 2> /dev/null | grep off) ]
>>>          echo -n '─['
>>>          set_color -o red
>>>          echo -n (acpi -b|cut -d' ' -f 4-)
>>>          set_color -o green
>>>          echo -n ']'
>>>      end
>>>      echo
>>>      set_color normal
>>>      for job in (jobs)
>>>          set_color $retc
>>>          if [ $tty = tty ]
>>>              echo -n '; '
>>>          else
>>>              echo -n '│ '
>>>          end
>>>          set_color brown
>>>          echo $job
>>>      end
>>>      set_color normal
>>>      set_color $retc
>>>      if [ $tty = tty ]
>>>          echo -n "'->"
>>>      else
>>>          echo -n '╰─>'
>>>      end
>>>      set_color -o red
>>>      echo -n '$ '
>>>      set_color normal
>>> end
>>> -----------------------------
>>>
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Live Security Virtual Conference
>>> Exclusive live event will cover all the ways today's security and
>>> threat landscape has changed and how IT managers can respond. Discussions
>>> will include endpoint security, mobile security and the latest in malware
>>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>>> _______________________________________________
>>> Fish-users mailing list
>>> Fish-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/fish-users
>>>
>>
>>
>> ------------------------------------------------------------------------------
>> Live Security Virtual Conference
>> Exclusive live event will cover all the ways today's security and
>> threat landscape has changed and how IT managers can respond. Discussions
>> will include endpoint security, mobile security and the latest in malware
>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>> _______________________________________________
>> Fish-users mailing list
>> Fish-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/fish-users
>>
> 
> 
> 


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to