Monday, July 9, 2012

Re: VIM scrollbar

more test results:

I used to have this and like it:

"config 1:
set statusline=%F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [ASCII=\%03.3b]\
[HEX=\%02.2B]\ [POS=%04l,%04v]\ [%p%%]\ [LEN=%L]

now to add the statusline bar, I put following right *under* above line

"config 2
func! STL()
let stl = '%f [%{(&fenc==""?&enc:&fenc).((exists("+bomb") &&
&bomb)?",B":"")}%M%R%H%W] %y [%l/%L,%v] [%p%%]'
let barWidth = &columns - 65 " <-- wild guess
let barWidth = barWidth < 3 ? 3 : barWidth

if line('$') > 1
let progress = (line('.')-1) * (barWidth-1) / (line('$')-1)
else
let progress = barWidth/2
endif

" line + vcol + %
let pad = strlen(line('$'))-strlen(line('.')) + 3 -
strlen(virtcol('.')) + 3 - strlen(line('.')*100/line('$'))
let bar = repeat(' ',pad).' [%1*%'.barWidth.'.'.barWidth.'('
\.repeat('-',progress )
\.'%2*0%1*'
\.repeat('-',barWidth - progress - 1).'%0*%)%<]'

return stl.bar
endfun

hi def link User1 DiffAdd
hi def link User2 DiffDelete
set stl=%!STL()


I know the stl now got reset, but when I test it, I find:
previous info retrieved from config1 is still there (most part) in the
left, and my new stl bar is also there in the right, which is nice.
but the issue is:
I seems lost a bit info from config 1:
//originally with config1:
[0,0005] [66%] [LEN=15] ~/.vimrc [FORMAT=unix] [TYPE=VIM] [ASCII=032]
[HEX=20] [POS=0367,0001] [34%] [LEN=1056]

//now with addition of config2:
RLI-12720.txt_VOOM27 [utf-8,-] [voomtree> RLI-12720.txt [utf-8]
[asciidoc2] [2151/2952,1] [72%]
[----------------------------------------------------------------------------------------------------0-->

so the issue is,
1) I lost a small piece of info (the # of lines) of my original stl info,
2) currently my bar works only for the 1st 75% part of the file. as you
can see from above.

how to combile the 2? --- just use the space left by my original stl
config in the right side for the new bar config, but without trunking my
original info?

thanks!

> I used to have this one in my .vimrc (it's based on a tip by A.Politz):
> https://groups.google.com/group/vim_use/msg/e7c193ad5dc9c136
>
> regards,
> Christian
>

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: