Benji Fisher wrote:

>     It looks as though you have already put a lot of work into this
> approach, but have you considered using quickfix mode?
>
> :help quickfix

Although I knew in general of the quickfix approach, I hadn't looked at in particular for this problem, because what I'm doing is an extension of other work (actually this is a small part of getting the python intepreter to run code "as I type", IOW, tring to get vim to act as a specialised front end to the python interpreter).

But I don't see the quickfix as being appropriate, because the python interpreter does not produce a list of errors, rather it throws an exception on the first, you fix that, then get the next, ...

Anyway back on the main line - adding a redraw at the approriate time is the 
fix.

I add the eval into your example, like this:

:python << EOF
import vim
def normal(command):
        vim.command('normal %s' % command)
normal('100G01l')
cw = vim.current.window
print cw.cursor
normal('1G01l')
print cw.cursor
x = vim.eval('input("Enter some stuff")')
print cw.cursor
EOF

then I see:

(100,1)
(1,1)
Enter some stuff
(1,1)


But - despite the (1,1) being shown before the "Enter some stuff", it looks like we are still down the end of the file when I answer the question.

Adding the redraw, like this:

:python << EOF
import vim
def normal(command):
        vim.command('normal %s' % command)
normal('100G01l')
cw = vim.current.window
print cw.cursor
normal('1G01l')
print cw.cursor
vim.command('redraw')
x = vim.eval('input("Enter some stuff")')
print cw.cursor
EOF

Then I see the screen change to line 1 when the "Enter some stuff" shown.


Thanks for the help.

--
Alan

Reply via email to