mrloop/telescope-git-branch.nvim

github github
git
stars 6
issues 0
subscribers 2
forks 0
CREATED

2024-07-05

UPDATED

6 months ago


telescope-git-branch

Telescope Git Branch is a Telescope extension that searches a Git branch for files which are different from the default branch, previews a diff of the changes and allows you to open files that are different from the default branch.

The telescope-git-branch.nvim extension is great for working with feature branches, where you want to easily see the differences between the default branch and the feature branch. It lets you search for differences across multiple commits on the same branch.

Installation

You can install these plugin using your favorite vim package manager, e.g. vim-plug and lazy.

lazy:

{
    'mrloop/telescope-git-branch.nvim'
}

vim-plug

Plug 'https://gitlab.com/mrloop/telescope-git-branch.nvim'

Usage

Activate the custom Telescope commands and git_branch extension by adding

require('telescope').load_extension('git_branch')

somewhere after your require('telescope').setup() call. This is typically all you need to configure the plugin.

The following Telescope extension commands are provided:

:Telescope git_branch

These commands can also be used from your init.lua.

For example, to bind files to <leader>gf use:

-- Search for the files with differences to default branch.
vim.keymap.set({'n', 'v'}, '<leader>gf', function()
    require('git_branch').files()
end)