From cdf3f1f2bdc4e57de506a9d7c55fa7e0131be692 Mon Sep 17 00:00:00 2001 From: Ben Elan Date: Mon, 25 Nov 2024 06:00:36 -0800 Subject: [PATCH] feat(snacks): add keymap to copy url from gitbrowse (#4870) ## Description Adds a `gY` keymap that copies the URL from `Snacks.gitbrowse()` to the clipboard. This is a feature in other git browse plugins like `vim-rhubarb`, so other people will probably be looking for this when migrating like I did. Let me know if you'd prefer a different key combination, thanks! ## Related Issue(s) N/A ## Screenshots N/A ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines. --- lua/lazyvim/config/keymaps.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lua/lazyvim/config/keymaps.lua b/lua/lazyvim/config/keymaps.lua index 3283b0d8..f92bcd51 100644 --- a/lua/lazyvim/config/keymaps.lua +++ b/lua/lazyvim/config/keymaps.lua @@ -144,7 +144,10 @@ if vim.fn.executable("lazygit") == 1 then end map("n", "gb", function() Snacks.git.blame_line() end, { desc = "Git Blame Line" }) -map({ "n", "x" }, "gB", function() Snacks.gitbrowse() end, { desc = "Git Browse" }) +map({ "n", "x" }, "gB", function() Snacks.gitbrowse() end, { desc = "Git Browse (open)" }) +map({"n", "x" }, "gY", function() + Snacks.gitbrowse({ open = function(url) vim.fn.setreg("+", url) end }) +end, { desc = "Git Browse (copy)" }) -- quit map("n", "qq", "qa", { desc = "Quit All" })