feat: Add git builtins (#240)

Conni2461 is a great coder and contributor :)
This commit is contained in:
Simon Hauser
2020-11-16 21:10:26 +01:00
committed by GitHub
parent c01b7ad024
commit 8117263027
5 changed files with 241 additions and 33 deletions

View File

@@ -338,6 +338,32 @@ previewers.vim_buffer = defaulter(function(_)
}
end, {})
previewers.git_commit_diff = defaulter(function(_)
return previewers.new_termopen_previewer {
get_command = function(entry)
local sha = entry.value
return { 'git', '--no-pager', 'diff', sha .. '^!' }
end
}
end, {})
previewers.git_branch_log = defaulter(function(_)
return previewers.new_termopen_previewer {
get_command = function(entry)
return { 'git', 'log', '--graph',
'--pretty=format:%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset',
'--abbrev-commit', '--date=relative', entry.value }
end
}
end, {})
previewers.git_file_diff = defaulter(function(_)
return previewers.new_termopen_previewer {
get_command = function(entry)
return { 'git', '--no-pager', 'diff', entry.value }
end
}
end, {})
previewers.cat = defaulter(function(opts)
local maker = get_maker(opts)