agoodshort / telescope-git-submodules.nvim

Telescope extension for git submodules
MIT License
16 stars 2 forks source link

telescope-git-submodules.nvim

A customizable telescope.nvim extension to list the git submodules of your current project and interact with them through the git TUI of your choice through toggleterm.nvim.

https://github.com/agoodshort/telescope-git-submodules.nvim/assets/33832653/5d13113f-16a2-40f7-91e4-816827234240

Features

Installation

Using lazy.nvim

return {
    "nvim-telescope/telescope.nvim",
    dependencies = {
        {
            "agoodshort/telescope-git-submodules.nvim",
            dependencies = "akinsho/toggleterm.nvim",
        },
    },
    config = function()
        require("telescope").load_extension("git_submodules")
    end,
}

Configuration

The extension comes with the following defaults:

require("telescope").setup({
    extensions = {
        git_submodules = {
            git_cmd = "lazygit",
            previewer = true,
            terminal_id = 9,
            terminal_display_name = "Lazygit",
            diffview_keymap = "<C-d>",
        },
    },
})

Extension Specs

Property Type Default Value Description
git_cmd string? "lazygit" git TUI command of your choice
previewer boolean? true Preview submodule changes in Telescope
terminal_id number? 9 Terminal ID toggleterm will use
terminal_display_name string? "Lazygit" Terminal display name toggleterm will use
diffview_keymap string? "" Keymap to trigger :diffviewOpen -C<path> for the highlighted submodule

Plugin integration

nvim-unception

The extension integrates pretty well (at least from my personal experience) with nvim-unception, if the same terminal_id value is used in both configurations. Example in agoodshort's nvim-unception configuration

diffview.nvim

If you have diffview.nvim, you can use the diffview_keymap to trigger :diffviewOpen -C<path> for the highlighted submodule.

Roadmap

Acknowledgements

Inspired by lazygit.nvim