Re: Vim scripting with python
J. Clifford Dyer wrote: > Stuart D. Gathman wrote: > > On Sat, 03 Feb 2007 05:02:54 -0800, Tool69 wrote: > > > >> Does anyone have any advice, and more genraly how to script Vim with > >> Python ? > > > > :py import sys > > :py print sys.version > > :help :py > > > >> I know I can put some python functions inside my vimrc file like > >> this : > >> > >> function! My_function() > >> python << EOF > >> import vim, string > >> ...blablabla > >> EOF > >> endfunction > >> > >> but I would like to use external ".py" files. > > > > :py import myfile > > > > Use :py inside your vimrc - don't run python externally. > > Which versions of vim is this valid for? I tried ":py print 'Hello'", > and got "E319: Sorry, the command is not available in this version" It's valid for vim 5.0 and later (all official vim releases since March 1998). You have to make sure python support is enabled at build time with --enable-pythoninterp or other configure options that turn it on (check for +python in the output of ":ver" to see if a precompiled binary includes python support). -- http://mail.python.org/mailman/listinfo/python-list
Re: Vim scripting with python
"J. Clifford Dyer" <[EMAIL PROTECTED]> writes: > Which versions of vim is this valid for? I tried ":py print 'Hello'", > and got "E319: Sorry, the command is not available in this version" The ability of Vim to run Python commands is one of many optional features that can be enabled or disabled when the program is built. This allows a Vim program runtime of reasonable size (where "reasonable" is decided by the person building the program); many of the optional features are quite large, and building all of them into the program would be a poor choice. To find out what features are explicitly enabled or disabled in your Vim program, type ':version'. The feature 'python' will be listed as '+python' if enabled, '-python' if disabled. If it's disabled and you want it enabled, you'll need to rebuild Vim with that option enabled; or find someone who's done the same (preferably the same person you got your default Vim from) and install that program. -- \"If you continue running Windows, your system may become | `\ unstable." -- Microsoft, Windows 95 BSOD message | _o__) | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list
Re: Vim scripting with python
On 2007-02-12, J. Clifford Dyer <[EMAIL PROTECTED]> wrote: > Stuart D. Gathman wrote: >> On Sat, 03 Feb 2007 05:02:54 -0800, Tool69 wrote: >> Use :py inside your vimrc - don't run python externally. > > Which versions of vim is this valid for? I tried ":py print > 'Hello'", and got "E319: Sorry, the command is not available in > this version" The latest Windows build has the Python bindings included. The one I have is version 7.0. Earlier Windows binaries didn't generally have it. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list
Re: Vim scripting with python
Stuart D. Gathman wrote: > On Sat, 03 Feb 2007 05:02:54 -0800, Tool69 wrote: > >> Does anyone have any advice, and more genraly how to script Vim with >> Python ? > > :py import sys > :py print sys.version > :help :py > >> I know I can put some python functions inside my vimrc file like >> this : >> >> function! My_function() >> python << EOF >> import vim, string >> ...blablabla >> EOF >> endfunction >> >> but I would like to use external ".py" files. > > :py import myfile > > Use :py inside your vimrc - don't run python externally. Which versions of vim is this valid for? I tried ":py print 'Hello'", and got "E319: Sorry, the command is not available in this version" Cheers, Cliff -- http://mail.python.org/mailman/listinfo/python-list
Re: Vim scripting with python
Thanks Stuart, I'll take a look at it. Another thing : Is there any way to made some modification de the python.syntax file to highlight the functions call, i.e : os.popen(...) ---> "popen(...)" will be highlighted. Cheers. -- http://mail.python.org/mailman/listinfo/python-list
Re: Vim scripting with python
On Sat, 03 Feb 2007 05:02:54 -0800, Tool69 wrote: > Does anyone have any advice, and more genraly how to script Vim with > Python ? :py import sys :py print sys.version :help :py > I know I can put some python functions inside my vimrc file like > this : > > function! My_function() > python << EOF > import vim, string > ...blablabla > EOF > endfunction > > but I would like to use external ".py" files. :py import myfile Use :py inside your vimrc - don't run python externally. -- Stuart D. Gathman <[EMAIL PROTECTED]> Business Management Systems Inc. Phone: 703 591-0911 Fax: 703 591-6154 "Confutatis maledictis, flamis acribus addictis" - background song for a Microsoft sponsored "Where do you want to go from here?" commercial. -- http://mail.python.org/mailman/listinfo/python-list
Vim scripting with python
Hi, I saw several old posts speaking of vim scripting in Python. This one in particular : http://www.velocityreviews.com/forums/t351303-re-pythonising-the-vim-eg-syntax-popups-gt-vimpst.html But I didn't find where to put this "vimrc.py" on my Windows machine. My "normal" _vimrc file is in C:\Documents and Settings\my_name . Does anyone have any advice, and more genraly how to script Vim with Python ? I know I can put some python functions inside my vimrc file like this : function! My_function() python << EOF import vim, string ...blablabla EOF endfunction but I would like to use external ".py" files. Thanks. -- http://mail.python.org/mailman/listinfo/python-list