feat(nvim): migrate to lualine.nvim
This commit is contained in:
parent
9ee391ac98
commit
cdf067b6a0
66
nvimrc
66
nvimrc
|
@ -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
|
||||
|
|
|
@ -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" },
|
||||
},
|
||||
})
|
Loading…
Reference in New Issue