ahmedkhalf / project.nvim

The superior project management solution for neovim.
Apache License 2.0
1.35k stars 131 forks source link

Opening selected project in Neogit #145

Open Riyyi opened 7 months ago

Riyyi commented 7 months ago

I want to add the ability to open Neogit from the selected project in Telescope to my config. My first idea requires the ability to customize the Telescope mappings in projects.lua:

map("n", "v", my_neogit_function)
map("i", "<c-v>", my_neogit_function)

Another way would be via my own mapping, which makes a new Telescope picker. But to keep the presentation of the items the same as the extension, the create_finder function would need to be exposed, maybe something like this?

diff --git a/lua/telescope/_extensions/projects.lua b/lua/telescope/_extensions/projects.lua
index be35f4f..8d16bf9 100644
--- a/lua/telescope/_extensions/projects.lua
+++ b/lua/telescope/_extensions/projects.lua
@@ -176,5 +176,6 @@ end
 return telescope.register_extension({
   exports = {
     projects = projects,
+    create_finder = create_finder,
   },
 })

This allows me to do the folloing:

pickers.new({}, {
    finder = telescope.extensions.projects.create_finder(),
    -- etc..
}):find()

My preference would be the second option, if this change is acceptable I will make a pull request for it.