1

When I have multiple buffers open in vertical splits the filename in the statusline scrolls off to the left and is no longer visible. It is visible until the left and right justified parts meet. Then, as the split window gets smaller, the whole line scrolls left and the left hand scrolls off screen. Is there a way to left justify the whole statusline? Any suggestons?

Statusline code from my .vimrc:

hi User1 term=inverse,bold cterm=inverse,bold ctermfg=red
hi User2 term=inverse,bold cterm=inverse,bold ctermfg=yellow
let g:currentmode={
       \ 'n'  : 'NORMAL',
       \ 'v'  : 'VISUAL',
       \ 'V'  : 'V·Line',
       \ "\<C-V>" : 'V·Block',
       \ 'i'  : 'INSERT',
       \ 'R'  : 'R',
       \ 'Rv' : 'V·Replace',
       \ 'c'  : 'Command',
       \}

set statusline=
set statusline+=%-f\  "Full path to the file in the buffer.
set statusline+=%1*%m "Modified flag, text is "[+]"; "[-]" if 'modifiable' is off.
set statusline+=%2*\ %{toupper(g:currentmode[mode()])}\ %*
set statusline+=%y\ 
set statusline+=[B:%n] "Buffer number.
set statusline+=%{FileSize(line2byte('$')+len(getline('$')))}
set statusline+=%= "Separation point between left and right aligned items
set statusline+=[%c/ "Column number (byte index).
set statusline+=%l "Line number
set statusline+=\ of\ %L\ (%p%%)]\  "Number of lines in buffer.
set statusline+=%{StatuslineGit()}

Screenshot with three open buffers

romainl
  • 186,200
  • 21
  • 280
  • 313
francismaile
  • 111
  • 3

0 Answers0