Compare commits

...

2 Commits

Author SHA1 Message Date
Rob Watson 157da03439 chore(nvim): update lualine config 2023-09-21 05:38:47 +02:00
Rob Watson cdf067b6a0 feat(nvim): migrate to lualine.nvim 2023-09-20 22:55:38 +02:00
2 changed files with 83 additions and 62 deletions

66
nvimrc
View File

@ -234,69 +234,11 @@ nmap <leader>T :Files<cr>
nmap <leader>b :Buffers<cr>
nmap <leader>rg :Rg<cr>
" Lightline configuration:
packadd! lightline.vim " https://github.com/itchyny/lightline.vim.git
set laststatus=2
" lualine.nvim
packadd! lualine.nvim " https://git.netflux.io/rob/lualine.nvim.git
packadd! nvim-web-devicons " https://github.com/nvim-tree/nvim-web-devicons.git
function! LightlineLSPErrorText()
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',
\ },
\ }
lua require "lightline_config"
" vim-gitgutter configuration
packadd! vim-gitgutter " https://github.com/airblade/vim-gitgutter.git

View File

@ -0,0 +1,79 @@
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,
},
"paste",
},
lualine_b = { "filename" },
lualine_c = {
{
"branch",
padding = { left = 0 },
},
"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 = {
{
function()
local go_status_line = vim.api.nvim_call_function("go#statusline#Show", {})
if go_status_line ~= "" then
return go_status_line
end
return vim.bo.filetype
end,
padding = { left = 1, right = 0 },
},
},
lualine_y = { { "progress", padding = { left = 1, right = 0 } } },
lualine_z = { { "location", padding = { left = 1, right = 0 } } },
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = { "filename" },
lualine_x = { { "location", padding = { right = 0 } } },
lualine_y = {},
lualine_z = {},
},
})