Skip to content
Discussion options

You must be logged in to vote
---@class snacks.gitbrowse.PatchedConfig : snacks.gitbrowse.Config
---@field commit? string
---@param opts? snacks.gitbrowse.PatchedConfig
local gitbrowse = function(opts)
  opts = opts or {}
  local expand = vim.fn.expand
  vim.fn.expand = function(what, ...) ---@diagnostic disable-line
    if what == '<cword>' then
      return opts.commit or expand(what, ...)
    end
    return expand(what, ...)
  end
  Snacks.gitbrowse.open(opts)
  vim.fn.expand = expand
end
opts = {
  picker = {
    sources = {
      git_log = {
        actions = {
          gitbrowse = function(picker, item)
            gitbrowse { what = 'commit', commit = item.commit }
          end,
        },
        win = {
   …

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@rbhanot4739
Comment options

@drowning-cat
Comment options

@drowning-cat
Comment options

Answer selected by rbhanot4739
@drowning-cat
Comment options

@rbhanot4739
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants