Dealing with gitHub repositories from Neovim.
Three commands:
The commands will prompt you for infos if/when necessary
Default keybindings:
<leader>gcclone a repo<leader>gvview the cloned repos in telescope<leader>gkfork, branch then create a worktree
Viewing the folder of clones is done with telescope
The telescope previewer shows the README.md of the current repo.
The telescope picker opens the folder containing the selected clone.
See usage for more details. See screenshots See installation
TBD support other git hubs than github
- nvim-lua/plenary.nvim
- nvim-telescope/telescope.nvim
gitavailable in your$PATH
Add the plugin to your LazyVim spec so dependencies load automatically.
return {
{
"cognominal/git-download-browse.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-telescope/telescope.nvim",
},
config = function()
require("git-download-browse").setup({
reposDir = vim.fn.expand("~/git"),
keymaps = {
browse = "<leader>gv",
clone = "<leader>gc",
fork = "<leader>gk",
},
})
end,
},
}For LazyVim, drop the spec into lua/plugins/git-download-browse.lua
(or any
plugin file under lua/plugins). LazyVim will pick it up automatically.
:CloneGitRepo user/repoor:CloneGitRepo https://github.com/user/repoclones the repository (shallow) into<reposDir>/user---repo.- If you omit the argument, the command falls back to the clipboard contents
(
+register first, then*). When the cursor is on such a string within double quotes. You can paste the string usingyi"
- If you omit the argument, the command falls back to the clipboard contents
(
:GitReposopens the Telescope picker listing downloaded repositories and switches Neovim's local directory (:lcd) to the selected entry when you confirm.:GitFork [path|user/repo](or the default<leader>gk) forks the current repository using GitHub CLI, adds aforkremote, and creates a new worktree underforked_dir. Branch names start atforkedand gain numeric suffixes if needed.- The default
keymaps.browseopens the picker (<leader>gv),keymaps.cloneclones a repo (<leader>gc), andkeymaps.forkforks the current repo (<leader>gk). Set any mapping tofalse/nilor override them insidesetup()to rebind. - Change
reposDirinsetup()to control where repositories are stored. The folder (and missing parents) is created automatically duringsetup().
The picker previews project READMEs when available; otherwise it shows a
directory listing. Entries display an initial F when a fork remote is
configured for that repository.
Run the Plenary test suite headlessly:
nvim --headless -u tests/minimal_init.lua -c "lua require('tests.run').run()"