Work on fixing neovim statusline overflow

This commit is contained in:
Daniel Flanagan 2020-11-21 13:59:19 -06:00
parent 3d2b35d2f0
commit cb0a4a269c
Signed by: lytedev
GPG Key ID: 5B2020A0F9921EF4
3 changed files with 23 additions and 6 deletions

View File

@ -144,7 +144,7 @@ nnoremap <leader>t :split<CR>:term<CR>:resize 24<CR>:startinsert<CR>
tnoremap <C-w> <C-\><C-n>:q!<CR>
function! NeatFoldText()
" TODO: WIP
" TODO: finish this!
let lines_count = v:foldend - v:foldstart + 1
let foldchar = matchstr(&fillchars, 'fold:\zs.')
let foldtextstart = strpart('^' . repeat(foldchar, v:foldlevel*2) . line, 0, (winwidth(0)*2)/3)
@ -154,8 +154,8 @@ function! NeatFoldText()
endfunction
set foldtext=NeatFoldText()
" TODO: only update this portion when needed?
function! StatusLineBufferByNum(_, bufnum)
" TODO: only update this portion when needed instead of every render?
function! StatusLineBufferByNum(bufnum)
let l:prefix = '%#InactiveBuffer#'
let l:suffix = '%* '
let l:bufinfo = getbufinfo(a:bufnum)[0]
@ -171,12 +171,29 @@ endfunction
au BufReadPost * | if stridx(&ft, 'commit') >= 0 | exe "startinsert!" | endif
let l:status_line_max_length = 5
function! StatusLineBuffers()
return join(map(nvim_list_bufs(), function("StatusLineBufferByNum")), '')
let l:since_active = 0
let l:acc = []
for bufnum in nvim_list_bufs()
let l:entry = StatusLineBufferByNum(bufnum)
if l:entry =~ "^%#ActiveBuffer#"
"
endif
let l:acc = add(l:acc, l:entry)
if l:since_active > 0
let l:since_active = l:since_active + 1
endif
endfor
return join(l:acc, '')
endfunction
function! StatusLine()
return StatusLineBuffers() . '%*%=%c,%l/%L (%p%%)'
try
return StatusLineBuffers().'%*%=%c,%l/%L (%p%%)'
catch
return 'buflisterr%*%=%c,%l/%L (%p%%)'
endtry
endfunction
" set laststatus=0 showtabline tabline=%!StatusLine()

View File

@ -1,3 +1,4 @@
set -Ux NNN_OPTS EHacdrx
set -Ux NNN_COLORS 1234
set -Ux NNN_PLUG p:preview
set -Ux NNN_FCOLORS 030304020005050805030501

View File

@ -16,7 +16,6 @@ curl -s -L https://git.lyte.dev/lytedev/dotfiles/raw/branch/master/bin/init-dotf
# To Do
+ nnn FCOLORS
+ nvim statusline overflow
+ **Learn to use `journalctl`**
+ Vim sessions?