vim-fastline

A custom lean vim statusline.
git clone https://git.sr.ht/~jbauer/vim-fastline
Log | Files | Refs | README | LICENSE

commit 73dace26d7d90c5702d3d34644e81d86eb614c9b
parent cdfaeca222a37879fb3a71c1aec0eeae68bc6d37
Author: Jake Bauer <jbauer@paritybit.ca>
Date:   Sat, 11 Sep 2021 02:45:37 -0400

Fix colors for 256-color mode

Diffstat:
Mplugin/statusline.vim | 136+++++++++++++++++++++++++++++++++++++++----------------------------------------
1 file changed, 67 insertions(+), 69 deletions(-)

diff --git a/plugin/statusline.vim b/plugin/statusline.vim @@ -1,94 +1,92 @@ " Courtesy for tutorial: https://irrellia.github.io/blogs/vim-statusline/ " Colours for the statusline -hi Base guibg=#212333 guibg=#212333 guifg=#212333 -hi Mode guibg=#82aaff guifg=#121824 gui=bold -hi Git guibg=#292d3e guifg=#929dcb -hi Filetype guibg=#292d3e guifg=#929dcb -hi LineCol guibg=#82aaff guifg=#181824 gui=bold -hi Warn guibg=#212333 guifg=#e27878 gui=bold +hi Base ctermbg=235 ctermfg=7 +hi Mode ctermbg=240 ctermfg=7 cterm=bold +hi Git ctermbg=240 ctermfg=7 +hi Filetype ctermbg=240 ctermfg=7 +hi LineCol ctermbg=235 ctermfg=7 +hi Warn ctermbg=235 ctermfg=9 cterm=bold let g:modes={ - \'n' : 'Normal ', - \'no' : 'N·Operator Pending ', - \'v' : 'Visual ', - \'V' : 'V·Line ', - \'^V' : 'V·Block ', - \'s' : 'Select ', - \'S' : 'S·Line ', - \'^S' : 'S·Block ', - \'i' : 'Insert ', - \'R' : 'Replace ', - \'Rv' : 'V·Replace ', - \'c' : 'Command ', - \'cv' : 'Vim Ex ', - \'ce' : 'Ex ', - \'r' : 'Prompt ', - \'rm' : 'More ', - \'r?' : 'Confirm ', - \'!' : 'Shell ', - \'t' : 'Terminal ' - \} + \'n' : 'Normal ', + \'no' : 'N·Operator Pending ', + \'v' : 'Visual ', + \'V' : 'V·Line ', + \'^V' : 'V·Block ', + \'s' : 'Select ', + \'S' : 'S·Line ', + \'^S' : 'S·Block ', + \'i' : 'Insert ', + \'R' : 'Replace ', + \'Rv' : 'V·Replace ', + \'c' : 'Command ', + \'cv' : 'Vim Ex ', + \'ce' : 'Ex ', + \'r' : 'Prompt ', + \'rm' : 'More ', + \'r?' : 'Confirm ', + \'!' : 'Shell ', + \'t' : 'Terminal ' + \} " Determine current mode function! CurrentMode() abort - let l:currentmode = mode() - let l:modelist = toupper(get(g:modes, l:currentmode, 'V·Block ')) - let l:current_status_mode = l:modelist - return l:current_status_mode + let l:currentmode = mode() + let l:modelist = toupper(get(g:modes, l:currentmode, 'V·Block ')) + let l:current_status_mode = l:modelist + return l:current_status_mode endfunction function! CheckModified(modi) - if a:modi == 1 - hi Modi guifg=#efefef guibg=#212333 gui=bold - hi Filename guifg=#efefef guibg=#212333 - if expand('%') == "" - return '[New File]'.'*' - else - return expand('%:t').'*' - endif - else - hi Modi guifg=#929dcb guibg=#212333 - hi Filename guifg=#929dcb guibg=#212333 - if expand('%') == "" - return '[New File]' - else - return expand('%:t') - endif - endif + if a:modi == 1 + hi Modi ctermbg=235 ctermfg=7 cterm=bold + if expand('%') == "" + return '[New File]'.'*' + else + return expand('%:t').'*' + endif + else + hi Modi ctermbg=235 ctermfg=7 cterm=NONE + if expand('%') == "" + return '[New File]' + else + return expand('%:t') + endif + endif endfunction function! CheckFileType(filetype) - if a:filetype == '' - return '-' - else - return tolower(a:filetype) - endif + if a:filetype == '' + return '-' + else + return tolower(a:filetype) + endif endfunction function! CheckRO(roflag) - if a:roflag == 0 - return '' - else - return '⊖' - endif + if a:roflag == 0 + return '' + else + return '⊖' + endif endfunction " Statusline format and layout function! StatusLine() - let statusline = "" - let statusline .= "%#Base#" - let statusline .= "%#Mode# %{CurrentMode()}" - let statusline .= "%#Warn#%( %{CheckRO(&readonly)}%w%)" - let statusline .= "%#Modi# %{CheckModified(&modified)}" - let statusline .= "%#Base#" - let statusline .= "%=" - let statusline .= "%#FileType# %{CheckFileType(&filetype)} " - let statusline .= "%#LineCol# %p%% Ln %l/%L : %c " - return statusline + let statusline = "" + let statusline .= "%#Base#" + let statusline .= "%#Mode# %{CurrentMode()}" + let statusline .= "%#Warn#%( %{CheckRO(&readonly)}%w%)" + let statusline .= "%#Modi# %{CheckModified(&modified)} " + let statusline .= "%#Base#" + let statusline .= "%=" + let statusline .= "%#FileType# %{CheckFileType(&filetype)} " + let statusline .= "%#LineCol# %p%% Ln %l/%L : %c " + return statusline endfunction " Activate the custom statusline augroup enableStatusLine - autocmd! - autocmd VimEnter * :set statusline=%!StatusLine() + autocmd! + autocmd VimEnter * set statusline=%!StatusLine() augroup END