Zsh plugin leveraging fzf to ease using Git in the terminal.
Demo showing listing status files and picking the Git HEAD:
While on the shell, press ctrl+g to start fzf. Pick from one of the options with enter.
-
Clone the zsh-git repository by executing the below command:
git clone 'https://github.com/hernancerm/zsh-git.git' \ "${HOME}/.zsh-git/zsh-git" -
Place the below snippet at the end of your file
~/.zshrc:# ZSH-GIT - Start - <https://github.com/hernancerm/zsh-git>. source "${HOME}/.zsh-git/zsh-git/git.plugin.zsh" zg_setup_widget # ZSH-GIT - End. -
Start a new shell.
If you feel comfortable with shell scripting and plan to install other Zsh plugins, like
zsh-vi-mode, I recommend you use a shell
plugin manager like Sheldon for the
installation. Comparing this approach to the plugin-manager-less approach, the plugin
manager would be in charge of doing the git clone (step 2) and sourcing the plugin on
startup (line beginning with source from the snippet of step 3, you still need to call
zg_setup_widget).
-
jeffreytse/zsh-vi-mode (ZVM). Binding ctrl+g is done inside a specific ZVM function, as below. Do not call
zg_setup_widgetwhen integrating with ZVM.function zvm_after_init { zg_zvm_setup_widget }
Optional configuration is provided through parameters.
| Zsh parameters | Allowed values | Default value | Description |
|---|---|---|---|
ZG_KEY_MAP_START |
bindkey key map | ^g |
Show menu options in fzf. Default: ctrl+g. |