feat(neovim): replace lightline with lualine.nvim

This commit is contained in:
Felix Schröter 2022-03-30 02:13:42 +02:00
parent 2f159358e3
commit 3133316f6e
Signed by: felschr
GPG key ID: 671E39E6744C807D
3 changed files with 8 additions and 56 deletions

View file

@ -18,7 +18,7 @@ in {
editorconfig-nvim
direnv-vim
fzf-vim
lightline-vim
lualine-nvim
nvim-tree-lua
toggleterm-nvim
vim-startify
@ -60,7 +60,7 @@ in {
vimLua (lib.foldl (r: f: r + "\n" + readFile f) "" [
./init.lua
./startify.lua
./lightline.lua
./lualine.lua
./which-key.lua
./gitsigns.lua
./test.lua

View file

@ -1,54 +0,0 @@
function LspStatus()
local sl = ""
if not vim.tbl_isempty(vim.lsp.buf_get_clients(0)) then
local errors = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.ERROR })
local warnings = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.WARN })
local infos = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.INFO })
local hints = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.HINT })
if (errors > 0 or warnings > 0 or infos > 0 or hints > 0) then
if errors > 0 then
sl = sl .. "" .. errors
end
if warnings > 0 then
sl = sl .. "" .. warnings
end
if infos > 0 then
sl = sl .. "" .. infos
end
if hints > 0 then
sl = sl .. "" .. hints
end
else
sl = sl .. ""
end
end
return sl
end
function GitStatus()
local status = vim.b.gitsigns_status
return status ~= nil and status or ""
end
vim.g.lightline = {
colorscheme = "powerline",
active = {
left = {
{ "mode", "paste" },
{ "lspstatus", "readonly", "filename", "gitstatus", "modified" },
},
},
component_expand = {
lspstatus = "{ -> luaeval('LspStatus()')}",
gitstatus = "{ -> luaeval('GitStatus()')}",
},
}
-- update on lsp status changes
vim.cmd([[
augroup lightline_diagnostics
autocmd!
autocmd User LspProgressUpdate call lightline#update()
autocmd DiagnosticChanged * call lightline#update()
augroup END
]])

View file

@ -0,0 +1,6 @@
require("lualine").setup {
options = {
component_separators = { left = "", right = ""},
section_separators = { left = "", right = ""},
},
}