On 01/11/12 19:38, Marc Weber wrote:
2) find a fast way to prefix each line with its own line position as %
value? Thus if you have 4 lines it should be:
0 %
50 %
100 %
In those cases I tend to write a stupid .vim file and source it:
fun! Prefix()
let max = line('$')
for i in range(0, max)
let s = getline(i)
call setilne (percent_value . s)
endfor
endf
call Prefix()
Would take me 30secs to one minute to write. If you don't know VimL
much.. Why not just write your own perl script and pipe the buffer?
This could even be shortened to
:%s@^@\=printf('%-3i %%', (line('.')*100/line('$')))
or
:%s@^@\=printf('%-3i %%', ((line('.')-1)*100/(line('$')-1)))
depending on whether you want to start at 0% or the first
percentage increment. It took me about 30 seconds to write, plus
an extra 30 seconds to find
what printf's "align left" modifier was ("-").
-tim
--
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