473,728 Members | 1,602 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Vim scripts for editing Python?

Hi, did anyone make a good set of scripts for editing Python in Vim? I
know there is one on vim.org but it isn't very advanced. thx..

Nov 21 '06 #1
7 1377

Rainy wrote:
Hi, did anyone make a good set of scripts for editing Python in Vim? I
know there is one on vim.org but it isn't very advanced. thx..
What functionality are you looking for?

Nov 21 '06 #2

Bill Pursell wrote:
Rainy wrote:
Hi, did anyone make a good set of scripts for editing Python in Vim? I
know there is one on vim.org but it isn't very advanced. thx..

What functionality are you looking for?
For example, to auto-fold all function bodies while leaving the
function names visible. To indent after ':' but only when it's at the
end of line. Also to auto-close braces like [], (), {}, autoclose
quotes. Complete all standard lib module functions, and imported
functions. I don't exactly remember how much of this was done by the
script that is posted on vim.org.. I recall it was missing some things
and some others it had didn't work exactly right at all times.. But
that was a while ago.

Nov 21 '06 #3
For example, to auto-fold all function bodies while leaving
the function names visible.
Do you mean

:set foldmethod=inde nt

which does what I think you're describing...
Also to auto-close braces like [], (), {}, autoclose quotes.
You can map whatever you like:

:inoremap [ []<left>
:inoremap ( ()<left>
:inoremap { {}<left>
:inoremap " ""<left>
:inoremap ' ''<left>

which will do the trick for you.

As for the other things, I haven't monkeyed with them, but if you
drop by the vim mailing list, there are other smart cookies there
that can help you out. I've heard of such abilities...jus t
haven't played with them.

-tkc
Nov 21 '06 #4
For example, to auto-fold all function bodies while leaving
the function names visible.
Once I wrote a plugin for vim that folds python code:

http://www.vim.org/scripts/script.php?script_id=1494

It will make the docstrings and function names visible.

HTH,
Daniel
Nov 21 '06 #5

Rainy wrote:
Hi, did anyone make a good set of scripts for editing Python in Vim? I
know there is one on vim.org but it isn't very advanced. thx..
Here's what google has to say about it:
http://www.google.com/search?hl=en&q...=Google+Search
http://www.google.com/search?hl=en&l...on&btnG=Search

Danny

Nov 21 '06 #6


On Nov 21, 11:48 am, "Danny Colligan" <dannycolli...@ gmail.comwrote:
Rainy wrote:
Hi, did anyone make a good set of scripts for editing Python in Vim? I
know there is one on vim.org but it isn't very advanced. thx..Here's what google has to say about it:http://www.google.com/search?hl=en&q...3Ahttp%3A%2F%2...

Danny
Almost forgot... if you do some searching around on comp.editors for
vim and python:

http://groups-beta.google.com/group/...rch+this+group

You'll find some helpful threads such as this one:

http://groups-beta.google.com/group/...5a6a9ed84e0eb2

Danny

Nov 21 '06 #7

Danny Colligan wrote:
On Nov 21, 11:48 am, "Danny Colligan" <dannycolli...@ gmail.comwrote:
Rainy wrote:
Hi, did anyone make a good set of scripts for editing Python in Vim? I
know there is one on vim.org but it isn't very advanced. thx..Here's what google has to say about it:http://www.google.com/search?hl=en&q...3Ahttp%3A%2F%2...
Danny

Almost forgot... if you do some searching around on comp.editors for
vim and python:

http://groups-beta.google.com/group/...rch+this+group

You'll find some helpful threads such as this one:

http://groups-beta.google.com/group/...5a6a9ed84e0eb2

Danny
Thanks Danny, that's exactly what I was looking for!

Nov 22 '06 #8

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

Similar topics

13
4031
by: Peter Mutsaers | last post by:
Hello, Up to now I mostly wrote simple filter scripts in Perl, e.g. while(<>) { # do something with $_, regexp matching, replacements etc. print; } Now I learned Python and like it much more as a language.
3
3161
by: Michele Simionato | last post by:
Is there a simple way to get the path to the Python Tools/scripts directory? Currently I have defined by hand an environment variable such as PYTHONSCRIPTS=/home/myhome/packages/Python-2.3.3/Tools/scripts so I can alias the more useful scripts in my .bashrc (for instance alias dutree=$PYTHONSCRIPTS/dutree.py), but this approach is PITA, I have to change the variable each time I change machine and at each new Python version. Is there...
9
3655
by: Jeff Wagner | last post by:
I have a project of converting numerous DOS cmd shell scripts to Python. Is there a tutorial to getting started? Thanks, Jeff
8
2028
by: Jan Danielsson | last post by:
Hello all, How do I make a python script actually a _python_ in unix:ish environments? I know about adding: #!/bin/sh ..as the first row in a shell script, but when I installed python on a NetBSD system, I didn't get a "python" executable; only a "python2.4"
0
1195
by: marco | last post by:
hi folks, i can not run any python scripts with dos lineendings under cygwin's python. if i run such a scripts i get stupid syntax error messages from python. what can i do to run these scripts without changing the lineending of these scripts. regards marco -----BEGIN PGP SIGNATURE-----
12
2827
by: Thomas Bartkus | last post by:
Does anyone use emacs together with both WordStar key bindings and python mode? I'm afraid that Wordstar editing key commands are burned R/O into my knuckles! I would like to play with emacs for Python editing but I'm having (2) problems. 1) When I load a .py file, emacs automatically overrides my wordstar-mode with python-mode, forcing all the keybindings back to emacs native keys. Why?
24
2839
by: Mark | last post by:
Hi, I'm new to python and looking for a better idiom to use for the manner I have been organising my python scripts. I've googled all over the place about this but found absolutely nothing. I'm a linux/unix command line guy quite experienced in shell scripts etc. I have a heap of command line utility scripts which I run directly. What is the best way to create python command line scripts but exploit the (loadonly) speed-up benefit of...
2
1206
by: Steve Holden | last post by:
I am teaching someone Python by email, and part of our conversation recently ran as follows: himHow do I save a script and run it? me Do you have a text editor? If so, edit the script in that, then save it me in your home directory (the place you can see when you open the terminal
9
2448
by: korean_dave | last post by:
From command Prompt, i type in a script, "tryme.py". This, instead, brings up PythonWin editor and Interactive Window. Path variable is "C:\Python24". (I need Python 2.4 installed, not 2.5) How do I make it so that the script runs?
0
8899
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8757
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9272
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9196
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
8124
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6712
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4790
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3235
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2160
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.