feat(nvim): migrate to lualine.nvim

This commit is contained in:
Rob Watson 2023-09-20 22:55:38 +02:00
parent 9ee391ac98
commit cdf067b6a0
2 changed files with 59 additions and 62 deletions

66
nvimrc
View File

@ -234,69 +234,11 @@ nmap <leader>T :Files<cr>
nmap <leader>b :Buffers<cr> nmap <leader>b :Buffers<cr>
nmap <leader>rg :Rg<cr> nmap <leader>rg :Rg<cr>
" Lightline configuration: " lualine.nvim
packadd! lightline.vim " https://github.com/itchyny/lightline.vim.git packadd! lualine.nvim " https://git.netflux.io/rob/lualine.nvim.git
set laststatus=2 packadd! nvim-web-devicons " https://github.com/nvim-tree/nvim-web-devicons.git
function! LightlineLSPErrorText() lua require "lightline_config"
let l:count = luaeval("vim.diagnostic.get(0, [[Error]])")
if l:count == 0
return ''
endif
return l:count . 'E'
endfunction
function! LightlineLSPWarningText()
let l:count = luaeval("vim.diagnostic.get(0, [[Warning]])")
if l:count == 0
return ''
endif
return l:count . 'W'
endfunction
function! LightlineLSPInformationText()
let l:count = luaeval("vim.diagnostic.get(0, [[Information]])")
if l:count == 0
return ''
endif
return l:count . 'I'
endfunction
let g:lightline = {
\ 'colorscheme': 'seoul256',
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'readonly', 'filename', 'modified' ],
\ [ 'gitbranch' ], ['lsperror', 'lspwarn', 'lspinfo' ] ],
\ 'right': [ ['lineinfo'], ['percent'], ['filetype'], ['gobuild'] ],
\ },
\ 'component_function': {
\ 'gobuild': 'go#statusline#Show',
\ 'gitbranch': 'FugitiveStatusline',
\ },
\ 'component_expand': {
\ 'lsperror': 'LightlineLSPErrorText',
\ 'lspwarn': 'LightlineLSPWarningText',
\ 'lspinfo': 'LightlineLSPInformationText',
\ },
\ 'component_type': {
\ 'lsperror': 'error',
\ 'lspwarn': 'warning',
\ },
\ 'mode_map': {
\ 'n' : 'N',
\ 'i' : 'I',
\ 'R' : 'R',
\ 'v' : 'V',
\ 'V' : 'V-LINE',
\ "\<C-v>": 'V-BLOCK',
\ 'c' : 'C',
\ 's' : 'S',
\ 'S' : 'S-LINE',
\ "\<C-s>": 'S-BLOCK',
\ 't': 'TERM',
\ },
\ }
" vim-gitgutter configuration " vim-gitgutter configuration
packadd! vim-gitgutter " https://github.com/airblade/vim-gitgutter.git packadd! vim-gitgutter " https://github.com/airblade/vim-gitgutter.git

View File

@ -0,0 +1,55 @@
require("nvim-web-devicons").setup({})
local mode_map = {
NORMAL = "N",
INSERT = "I",
REPLACE = "R",
COMMAND = "C",
VISUAL = "v",
["V-BLOCK"] = "V",
["V-LINE"] = "V-LINE",
}
require("lualine").setup({
options = {
icons_enabled = false,
theme = "nord",
},
sections = {
lualine_a = {
{
"mode",
fmt = function(mode)
return mode_map[mode] or mode
end,
},
},
lualine_b = { "filename" },
lualine_c = {
"branch",
"diff",
{
"diagnostics",
sources = { "nvim_lsp" },
always_visible = false,
symbols = {
error = function(count)
return count .. "E"
end,
warn = function(count)
return count .. "W"
end,
info = function(count)
return count .. "I"
end,
hint = function(count)
return count .. "H"
end,
},
},
},
lualine_x = { "filetype" },
lualine_y = { "progress" },
lualine_z = { "location" },
},
})