From d08c9e54773fde2a90c6fbf694994f19562b63cc Mon Sep 17 00:00:00 2001 From: sandroid Date: Thu, 29 May 2025 22:31:41 +0200 Subject: [PATCH] Docs: improve completion docs and move them to the top --- README.md | 46 ++++++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 16ec984..6db4940 100644 --- a/README.md +++ b/README.md @@ -96,6 +96,32 @@ Then add the following to your shell's config file: [AUR](https://wiki.archlinux.org/title/Arch_User_Repository) packages, maintained by the developers of forgit, are available. Install the [forgit](https://aur.archlinux.org/packages/forgit) package for the latest release or [forgit-git](https://aur.archlinux.org/packages/forgit-git) to stay up to date with the latest commits from the default branch of this repository. +# Completions + +Forgit offers completions for all supported shells. Completions are automatically configured when installing forgit through Homebrew or the AUR. All other installation methods mentioned above require manual setup for completions. The necessary steps depend on the shell you use. + +## Bash + +- Put [`completions/git-forgit.bash`](https://github.com/wfxr/forgit/blob/main/completions/git-forgit.bash) in + `~/.local/share/bash-completion/completions` to have bash tab completion for `git forgit` and configured git aliases. +- Source [`completions/git-forgit.bash`](https://github.com/wfxr/forgit/blob/main/completions/git-forgit.bash) explicitly to have + bash tab completion for forgit shell functions and aliases (e.g., `gcb ` completes branches). + +## Fish + +- Put [`completions/git-forgit.fish`](https://github.com/wfxr/forgit/blob/main/completions/git-forgit.fish) in `~/.config/fish/completions/` to have fish tab completion for `git forgit` and configured git aliases, as well as shell command aliases, such as `ga`. + +## Zsh + +- Put [`completions/_git-forgit`](completions/_git-forgit) in a directory in your `$fpath` (e.g., `/usr/share/zsh/site-functions`) to have zsh tab completion for `git forgit` and configured git aliases, as well as shell command aliases, such as `forgit::add` and `ga`. + +If you're having issues after updating, and commands such as `forgit::add` or aliases `ga` aren't working, remove your completions cache and restart your shell. + +```zsh +> rm ~/.zcompdump +> zsh +``` + # 📝 Features - **Interactive `git add` selector** (`ga`) @@ -375,26 +401,6 @@ export FORGIT_LOG_FZF_OPTS=' - [`tree`](https://gitlab.com/OldManProgrammer/unix-tree): Directory tree view for `gclean`. -# Completions - -## Bash - -- Put [`completions/git-forgit.bash`](https://github.com/wfxr/forgit/blob/main/completions/git-forgit.bash) in - `~/.local/share/bash-completion/completions` to have bash tab completion for `git forgit` and configured git aliases. -- Source [`completions/git-forgit.bash`](https://github.com/wfxr/forgit/blob/main/completions/git-forgit.bash) explicitly to have - bash tab completion for forgit shell functions and aliases (e.g., `gcb ` completes branches). - -## Zsh - -- Put [`completions/_git-forgit`](completions/_git-forgit) in a directory in your `$fpath` (e.g., `/usr/share/zsh/site-functions`) to have zsh tab completion for `git forgit` and configured git aliases, as well as shell command aliases, such as `forgit::add` and `ga` - -If you're having issues after updating, and commands such as `forgit::add` or aliases `ga` aren't working, remove your completions cache and restart your shell. - -```zsh -> rm ~/.zcompdump -> zsh -``` - # 💡 Tips - Most of the commands accept optional arguments (e.g., `glo develop`, `glo f738479..188a849b -- main.go`, `gco main`).