Ответ на сообщение «Re: Error: E315, keepjumps, scrolloff», присланное в 17:39:41 20 февраля 2010, Суббота, отправитель Bram Moolenaar:
Could you try this script:
bug.sh:
=================================================================
vim -u NONE -c 'source bug.vim'
cat testoutput 2>/dev/null && echo "Bug exists!" || echo "No bug"
rm -f testoutput
=================================================================
bug.vim:
=================================================================
set nocompatible
set foldmethod=marker
set scrolloff=3
let s:bugmsg="It's a bug b=%i, so=%i"
let s:bugs=[]
function ScrollOffBug()
try
normal! H
catch /.*/
let s:bugs+=[printf(s:bugmsg, bufnr('%'), &scrolloff)]
call writefile(s:bugs, "testoutput")
endtry
endfunction
au BufEnter * call ScrollOffBug()
insert
abc
def
.
new
insert
abc
.
close!
normal! G
bnext!
normal! G
bnext!
qa!
" vim: ft=vim
=================================================================
Tested with vim-7.2.303.
Текст сообщения:
> Marko Mahnic wrote:
> > Error: E315, keepjumps, scrolloff
> >
> > " To Reproduce:
> > " Add this file to plugins; start Vim.
> > " Open file A (eg. 100) lines and B (eg. 200) lines
> > " Do G on both files
> > " When switching from B to A (longer to shorter) the message
> > " It's a bug ... should appear (in :messages)
> > "
> > " The error caught is E315 on the line 'let toppos=line('.')
> > "
> > " The (funny) solution is:
> > " let &scrolloff=&scrolloff
> > " (see the code below)
> >
> > set scrolloff=3
> > function! ScrollOffBug()
> > echom "ScrollOffBug?"
> > " Solution:
> > " let &scrolloff=&scrolloff
> > try
> > let pos = line('.')
> > " error happens next:
> > keepjumps norm! H
> > let toppos = line('.')
> > catch /.*/
> > echom "It's a bug b=" . bufnr('%') . ", so=" . &scrolloff
> > endtry
> > endfunc
> >
> > au BufEnter * call ScrollOffBug()
>
> I can't reproduce it with the current Vim version. What Vim version are
> you using?
>
signature.asc
Description: This is a digitally signed message part.
