Skip to content

agoodshort/telescope-git-submodules.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

features.mp4

Features

  • 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

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

  • Support additional terminal plugins (e.g., nvim-terminal)
  • Add the option to point :diffviewOpen to origin/HEAD

Acknowledgements

Inspired by lazygit.nvim