Skip to content

Commit f636be2

Browse files
committed
feat: Add custom browse command support
The changes introduced in this commit allow users to specify a custom command for browsing commits in a browser. Signed-off-by: marcoSven <[email protected]>
1 parent caf2865 commit f636be2

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ Enable `show_builtin_git_pickers` to additionally show builtin git pickers.
135135

136136
```lua
137137
{
138+
-- Browse command to open commits in browser. Default fugitive GBrowse.
139+
browse_command = "GBrowse",
138140
-- fugitive or diffview
139141
diff_plugin = "fugitive",
140142
-- customize git in previewer

lua/advanced_git_search/actions.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ end
5555
---General action: Open commit in browser
5656
---@param commit_hash string
5757
M.open_in_browser = function(commit_hash)
58-
vim.api.nvim_command(":GBrowse " .. commit_hash)
58+
vim.api.nvim_command(":" .. config.get_browse_command() .. commit_hash)
5959
end
6060

6161
---General action: Checkout commit

lua/advanced_git_search/utils/config.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ local config = {}
55
M.setup = function(ext_config)
66
ext_config = ext_config or {}
77

8+
ext_config.browse_command = ext_config.browse_command or "GBrowse"
89
ext_config.diff_plugin = ext_config.diff_plugin or "fugitive"
910
ext_config.git_diff_flags = ext_config.git_diff_flags or {}
1011
ext_config.show_builtin_git_pickers = ext_config.show_builtin_git_pickers
@@ -164,4 +165,8 @@ M.show_builtin_git_pickers = function()
164165
return config["show_builtin_git_pickers"]
165166
end
166167

168+
M.get_browse_command = function()
169+
return config["browse_command"]
170+
end
171+
167172
return M

0 commit comments

Comments
 (0)