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.
features.mp4
- List the git submodules of the currently opened project
- Preview the files changes for each submodule directly in Telescope
- Run the git TUI (or command) of your choice when selecting a submodule in Telescope
- Bypass Telescope if only one repo/submodule would be displayed in Telescope
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,
}
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>",
},
},
})
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 |
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
If you have diffview.nvim, you can use the diffview_keymap
to trigger :diffviewOpen -C<path>
for the highlighted submodule.
- Support additional terminal plugins (e.g., nvim-terminal)
- Add the option to point
:diffviewOpen
toorigin/HEAD
Inspired by lazygit.nvim