-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Consolidate zsh completions in one file for homebrew #340
Changes from 6 commits
039e0f5
f2390de
dae5aa0
7bc6f9e
091d2f7
167b1d0
71dd1e5
e5a5215
92f356c
b6aa5c4
7c3c28f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,10 @@ | ||
#compdef git-forgit | ||
#compdef git-forgit forgit::add forgit::branch::delete forgit::checkout::branch forgit::checkout::commit forgit::checkout::file forgit::checkout::tag forgit::cherry::pick forgit::cherry::pick::from::branch forgit::clean forgit::diff forgit::fixup forgit::log forgit::rebase forgit::reset::head forgit::revert::commit forgit::stash::show | ||
#description Utility tool for using git interactively | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. By listing all of these functions, this file will wake up and run on any of these commands, including aliases |
||
# | ||
# forgit completions for zsh | ||
# | ||
# Place this file in your $fpath (e.g. /usr/share/zsh/site-functions) to enable | ||
# tab completions for forgit as a git subcommmand. When using forgit as a shell | ||
# plugin, additionally source completions/git-forgit.zsh after | ||
# forgit.plugin.zsh to enable tab completion for shell functions and aliases. | ||
# tab completions for forgit. | ||
|
||
_git-branches() { | ||
_alternative "branches:branchname:($(git branch -a --format '%(refname:short)'))" | ||
|
@@ -99,3 +97,28 @@ _git-forgit() { | |
;; | ||
esac | ||
} | ||
|
||
# Check if forgit plugin is loaded | ||
if (( $+functions[forgit::add] )); then | ||
# We're reusing existing completion functions, so load those first | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now that we are no longer sourcing this, we no longer need to check if the plugin is loaded and can remove the if statement. Compsys will not execute this file in this case. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in this most recent version! Check it out. This still works as intended on my machine. |
||
# if not already loaded and check if completion function exists afterwards. | ||
(( $+functions[_git-add] )) || _git | ||
(( $+functions[_git-add] )) || return 1 | ||
# Completions for forgit plugin shell functions (also works for aliases) | ||
compdef _git-add forgit::add | ||
compdef _git-branches forgit::branch::delete | ||
compdef _git-branches forgit::checkout::branch | ||
compdef __git_recent_commits forgit::checkout::commit | ||
compdef _git-checkout-file forgit::checkout::file | ||
compdef __git_tags forgit::checkout::tag | ||
compdef _git-cherry-pick forgit::cherry::pick | ||
compdef _git-branches forgit::cherry::pick::from::branch | ||
compdef _git-clean forgit::clean | ||
compdef _git-forgit-diff forgit::diff | ||
compdef __git_branch_names forgit::fixup | ||
compdef _git-log forgit::log | ||
compdef _git-rebase forgit::rebase | ||
compdef _git-staged forgit::reset::head | ||
compdef __git_recent_commits forgit::revert::commit | ||
compdef _git-stash-show forgit::stash::show | ||
fi |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two files were essentially merged into a single file