Skip to content

Leaderf git

Yggdroot edited this page Jul 2, 2024 · 42 revisions

About

Leaderf git is a plugin focused on offering a smooth, intuitive, and efficient Git experience within Vim. It helps developers enhance their productivity and streamline their workflow.

Requirements

  • git command is available.
  • Vim or Neovim supports Python.

Why

  • Ease Of Use

    Leaderf git stands out for its simplicity and ease of use. Its straightforward commands allow developers to perform Git operations directly within Vim without needing extensive learning or setup. This makes it accessible even to those who are new to Git or Vim.

  • Efficient Navigation

    Leaderf git utilizes advanced search functionalities, including fuzzy search, to rapidly locate specific commits, files, and changes within the repository. This accelerates navigation through codebases, reducing the time spent searching for relevant information.

  • Intuitive Diff View

    Leaderf git offers multiple viewing options for diffs, such as side-by-side comparisons and unified views. These features allow developers to quickly assess and understand code changes without delays, enhancing productivity during code reviews and troubleshooting.

  • High Performance

    Leaderf git is optimized for performance, handling large repositories with ease. Its asynchronous command execution and optimized algorithms ensure Git operations are executed swiftly and responsively.

Features

Leaderf git diff

usage: Leaderf[!] git diff [-h] [--cached] [--directly | --explorer] [--position <POSITION>]
                           [--navigation-position <POSITION>] [-s | -u] [--current-file]
                           [extra ...]
options:
  -h, --help            show this help message and exit
specific arguments:
  --cached, --staged    run 'git diff --cached'
  --directly            output the diffs directly
  --explorer            view changed files in a tree explorer
  --position <POSITION>
                        specifies the position of the diffs window
  --navigation-position <POSITION>
                        specifies the position of the navigation panel
  -s, --side-by-side    show diffs in a side-by-side view
  -u, --unified         show diffs in a unified view
  --current-file        show diffs of current file
  extra                 extra arguments of git diff
  • :Leaderf git diff --directly

    It is the same as running git diff in the command line.

  • :Leaderf git diff

    Fuzzy search a file to view the diffs.

Leaderf.git.diff.mp4

Use :Leaderf git diff --recall to resume the fuzzy search.
In the diff file, ]c is used to jump to the next change, [c is used to jump to the previous change, <CR> is used to jump to the corresponding file to edit it.
To customize the shortcut keys, for example,

let g:Lf_GitKeyMap = {
            \ 'previous_change': '<C-N>',
            \ 'next_change': '<C-P>',
            \ 'edit_file': 'e',
            \ }
  • :Leaderf git diff --side-by-side

    Fuzzy search a file to view the diffs in a side-by-side view.

Leaderf.git.diff.--side-by-side.mp4

In the diff file, ]c is used to jump to the next change, [c is used to jump to the previous change, <CR> is used to jump to the corresponding file to edit it.
To customize the shortcut keys, for example,

let g:Lf_GitKeyMap = {
            \ 'previous_change': '<C-N>',
            \ 'next_change': '<C-P>',
            \ 'edit_file': 'e',
            \ }
  • :Leaderf git diff --explorer

    Open an explorer tabpage to view the diffs.

Leaderf.git.diff.--explorer.mp4

Press <F1> for help.

image

In the navigation panel, type f to start a fuzzy search and type F to resume the previous fuzzy search.

fuzzy.search.mp4
  • :Leaderf git diff --explorer --unified

    View the diffs in a unified view.

image

To highlight the line numbers, :let g:Lf_GitHightlightLineNumber=1

image

In the navigation panel, type s to switch between unified view and side-by-side view.

switch.between.unified.and.side-by-side.mp4
Clone this wiki locally