hernancerm / zsh-git

Ease using Git in the terminal.

Repository from Github https://github.comhernancerm/zsh-gitRepository from Github https://github.comhernancerm/zsh-git

zsh-git

Zsh plugin leveraging fzf to ease using Git in the terminal.

Demo showing listing status files and picking the Git HEAD:

asciicast

Usage

While on the shell, press ctrl+g to start fzf. Pick from one of the options with enter.

Installation

Without a plugin manager

  1. Install fzf, e.g., using Homebrew: brew install fzf.

  2. Clone the zsh-git repository by executing the below command:

    git clone 'https://github.com/hernancerm/zsh-git.git' \
      "${HOME}/.zsh-git/zsh-git"
    
  3. 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.
    
  4. Start a new shell.

With a plugin manager

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).

Integration with other Zsh plugins

  • jeffreytse/zsh-vi-mode (ZVM). Binding ctrl+g is done inside a specific ZVM function, as below. Do not call zg_setup_widget when integrating with ZVM.

    function zvm_after_init {
      zg_zvm_setup_widget
    }
    

Optional configuration

Optional configuration is provided through parameters.

Zsh parametersAllowed values Default valueDescription
ZG_KEY_MAP_START bindkey key map^g Show menu options in fzf. Default: ctrl+g.

About

Ease using Git in the terminal.

License:MIT License


Languages

Language:Shell 100.0%