Skip to content

Commit a1a3c88

Browse files
DooezFabijanZulj
authored andcommitted
Added an option to use custom function for full commit view .
1 parent 59cf695 commit a1a3c88

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ These are the fields you can configure by passing them to the `require('blame').
7676
- `max_summary_width` - If date_message is used, cut the summary if it excedes this number of characters
7777
- `colors` - list of RGB strings to use instead of randomly generated RGBs for highlights
7878
- `blame_options` - list of blame options to use for git blame. If nil, then no options are used
79-
- `commit_detail_view` - string - "tab"|"split"|"vsplit"|"current" - Open commit details in a new tab, split, vsplit or current buffer
79+
- `commit_detail_view` - string or function - "tab"|"split"|"vsplit"|"current" - Open commit details in a new tab, split, vsplit or current buffer
80+
`function(commit_hash) ... end` - Calls function and passes commit hash to it
8081
- `format_fn` - format function that is used for processing of porcelain lines. See below for details
8182
( built-in: `("blame.formats.default_formats").date_message` and `("blame.formats.default_formats").commit_date_author_fn` )
8283
- `mappings` - custom mappings for various actions, you can pass in single or multiple mappings for an action.

lua/blame/views/window_view.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,10 @@ function WindowView:show_full_commit()
342342
local row, _ = unpack(vim.api.nvim_win_get_cursor(self.blame_window))
343343
local commit = self.blamed_lines[row]
344344
local view = self.config.commit_detail_view or "tab"
345+
if type(view) == 'function' then
346+
view(commit.hash)
347+
return
348+
end
345349

346350
local err_cb = function(err)
347351
vim.notify(err, vim.log.levels.INFO)

0 commit comments

Comments
 (0)