On Sat, Sep 19, 2009 at 9:15 PM, Peng  Yu <[email protected]> wrote:
>
> Hi,
>
> Suppose I am editing a python file (which is executable), I then type
> ":!python_file_name.py" to run it. I would like vim help me position
> the cursor to the error line if there is a syntax error in the python
> file.
>
> Is there a way to do it?
>

See this blog: http://www.sontek.net/post/Python-with-a-modular-IDE-(Vim).aspx

I an ftplugin/python_makeprg.vim with this contents:

----------------
if has('win32')
    set makeprg=python\ -c\ \"\"import\ py_compile,sys;\
sys.stderr=sys.stdout;\ py_compile.compile(r'%')\"\"
else
    set makeprg=python\ -c\ \"import\ py_compile,sys;\
sys.stderr=sys.stdout;\ py_compile.compile(r'%')\"
endif
set efm=%C\ %.%#,%A\ \ File\ \"%f\"\\,\ line\ %l%.%#,%Z%[%^\ ]...@=%m

python << EOL
import vim
def EvaluateCurrentRange():
    eval(compile('\n'.join(vim.current.range),'','exec'),globals())
EOL
" Evaluate the selected range.
vnoremap <buffer> <silent> <Leader>ev :py EvaluateCurrentRange()<CR>
------------

But honestly, I never used this myself so far, kind of forgot that I
even had it.

-- 
HTH,
Hari

> Regards,
> Peng
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to