Skip to content

Commit

Permalink
fix(snacks): git browse for custom gitlab
Browse files Browse the repository at this point in the history
  • Loading branch information
konradmalik committed Dec 10, 2024
1 parent 94e3e63 commit 6ccc076
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions config/native/plugin/snacks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,16 @@ snacks.setup({
bigfile = { enabled = true },
gitbrowse = {
config = function(opts, _)
table.insert(
opts.remote_patterns,
{ "repositories%.gitlab%.cerebredev", "gitlab.cerebredev" }
)
opts.url_patterns["gitlab.cerebredev.com"] = {
branch = "/-/tree/{branch}",
file = "/-/blob/{branch}/{file}#L{line}",
}
table.insert(opts.remote_patterns, { "repositories%.gitlab%.cerebredev", "gitlab.cerebredev" })
opts.url_patterns["gitlab%.cerebredev%.com"] = opts.url_patterns["gitlab%.com"]
end,
},
})

local opts_with_desc = function(desc) return { desc = "[snacks] " .. desc } end
local opts_with_desc = function(desc)
return { desc = "[snacks] " .. desc }
end

vim.keymap.set(
"n",
"<leader>go",
snacks.gitbrowse.open,
opts_with_desc("open current file in the browser")
)
vim.keymap.set({ "n", "v" }, "<leader>go", snacks.gitbrowse.open, opts_with_desc("open current file in the browser"))

vim.keymap.set("n", "grf", snacks.rename.rename_file, opts_with_desc("Rename current file"))

0 comments on commit 6ccc076

Please sign in to comment.