home: vim: switch to 'lualine'
This commit is contained in:
parent
213d698d56
commit
605da54f24
|
@ -31,8 +31,8 @@ in
|
|||
|
||||
plugins = with pkgs.vimPlugins; [
|
||||
# Theming
|
||||
lightline-vim # Fancy status bar
|
||||
vim-gruvbox8 # Nice dark theme
|
||||
lualine-nvim # A lua-based status line
|
||||
|
||||
# tpope essentials
|
||||
vim-commentary # Easy comments
|
||||
|
@ -64,7 +64,6 @@ in
|
|||
git-messenger-vim # A simple blame window
|
||||
|
||||
# LSP and linting
|
||||
lightline-lsp
|
||||
lsp_lines-nvim # Show diagnostics *over* regions
|
||||
null-ls-nvim # LSP integration for linters and formatters
|
||||
(nvim-treesitter.withPlugins (_: pkgs.tree-sitter.allGrammars)) # Better highlighting
|
||||
|
|
|
@ -1,85 +0,0 @@
|
|||
" Initialise light-line setting structure
|
||||
let g:lightline={}
|
||||
|
||||
" Use the wombat colorscheme
|
||||
let g:lightline.colorscheme='wombat'
|
||||
|
||||
" Status-line for active buffer
|
||||
let g:lightline.active={
|
||||
\ 'left': [
|
||||
\ [ 'mode', 'paste' ],
|
||||
\ [ 'gitbranch', 'readonly', 'filename', 'modified' ],
|
||||
\ [ 'spell' ],
|
||||
\ ],
|
||||
\ 'right': [
|
||||
\ [ 'lineinfo' ],
|
||||
\ [ 'percent' ],
|
||||
\ [ 'fileformat', 'fileencoding', 'filetype' ],
|
||||
\ [ 'linter_errors', 'linter_warnings', 'linter_infos', 'linter_hints', 'linter_ok' ],
|
||||
\ [ 'ctags_status' ],
|
||||
\ ]
|
||||
\ }
|
||||
|
||||
" Status-line for inactive buffer
|
||||
let g:lightline.inactive={
|
||||
\ 'left': [
|
||||
\ [ 'filename' ],
|
||||
\ ],
|
||||
\ 'right': [
|
||||
\ [ 'lineinfo' ],
|
||||
\ [ 'percent' ],
|
||||
\ ],
|
||||
\ }
|
||||
|
||||
" Which component should be written using which function
|
||||
let g:lightline.component_function={
|
||||
\ 'readonly': 'LightlineReadonly',
|
||||
\ 'modified': 'LightlineModified',
|
||||
\ 'gitbranch': 'LightlineFugitive',
|
||||
\ }
|
||||
|
||||
" Which component can be expanded by using which function
|
||||
let g:lightline.component_expand={
|
||||
\ 'linter_hints': 'lightline#lsp#hints',
|
||||
\ 'linter_infos': 'lightline#lsp#infos',
|
||||
\ 'linter_warnings': 'lightline#lsp#warnings',
|
||||
\ 'linter_errors': 'lightline#lsp#errors',
|
||||
\ 'linter_ok': 'lightline#lsp#ok',
|
||||
\ }
|
||||
|
||||
" How to color custom components
|
||||
let g:lightline.component_type={
|
||||
\ 'readonly': 'error',
|
||||
\ 'linter_hints': 'right',
|
||||
\ 'linter_infos': 'right',
|
||||
\ 'linter_warnings': 'warning',
|
||||
\ 'linter_errors': 'error',
|
||||
\ 'linter_ok': 'right',
|
||||
\ }
|
||||
|
||||
" Show pretty icons instead of text for linting status
|
||||
let g:lightline#lsp#indicator_hints='🔍'
|
||||
let g:lightline#lsp#indicator_infos='ℹ'
|
||||
let g:lightline#lsp#indicator_warnings='◆'
|
||||
let g:lightline#lsp#indicator_errors='✗'
|
||||
let g:lightline#lsp#indicator_ok='✓'
|
||||
|
||||
|
||||
" Show a lock icon when editing a read-only file when it makes sense
|
||||
function! LightlineReadonly()
|
||||
return &ft!~?'help\|vimfiler\|netrw' && &readonly ? '🔒' : ''
|
||||
endfunction
|
||||
|
||||
" Show a '+' when the buffer is modified, '-' if not, when it makes sense
|
||||
function! LightlineModified()
|
||||
return &ft=~'help\|vimfiler\|netrw' ? '' : &modified ? '+' : &modifiable ? '' : '-'
|
||||
endfunction
|
||||
|
||||
" Show branch name with nice icon in status line, when it makes sense
|
||||
function! LightlineFugitive()
|
||||
if &ft!~?'help\|vimfiler\|netrw' && exists('*fugitive#head')
|
||||
let branch=fugitive#head()
|
||||
return branch!=#'' ? ' '.branch : ''
|
||||
endif
|
||||
return ''
|
||||
endfunction
|
63
home/vim/plugin/settings/lualine.vim
Normal file
63
home/vim/plugin/settings/lualine.vim
Normal file
|
@ -0,0 +1,63 @@
|
|||
lua << EOF
|
||||
local lualine = require("lualine")
|
||||
local utils = require("ambroisie.utils")
|
||||
|
||||
local function list_spell_languages()
|
||||
if not vim.opt.spell:get() then
|
||||
return ""
|
||||
end
|
||||
|
||||
return table.concat(vim.opt.spelllang:get(), ", ")
|
||||
end
|
||||
|
||||
local function list_lsp_clients()
|
||||
local client_names = utils.list_lsp_clients()
|
||||
|
||||
if #client_names == 0 then
|
||||
return ""
|
||||
end
|
||||
|
||||
return "[ " .. table.concat(client_names, " ") .. " ]"
|
||||
end
|
||||
|
||||
lualine.setup({
|
||||
options = {
|
||||
icons_enabled = false,
|
||||
section_separators = "",
|
||||
component_separators = "|",
|
||||
},
|
||||
sections = {
|
||||
lualine_a = {
|
||||
{ "mode" },
|
||||
},
|
||||
lualine_b = {
|
||||
{ "branch" },
|
||||
{ "filename", symbols = { readonly = "🔒" } },
|
||||
},
|
||||
lualine_c = {
|
||||
{ list_spell_languages },
|
||||
},
|
||||
lualine_x = {
|
||||
{ list_lsp_clients },
|
||||
{
|
||||
"diagnostics",
|
||||
-- Only use the diagnostics API
|
||||
sources = { "nvim_diagnostic" },
|
||||
},
|
||||
},
|
||||
lualine_y = {
|
||||
{ "fileformat" },
|
||||
{ "encoding" },
|
||||
{ "filetype" },
|
||||
},
|
||||
lualine_z = {
|
||||
"location",
|
||||
},
|
||||
},
|
||||
extensions = {
|
||||
"fugitive",
|
||||
"fzf",
|
||||
"quickfix",
|
||||
},
|
||||
})
|
||||
EOF
|
Loading…
Reference in a new issue