Reply to message «Re: [BUG?] Modifications of visual selection are not 
remembered during mapping execution», 
sent 15:34:12 07 July 2011, Thursday
by Bram Moolenaar:

> This is a puzzle.  Can you write this as a Vim script instead of a
> one-liner shell command?
It is already normal vimscript: equivalent to
    vim -N -u NONE -S <(<<EOF
    call setline(".", range(1000))
    function! EV()
        echom 0
        normal! gv30j
    endfunction
    vnoremap e :call EV()<CR>
    call feedkeys("V4je")
    EOF)

> Can you map something else than \e (is that
> taken literally or converted into an escape?).
Taken literally. I can, it does not matter.

> Why would the function
> be called five times, there is only one \e.
:h v_:
:h :call | /doesn't handle

Original message:
> ZyX wrote:
> > Consider the following script:
> >     vim -N -u NONE -c 'call setline(".", range(1000))' \
> >     
> >                    -c 'exe "fu! EV()\nechom 0\nnormal! gv30j\nendfu"' \
> >                    -c 'vnoremap <silent> \e :call EV()<CR>' \
> >                    -s <(<<< 'V4j\e')
> > 
> > You will see that while function EV was called 5 times (five zeroes in
> > 
> > :messages), cursor is on the line containing number 33, while it is
> > 
> > expected to be on line with number 5*30=150.
> 
> This is a puzzle.  Can you write this as a Vim script instead of a
> one-liner shell command?  Can you map something else than \e (is that
> taken literally or converted into an escape?).  Why would the function
> be called five times, there is only one \e.

Attachment: signature.asc
Description: This is a digitally signed message part.

Raspunde prin e-mail lui