feat(snacks): add keymap to copy url from gitbrowse (#4870)

## Description

Adds a `<leader>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.
This commit is contained in:
Ben Elan 2024-11-25 06:00:36 -08:00 committed by GitHub
parent 85e4118065
commit cdf3f1f2bd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -144,7 +144,10 @@ if vim.fn.executable("lazygit") == 1 then
end end
map("n", "<leader>gb", function() Snacks.git.blame_line() end, { desc = "Git Blame Line" }) map("n", "<leader>gb", function() Snacks.git.blame_line() end, { desc = "Git Blame Line" })
map({ "n", "x" }, "<leader>gB", function() Snacks.gitbrowse() end, { desc = "Git Browse" }) map({ "n", "x" }, "<leader>gB", function() Snacks.gitbrowse() end, { desc = "Git Browse (open)" })
map({"n", "x" }, "<leader>gY", function()
Snacks.gitbrowse({ open = function(url) vim.fn.setreg("+", url) end })
end, { desc = "Git Browse (copy)" })
-- quit -- quit
map("n", "<leader>qq", "<cmd>qa<cr>", { desc = "Quit All" }) map("n", "<leader>qq", "<cmd>qa<cr>", { desc = "Quit All" })