473,569 Members | 2,598 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Vim scripting with python

Hi,

I saw several old posts speaking of vim scripting in Python. This one
in particular :
http://www.velocityreviews.com/forum...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_nam e .

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.

Feb 3 '07 #1
6 3951
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 <st****@bmsi.co m>
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.

Feb 3 '07 #2
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.

Feb 4 '07 #3
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
Feb 12 '07 #4
On 2007-02-12, J. Clifford Dyer <we*******@cacr adicalgrace.org 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
Feb 12 '07 #5
"J. Clifford Dyer" <we*******@cacr adicalgrace.org 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

Feb 13 '07 #6
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).

Feb 13 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2701
by: O'Neal Computer Programmer | last post by:
I was reading here: http://groups.google.com/groups?q=elemental+group:comp.lang.python.*&hl=en&lr=&ie=UTF-8&group=comp.lang.python.*&selm=mailman.1044572235.32593.python-list%40python.org&rnum=3 that a game The Temple Of Elemental Evil is going to be using python as its scripting language. It says that on the FAQ which you can read about here...
4
3775
by: The_Incubator | last post by:
As the subject suggests, I am interested in using Python as a scripting language for a game that is primarily implemented in C++, and I am also interested in using generators in those scripts... Initially I was justing looking at using Python for some event scripting. So basically an event would trigger an object to run the appropriate...
41
2771
by: Richard James | last post by:
Are we looking at the scripting world through Python colored glasses? Has Python development been sleeping while the world of scripting languages has passed us Pythonista's by? On Saturday Slashdot ran this article on the "best" scripting languages. http://developers.slashdot.org/developers/04/06/12/2125229.shtml?tid=126&tid=156 "Folks...
22
2406
by: Ajay | last post by:
hi! is there an authoritative source on the performance of scripting languages such as python vs. something like java, c, c++. its for a report, so it would be awesome if i could quote some well-known authority on this. thanks
33
2703
by: Quest Master | last post by:
I am interested in developing an application where the user has an ample amount of power to customize the application to their needs, and I feel this would best be accomplished if a scripting language was available. However, I want to code this application in Python, and I have not yet heard of an implementation of another scripting language...
80
5205
by: Bibby | last post by:
Hi, I'm interested in getting started in the programming world. I've dabbled in C, C++ and VB6. Which would be the best language to focus my attention to regarding the following considerations: Hireability Portability Flexibility The likely candidates seem to be Java, VB.Net, C, C++, C#.
6
3565
by: Wolfgang Keller | last post by:
Hello, I'm looking for a spreadsheet application (MacOS X prefered, but Windows, Linux ar available as well) with support for Python scripting (third-party "plug-ins" are ok) and a database interface. Applications that I know of (that they exist) are: MS Excel Quattro
15
4244
by: Birahim FALL | last post by:
Hi, I'm very fresh to PostgreSQL, coming from Oracle. I want to developp web applications based on apache and postgresql. Is there an equivalent of OWA server (Oracle Web Application server) for postgresql. Shortly, OWA provides an apache module and a set of stored procedures/functions that generate html pages. A simple example could be...
4
2119
by: Julian | last post by:
Hi, first of all, I have to say I am new to Python. I have been working with a finite element analysis program written in c++. now, I am trying to 'rebuild' this code (possibly a full re-write) with scripting capability. I did some reading on the web, and found that there are two ways to do this : extending and embedding. and I still haven't...
8
4166
by: Nagarajan | last post by:
Hi group, I need to develop a web application. I am in a fix as to choose among the various server-side scripting options. I want to explore python (am a newbie) to gain expertise and upon search, I learnt about PSP(Python Server Pages) that uses Jython as its scripting language. Is it a better option over PHP or Perl? Could anyone point out...
0
7700
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7614
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8125
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7676
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7974
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6284
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3642
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1221
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.