It's rather hacky, but it sort of works. (but then, this makes fish
compare to PHP (but PHP doesn't put that newline), so perhaps I
shouldn't do that - http://git.io/GFurbg)
I break compatibility with Mac OS X again, that I don't have access
to. Result: Stuff break, and I have to fix it, so it will perhaps
work. At least, I hope it will work.
Yes, hostname is broken under Cygwin, but for fish it's an issue, as it
makes fish_config more buggy than it needs to be (by making UTF-8 errors
according to Python).
git.git's __git_ps1 doesn't have an upstream prefix. I'm not sure why
one was added to our __fish_git_prompt, but it certainly shouldn't
default to a space.
It reuses $__fish_git_prompt_char_stateseparator, since it has a
similar meaning and goes otherwise unused when
$__fish_git_prompt_show_informative_status is set.
This changes the defaults for several characters when
$__fish_git_prompt_show_informative_status is set so that the prompt
looks more like the typical informative prompt.
Before: (master >1<2|+3#4*5%6)
After: (master↑1↓2|●3✖4✚5…6)
The defaults were taken from magicmonty/bash-git-prompt
This makes $__fish_git_prompt_show_informative_status imply
$__fish_git_prompt_showupstream = "informative", while adding a none
option for showupstream to disable it if desired.
A few characters and colors got added without being added to the event
list for repainting.
Also sort and re-align list of characters in validate_chars.
The code invoked `git rev-parse` several times when the required
information could be collected all at once.
This is based on the following commits from git.git:
efaa0c1: bash prompt: combine 'git rev-parse' executions in the main code path
e3e0b93: bash prompt: combine 'git rev-parse' for detached head
0f37c12: bash prompt: use bash builtins to check for unborn branch for dirty state
dd0b72c: bash prompt: use bash builtins to check stash state
It's a one line function called in a single place. I suspect it only
existed because the bash equivalent __gitdir existed (it was more
complex), but that function no longer exists either, as of git.git
511ad15: "bash prompt: run 'git rev-parse --git-dir' directly instead
of __gitdir()"
Simply using cut duplicates (poorly) `git rev-parse --short`
This also restores the ... printed after the abbreviation which
__fish_git_prompt had been missing.
Based on git.git e8f21ca: "bash prompt: print unique detached HEAD
abbreviated object name"
Unlike the rest of the __fish_git_prompt_char_* variables, it does not
have its own color because the most likely values are a space and
nothing.
based on git.git 15a54fb: prompt: introduce GIT_PS1_STATESEPARATOR
Adds a progress indicator to the rebase messages. (e.g. |REBASE 2/5)
based on the git-prompt portion of git.git b71dc3e: "bash-prompt.sh:
show where rebase is at when stopped"
git revert was taught to revert multiple commits, and it stores it
branch information in REVERT_HEAD just like the other *_HEAD files.
based on git.git 3ee4452: bash: teach __git_ps1 about REVERT_HEAD
Based on GIT_PS1_SHOW_COLORHINTS, it introduces more color by default
and also changes the color of the branch name based on if it is a real
branch or detached.
Based on the following commits from git.git:
9b7e776: show color hints based on state of the git tree
9b3aaf8: Fix up colored git-prompt
76c36c0: coloured git-prompt: paint detached HEAD marker in red
This is mostly useful for the next commit that will have different
colors default to different values, but it has one immediate change:
all __fish_git_prompt_color_* variables now default to
__fish_git_prompt_color instead of to nothing, as they used to.
* The original __git_ps1 function has split from the rest of
git-completion as of git.git af31a45
* Use the description for GIT_PS1_DESCRIBE_STYLE (added in git.git
50b03b0) for __fish_git_prompt_describe_style
* Update the description of __fish_git_prompt_showupstream to include
the meaning of '=' based on git.git f9db192: "Improve the
description of GIT_PS1_SHOWUPSTREAM"
* Note that the PROMPT_COMMAND versions of the command with extra
arguments don't work, in case someone used to the bash version is
looking for it.
* Note that I am updating the script so Kevin Ballard doesn't get
blamed for anything I break.
Operation and branch detection are merged together in the original
because branch information may come from different places depending on
the operation.
Merging the bare helper in helps avoid testing for the working
directory and bare status twice, both of which requires forking a new
process.
Also helps the code match the original more, which will make adding
new features easier.
Squashed commit of the following:
commit c208bc30b7747b3743212483b3dd7e3f90819f49
Merge: 97bea942633372
Author: Konrad Borowski <glitchmr@myopera.com>
Date: Fri Jul 19 09:56:12 2013 +0200
Merge branch 'command-not-found' of git://github.com/GlitchMr/fish-shell into command-not-found
commit 26333721b9
Author: Konrad Borowski <glitchmr@myopera.com>
Date: Fri Jul 19 09:55:13 2013 +0200
Fix command_not_found when not found
commit db34460bb5
Author: Konrad Borowski <glitchmr@myopera.com>
Date: Wed Jul 17 13:41:57 2013 +0200
Avoid showing standard command not found message when possible
In bash, command-not-found handler causes the standard messages to
not appear. Because of events model in fish, it isn't really an
option, so I moved the standard command not found message to
fish function. This way, the messages aren't repeated, and the
standard command not found message appears only when handler
couldn't be found.
* Added FreeBSD's pkg to __fish_print_packages
* Portmaster completes on installed packages and ports
* Options list as per fish_generate_completions, needs to be tidied
up further but will suffice for now
$git_dir was never set in __fish_git_prompt_current_branch, but used
in the case of a detached HEAD. This caused `cut -c1-7 $git_dir/HEAD`
to expand to `cut -c1-7` which then waited for input.
The code in question displays GIT_DIR! if the user is inside the .git
directory of a repository that has a working directory. Several git
commands won't work in that situation, so it's useful to warn the
user.
Normally I wouldn't bother, but it was difficult to follow the nested
if statements. Most of the file used tabs, so replaced all leading
spaces with the appropriate amount of tabs.
Relevant section lifted from scp.fish
Silenced SSH output to squash banners and failed connections
Erroneous 'and true' removed
echo (commandline -ct) is exactly the same as commandline -ct
commit 5a577d970a293afe320b6c3280c10c2bd8a1ff50
Merge: 908b07596941b3
Author: ridiculousfish <corydoras@ridiculousfish.com>
Date: Sat Jun 1 22:59:16 2013 -0700
Merge branch 'dotdir-two-chars' of git://github.com/GlitchMr/fish-shell into GlitchMr-dotdir-two-chars
commit 96941b3a92
Author: Konrad Borowski <glitchmr@myopera.com>
Date: Sat May 25 09:55:43 2013 +0200
Support BSD sed
commit 60652c2bd2
Author: Konrad Borowski <glitchmr@myopera.com>
Date: Sun May 19 10:58:40 2013 +0200
Show first two characters for dotdirs. Fixes#754.
I haven't noticed that because I tested ack in directory with one file.
After @gfxmonk sent issue #797, I have noticed the problem. This patch
fixes#797 by escaping question mark.
I recently switch from ZSH to Fish shell and noticed that this theme is slightly different to the one provided by ZSH. I edited my own using funced but thought it might be useful for other people who are used to the ZSH interface.
commit 4a9595845111bcc8d45419241f8f49bc3e8b3445
Author: Harm Aarts <harmaarts@gmail.com>
Date: Fri May 24 10:45:58 2013 +0200
use the new functions
commit 1c934ebbe65a82e92079952b15f31d3a92bc5e8f
Author: Harm Aarts <harmaarts@gmail.com>
Date: Fri May 24 10:45:21 2013 +0200
moves formatting code to the bottom in order to get it out of the way of all the colour handling
commit c62f827143c30f6810026c7e4a3d8b77178cd9a4
Author: Harm Aarts <harmaarts@gmail.com>
Date: Fri May 24 10:44:12 2013 +0200
adds helper returning whether or not there are staged files
commit 624e47cb85a7579bf284a6a7f0c9165dfa38b0ce
Author: Harm Aarts <harmaarts@gmail.com>
Date: Fri May 24 10:43:41 2013 +0200
adds helper returning whether or not the current branch is dirty
commit efc270da7b0998f564a7d2ae4ea3013ed6910e58
Author: Harm Aarts <harmaarts@gmail.com>
Date: Fri May 24 10:42:48 2013 +0200
adds helper returning whether or not a repo is bare
commit 0da668316cedb8e3fa166977be82c917ef67ad86
Author: Harm Aarts <harmaarts@gmail.com>
Date: Fri May 24 10:41:55 2013 +0200
adds helper returning current branch
commit 15cbcedc77199aea1868faee5d178d9547a4d541
Author: Harm Aarts <harmaarts@gmail.com>
Date: Fri May 24 10:41:10 2013 +0200
adds helper returning current operation
commit c3352d3e9e60bf94fd4bf412ad85d62bba4cbff8
Author: Harm Aarts <harmaarts@gmail.com>
Date: Fri May 24 10:40:20 2013 +0200
adds helper returning the git dir
commit f346e52b7814ebf1eed55f006c3bedc8ece38e3b
Author: Harm Aarts <harmaarts@gmail.com>
Date: Mon May 20 18:52:19 2013 +0200
use the fish_git_prompt_char_* variables