From 0194740d284185e196364d0d08b7b83c554366e8 Mon Sep 17 00:00:00 2001 From: hoob3rt <41551030+hoob3rt@users.noreply.github.com> Date: Mon, 4 Jan 2021 00:37:49 +0100 Subject: [PATCH] added signify component (#18) --- README.md | 21 ++++++++++++--------- lua/lualine/components/signify.lua | 10 ++++++++++ 2 files changed, 22 insertions(+), 9 deletions(-) create mode 100644 lua/lualine/components/signify.lua diff --git a/README.md b/README.md index 5258846..7ac0cff 100644 --- a/README.md +++ b/README.md @@ -116,14 +116,17 @@ lualine.inactiveSections = {
Available components -* branch -* encoding -* fileformat -* filename -* filetype -* location -* mode -* progress +* general + * branch + * encoding + * fileformat + * filename + * filetype + * location + * mode + * progress +* plugin + * signify
@@ -249,7 +252,7 @@ Please create an issue/ pr if you want to see more functionality implemented - [ ] [liuchengxu/vista.vim](https://github.com/liuchengxu/vista.vim) - [ ] [preservim/tagbar](https://github.com/preservim/tagbar) - Plugin Components - - [ ] [vim-signify](https://github.com/mhinz/vim-signify) + - [x] [vim-signify](https://github.com/mhinz/vim-signify) - Diagnostics - [ ] nvim-lsp status support - [ ] [coc.nvim](https://github.com/neoclide/coc.nvim) diff --git a/lua/lualine/components/signify.lua b/lua/lualine/components/signify.lua new file mode 100644 index 0000000..4726a4a --- /dev/null +++ b/lua/lualine/components/signify.lua @@ -0,0 +1,10 @@ +local function signify() + if vim.fn.exists('*sy#repo#get_stats') == 0 then return '' end + local added, modified, removed = unpack(vim.fn['sy#repo#get_stats']()) + if added == -1 then added = 0 end + if modified == -1 then modified = 0 end + if removed == -1 then removed = 0 end + return '+' .. added .. ' ~'.. modified .. ' -' .. removed +end + +return signify