Add some components: git file and mode

This commit is contained in:
Olivier Roques
2020-12-22 17:50:10 +01:00
parent 0fc3d440de
commit 778b6b1219
5 changed files with 166 additions and 0 deletions

28
lua/hardline/git.lua Normal file
View File

@@ -0,0 +1,28 @@
local fn, vim = vim.fn, vim
local g = vim.g
local M = {}
function M.get_hunks()
if not g.loaded_gitgutter then
return ''
end
local summary = fn.GitGutterGetHunkSummary()
return table.concat({
string.format('+%d', summary[1]),
string.format('~%d', summary[2]),
string.format('-%d', summary[3]),
}, ' ')
end
function M.get_branch()
return ''
end
function M.get_component()
return table.concat({
[[%{luaeval('require("hardline.git").get_hunks()')}]],
[[%{luaeval('require("hardline.git").get_branch()')}]],
})
end
return M