Re: [Fish-users] Send in your prompts!
Here's mine: http://bazaar.launchpad.net/~berdario/+junk/dotfiles/view/head:/fish/prompt.fish (I make also use of workon_funcs.fish by Bruce Kroeze in the same repo) it checks for both hg and git branches, but only when the previous one is a git or hg command (thus, potentially changing the current branch) or if the pwd changed thus avoiding to launch an expensive dvcs command (otherwise noticeable if you're in a directory and keep the enter key pressed) it also adds the last exit status at the end of the prompt, if !=0 I still want to clean it up a bit though... especially the switch for the root user that I kept from the original prompt function -- 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
Re: [Fish-users] Send in your prompts!
Hi, mine is pretty simple, just customised for screen: Cheers Matthias function fish_prompt -d "Write out the prompt" if test -z $WINDOW printf '%s%s@%s%s%s%s%s> ' (set_color yellow) (whoami) (set_color purple) (hostname|cut -d . -f 1) (set_color $fish_color_cwd) (prompt_pwd) (set_color normal) else printf '%s%s@%s%s%s(%s)%s%s%s> ' (set_color yellow) (whoami) (set_color purple) (hostname|cut -d . -f 1) (set_color white) (echo $WINDOW) (set_color $fish_color_cwd) (prompt_pwd) (set_color normal) end 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
Re: [Fish-users] Send in your prompts! (double line prompt anomaly)
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 > (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 > > (mailto:guil...@saurel.me)> wrote: > > > > > > > > 2012/8/26 ridiculous_fish > > > (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: > > > > >
Re: [Fish-users] Send in your prompts!
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 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 wrote: >>> >>> 2012/8/26 ridiculous_fish 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
Re: [Fish-users] Send in your prompts! (double line prompt anomaly)
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 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 wrote: > >> > >> 2012/8/26 ridiculous_fish > >>> > >>> 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 > >>> > >>> > >>> > >>> -
Re: [Fish-users] Send in your prompts!
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 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 wrote: >> >> 2012/8/26 ridiculous_fish >>> >>> 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 >>
Re: [Fish-users] Send in your prompts!
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 wrote: > 2012/8/26 ridiculous_fish > >> 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_c
Re: [Fish-users] Send in your prompts!
2012/8/26 ridiculous_fish > 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
Re: [Fish-users] Send in your prompts!
Mine is just a lightly-modified version of the built-in prompt. It turns out the built-in prompt was actually extremely similar to my bash prompt, but without the proper colors or git status. So I just copied it, added more color support, and added git. function fish_prompt --description 'Write out the prompt' set -l last_status $status # 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 delim '>' switch $USER case root 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 set -l prompt_status if test $last_status -ne 0 if not set -q __fish_prompt_status set -g __fish_prompt_status (set_color $fish_color_status) end set prompt_status "$__fish_prompt_status [$last_status]$__fish_prompt_normal" end if not set -q __fish_prompt_user set -g __fish_prompt_user (set_color $fish_color_user) end if not set -q __fish_prompt_host set -g __fish_prompt_host (set_color $fish_color_host) end echo -n -s "$__fish_prompt_user" "$USER" "$__fish_prompt_normal" @ "$__fish_prompt_host" "$__fish_prompt_hostname" "$__fish_prompt_normal" ' ' "$__fish_prompt_cwd" (prompt_pwd) (__fish_git_prompt) "$__fish_prompt_normal" "$prompt_status" "$delim" ' ' end function __fish_repaint_user --on-variable fish_color_user --description "Event handler, repaint when fish_color_user changes" if status --is-interactive set -e __fish_prompt_user commandline -f repaint ^/dev/null end end function __fish_repaint_host --on-variable fish_color_host --description "Event handler, repaint when fish_color_host changes" if status --is-interactive set -e __fish_prompt_host commandline -f repaint ^/dev/null end end function __fish_repaint_status --on-variable fish_color_status --description "Event handler; repaint when fish_color_status changes" if status --is-interactive set -e __fish_prompt_status commandline -f repaint ^/dev/null end end # initialize our new variables # in theory this would be in a fish_prompt event, but this file isn't sourced # until the fish_prompt function is called anyway. if not set -q __prompt_initialized_2 set -U fish_color_user -o green set -U fish_color_host -o cyan set -U fish_color_status red set -U __prompt_initialized_2 end On Aug 26, 2012, at 1:39 PM, ridiculous_fish wrote: > 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.