Switch to lightline for a more personalised statusline config

This commit is contained in:
Danielle McLean 2023-10-11 00:15:05 +11:00
parent 2d7395391e
commit 652817cca5
Signed by: 00dani
GPG key ID: 52C059C3B22A753E
2 changed files with 37 additions and 7 deletions

View file

@ -8,6 +8,13 @@ def EnsureDir(dir: string): void
endif
enddef
def PrependIfVisible(status: string, symbol: string): string
if empty(status)
return ''
endif
return symbol .. status
enddef
# These are really clever - minpac will actually be loaded on the fly only
# when you need to update or clean your packages, rather than all the time.
command! PackUpdate source $XDG_CONFIG_HOME/vim/plugins.vim | minpac#update()
@ -28,12 +35,39 @@ if has('gui_running') || has('termguicolors')
set termguicolors
endif
g:battery#component_format = '%s %v%%'
set noshowmode
g:lightline = {
colorscheme: 'gruvbox8',
separator: {left: "\ue0b0", right: "\ue0b2"},
subseparator: {left: "\ue0b1", right: "\ue0b3"},
active: {
left: [['mode', 'paste'], ['git_branch', 'battery'], ['readonly', 'filename', 'modified']],
right: [['lineinfo'], ['percent'], ['fileencoding', 'filetype']],
},
component: {
filetype: '%{&ft}[%{&ff}]',
lineinfo: '%3l:%-2c',
},
component_function: {
battery: 'battery#component',
},
component_funcref: {
git_branch: () => g:FugitiveHead()->PrependIfVisible(' '),
}
}
# Allow Funcrefs, especially lambdas, to be used as lightline components. :)
for k in keys(g:lightline.component_funcref)
g:lightline.component_function[k] = $'lightline.component_funcref.{k}'
endfor
set background=dark
g:gruvbox_transp_bg = 1
g:gruvbox_italicize_strings = 0
g:gruvbox_filetype_hi_groups = 1
g:gruvbox_plugin_hi_groups = 1
g:airline_theme = 'gruvbox8'
colorscheme gruvbox8
inoremap jj <Esc>
@ -77,9 +111,6 @@ if exists('+undofile')
set undodir=$XDG_STATE_HOME/vim/undo
endif
g:airline_powerline_fonts = 1
g:airline#extensions#battery#enabled = 1
g:csv_no_conceal = 1
g:vim_svelte_plugin_use_typescript = 1

View file

@ -14,7 +14,7 @@ minpac#add('k-takata/minpac', {type: 'opt'})
minpac#add('tpope/vim-sensible')
minpac#add('prabirshrestha/async.vim')
minpac#add('lifepillar/vim-gruvbox8', {type: 'opt'})
minpac#add('lifepillar/vim-gruvbox8')
minpac#add('direnv/direnv.vim')
minpac#add('editorconfig/editorconfig-vim')
@ -46,8 +46,7 @@ minpac#add('w0rp/ale')
minpac#add('yegappan/lsp')
minpac#add('00dani/SchemaStore.vim')
minpac#add('vim-airline/vim-airline')
minpac#add('vim-airline/vim-airline-themes')
minpac#add('itchyny/lightline.vim')
minpac#add('lambdalisue/battery.vim')
minpac#add('alvan/vim-closetag')