From: Felipe Contreras <hidden> Date: 2019-06-14 06:50:55
Helo,
These patches are definitely needed, and some of these have been cooking
for years in oh-my-zsh.
Felipe Contreras (5):
completion: zsh: update installation instructions
completion: zsh: fix for directories with spaces
completion: remove zsh hack
completion: zsh: improve main function selection
completion: prompt: fix color for Zsh
contrib/completion/git-completion.bash | 1 +
contrib/completion/git-completion.zsh | 33 ++++++++++++--------------
contrib/completion/git-prompt.sh | 10 ++++----
3 files changed, 22 insertions(+), 22 deletions(-)
--
2.22.0.rc2.dirty
From: Felipe Contreras <hidden> Date: 2019-06-14 06:50:57
Commit 0e5ed7cca3 wrongly changed the extension of the bash script
to .zsh. The extension doesn't really matter, but it confuses people.
I've changed the text to make it clear that your zsh script goes to
~/.zsh/_git, and the bash script to ~/.git-completion.bash (or wherever
you want).
Also, update the default locations of the system bash-completion.
Signed-off-by: Felipe Contreras <redacted>
---
contrib/completion/git-completion.zsh | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
@@ -4,17 +4,19 @@## Copyright (c) 2012-2013 Felipe Contreras <felipe.contreras@gmail.com>#-# You need git's bash completion script installed somewhere, by default it-# would be the location bash-completion uses.-#-# If your script is somewhere else, you can configure it on your ~/.zshrc:-#-# zstyle ':completion:*:*:git:*' script ~/.git-completion.zsh-## The recommended way to install this script is to copy to '~/.zsh/_git', and# then add the following to your ~/.zshrc file:## fpath=(~/.zsh $fpath)+#+# You need git's bash completion script installed. By default bash-completion+# uses /usr/share/bash-completion.+#+# If your bash completion script is somewhere else, you can configure it on+# your ~/.zshrc:+#+# zstyle ':completion:*:*:git:*' script ~/.git-completion.bash+#complete(){
@@ -31,9 +33,8 @@ if [ -z "$script" ]; thenlocalelocations=($(dirname${funcsourcetrace[1]%:*})/git-completion.bash-'/etc/bash_completion.d/git'# fedora, old debian-'/usr/share/bash-completion/completions/git'# arch, ubuntu, new debian-'/usr/share/bash-completion/git'# gentoo+'/usr/share/bash-completion/completions/git'+'/etc/bash_completion.d/git'# old debian)forein$locations;dotest-f$e&&script="$e"&&break
From: Felipe Contreras <hidden> Date: 2019-06-14 06:51:00
We don't want to override the 'complete()' function in zsh, which can be
used by bashcomp.
Reported-by: Mark Lodato <redacted>
Signed-off-by: Felipe Contreras <redacted>
---
contrib/completion/git-completion.bash | 1 +
contrib/completion/git-completion.zsh | 6 ------
2 files changed, 1 insertion(+), 6 deletions(-)
@@ -3066,6 +3066,7 @@ __git_func_wrap ()# This is NOT a public function; use at your own risk. __git_complete(){+test-n"$ZSH_VERSION"&&returnlocalwrapper="__git_wrap${2}"eval"$wrapper () { __git_func_wrap $2 ; }"complete-obashdefault-odefault-onospace-F$wrapper$12>/dev/null\
From: Felipe Contreras <hidden> Date: 2019-06-14 06:51:01
Sometimes we want to use the function directly (e.g. _git_checkout), for
example when zsh has the option 'complete_aliases', this way, we can do
something like:
compdef _git gco=git_checkout
Signed-off-by: Felipe Contreras <redacted>
---
contrib/completion/git-completion.zsh | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
From: Felipe Contreras <hidden> Date: 2019-06-14 06:51:02
We don't need PROMPT_COMMAND in Zsh; we are already using %F{color} %f,
which in turn use %{ and %}, which are the equivalent of Bash's
\[ and \].
We can use as many colors as we want and output directly into PS1
(or RPS1) without the risk of buffer wrapping issues.
Signed-off-by: Felipe Contreras <redacted>
---
contrib/completion/git-prompt.sh | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
@@ -88,7 +88,7 @@# If you would like a colored hint about the current dirty state, set# GIT_PS1_SHOWCOLORHINTS to a nonempty value. The colors are based on# the colored output of "git status -sb" and are available only when-# using __git_ps1 for PROMPT_COMMAND or precmd.+# using __git_ps1 for PROMPT_COMMAND in Bash, but always available in Zsh.## If you would like __git_ps1 to do nothing in the case when the current# directory is set up to be ignored by git, then set
@@ -506,9 +506,11 @@ __git_ps1 ()localz="${GIT_PS1_STATESEPARATOR-" "}"-# NO color option unless in PROMPT_COMMAND mode-if[$pcmode=yes]&&[-n"${GIT_PS1_SHOWCOLORHINTS-}"];then-__git_ps1_colorize_gitstring+# NO color option unless in PROMPT_COMMAND mode or it's Zsh+if[-n"${GIT_PS1_SHOWCOLORHINTS-}"];then+if[$pcmode=yes]||[-n"${ZSH_VERSION-}"];then+__git_ps1_colorize_gitstring+fifib=${b##refs/heads/}