Configure gitbrowse correctly (add keybindings)
This commit is contained in:
parent
47863ba002
commit
a18ba1da61
1 changed files with 31 additions and 9 deletions
|
|
@ -1,17 +1,39 @@
|
||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
"folke/snacks.nvim",
|
'folke/snacks.nvim',
|
||||||
opts = {
|
opts = {
|
||||||
gitbrowse = {
|
gitbrowse = {
|
||||||
config = function(opts, defaults)
|
url_patterns = {
|
||||||
opts.url_patterns["bitbucket%.org"] = {
|
['bitbucket%.org'] = {
|
||||||
branch = "/src/{branch}",
|
branch = '/src/{branch}',
|
||||||
file = "/src/{branch}/{file}#lines-{line_start}:{line_end}",
|
file = '/src/{branch}/{file}#lines-{line_start}:{line_end}',
|
||||||
permalink = "/src/{commit}/{file}#lines-{line_start}:{line_end}",
|
permalink = '/src/{commit}/{file}#lines-{line_start}:{line_end}',
|
||||||
commit = "/commits/{commit}",
|
commit = '/commits/{commit}',
|
||||||
}
|
},
|
||||||
opts.what = "permalink"
|
},
|
||||||
|
what = 'permalink',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
'<leader>gB',
|
||||||
|
function()
|
||||||
|
Snacks.gitbrowse()
|
||||||
end,
|
end,
|
||||||
|
desc = '[B]rowse Git URL',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<leader>gY',
|
||||||
|
function()
|
||||||
|
Snacks.gitbrowse {
|
||||||
|
open = function(url)
|
||||||
|
vim.fn.setreg('+', url)
|
||||||
|
end,
|
||||||
|
notify = false,
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
desc = '[Y]ank Git URL',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue