From oh-my-zsh: Robbyrussell theme

function _git_branch_name
  echo (git symbolic-ref HEAD ^/dev/null | sed -e 's|^refs/heads/||')
end

function _is_git_dirty
  echo (git status -s --ignore-submodules=dirty ^/dev/null)
end

function fish_prompt
  set -l cyan (set_color -o cyan)
  set -l yellow (set_color -o yellow)
  set -l red (set_color -o red)
  set -l blue (set_color -o blue)
  set -l normal (set_color normal)

  set -l arrow "$red➜ "
  set -l cwd $cyan(basename (prompt_pwd))

  if [ (_git_branch_name) ]
    set -l git_branch $red(_git_branch_name)
    set git_info "$blue git:($git_branch$blue)"

    if [ (_is_git_dirty) ]
      set -l dirty "$yellow ✗"
      set git_info "$git_info$dirty"
    end
  end

  echo -n -s $arrow $cwd $git_info $normal '>'
end



Atenciosamente,
Bruno Ferreira Pinto


On Thursday, 30 de August de 2012 at 10:52, Steven Hum wrote:

> Great idea Ridiculous!
>  
> I've always used variants of the single line prompt so took the
> opportunity to try the double line prompts provided on the list for the
> fun of it.
>  
> I noticed a curious behavior: when a command is actually invoked, the
> prompt line is actually repeated immediately below the original prompt
> line before the command is executed. A weird side effect is that the
> prompt is updated itself, so if a time is displayed, you see the actual
> time the command was launched - sorta cool.
>  
> I suspect the autocomplete/term line cleanup trickery that goes on is
> somehow connected to this double prompt display behaviour. That's my
> guess, as completion suggestions do not get cleared like they do with
> single line prompts.
>  
> Steven
> --
> On Tue, 28 Aug 2012 at 10:12am, 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 
> > (mailto: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 
> > > (mailto:guil...@saurel.me)> wrote:
> > > >  
> > > > 2012/8/26 ridiculous_fish <corydo...@ridiculousfish.com 
> > > > (mailto: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 
> > > > > (mailto: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 
> > > > > (mailto: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 
> > > > (mailto: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 (mailto:Fish-users@lists.sourceforge.net)
> > > https://lists.sourceforge.net/lists/listinfo/fish-users
> > >  
> >  
> >  
> >  
> >  
> > --  
> > - Dave
> >  
> > ------------------------------------------------------------------------------
> > 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 (mailto:Fish-users@lists.sourceforge.net)
> > https://lists.sourceforge.net/lists/listinfo/fish-users
> >  
>  
>  
> --  
> "Truth or die."
>  
> Steven Hum  
> 5 - 28 Gilmour St  
> Ottawa, ON K2P 0N3  
> email sdot...@gmail.com (mailto:sdot...@gmail.com)  
> tel 613.237.9058  
> Mobile 613.796.2484  
>  
> ------------------------------------------------------------------------------
> 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 (mailto: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