473,549 Members | 2,331 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

vim & python

sb
Hello

I have a bunch of questions about using python scripting in vim and
about editing python with vim.
I can install vim with python scripting support, but I can not find
docs, examples or tutorials about scripting vim using python anywhere
with google.
Is it possible to enable "calltips" while editing python documents
with vim? (BTW I've read somewhere that pyalamode was created
specifically because someone wanted "calltips" not just in the
interpreter, but in the editor as well. FWIW, VC++ has had calltips
for many years. However, I can not get those calltips to work in
pyalamode either. So I'm anxious to find any editor for python that
has calltips, but I would prefer it to be vim though)
I've heard the biggest python gurus use vim. *Please* post some
screenshots of you in action - some interesting things like
- calltips,
- editor-shell interaction
- reference manual invocation by keyword from within the editor
- object browser,
- etc.
Or are you using vim just like C coders do?
Jul 18 '05 #1
16 3856
sb wrote:
Is it possible to enable "calltips" while editing python documents
with vim?
I don't think so.
I've heard the biggest python gurus use vim. *Please* post some
screenshots of you in action - some interesting things like
- calltips,
- editor-shell interaction
- reference manual invocation by keyword from within the editor
- object browser,
- etc.
Or are you using vim just like C coders do?


I'm using it 'like C coders', if that means that I do happily use syntax
highlighting, auto-indentation and line-numbering, but not anything
else.

Note that I'm not one of the biggest python gurus ;-)

Gerrit.

--
Weather in Twenthe, Netherlands 01/03 20:25 UTC:
3.0°C wind 3.6 m/s W (57 m above NAP)
--
Asperger's Syndrome - a personal approach:
http://people.nl.linux.org/~gerrit/english/

Jul 18 '05 #2
sb <sp**********@y ahoo.com> wrote:
I've heard the biggest python gurus use vim. *Please* post some
screenshots of you in action - some interesting things like
- calltips,
- editor-shell interaction
- reference manual invocation by keyword from within the editor
- object browser,
- etc.
Or are you using vim just like C coders do?


While definitely not being a guru I use vims Syntax highlighting
plus these settings for all files ending in .py:

highlight Comment ctermfg=white

set smartindent
cinwords=if,eli f,else,for,whil e,try,except,fi nally,def,class
set tabstop=4
set shiftwidth=4
set smarttab
set expandtab
set softtabstop=4
set autoindent

Depending on your style of coding you might want to tune them,
but they're pointers. They most probably have room for
improvement, too.

As for calltips, shell interaction and all the othe nifty stuff:
I don't use it. And while they sometimes sound cool I always
ended up being more annoyed than helped by them.

Greets,
Tobias

--
Thank you for calling $PROVIDER helpdesk. If your cupholder is
broken, please press 1. If you want an actual knowledgable support
person, please enter the IP representation of a /28 netmask."
Jul 18 '05 #3
Look at taglist.vim (links below), a popular souce-browsing Vim
script. It's the only major script I'm using right now. I don't know
of any definitive Python calltips available for Vim (I assume they
would be difficult with flexible parameters and return values), but
taglist.vim provides function prototypes in the form of parameter
lists (search for 'prototype' in the taglist docs).

I've tried a few nifty Python-specific scripts (search www.vim.org)
but always wound up forgetting the special commands and resorting to
Vim staples. For example, the following two lines in my .vimrc were
good enough to condense all the functions and classes in a file:

set foldmethod=inde nt
set foldnestmax=2

My .vimrc also includes this "execute code and output results in new
buffer" script (which should all be on one line):

map <F4> :w<CR>:let @a = system('`which python` ' .
bufname('%'))<C R>:silent botright new output<CR>:sile nt normal "aP<CR>

Normally I use GVim next to a terminal window tabbed with IPython
(ipython.scipy. org/) and a browser tabbed with whatever documentation
I may need - Python docs, RFCs, and project docs
(epydoc.sourcef orge.net/). IPython helps access the nitty-gritty
aspects of Python, Epydoc allows me to browse documentation and
package structures elegantly. And though I am by no means a Python
guru, I've posted a screenshot of my "modular IDE" in action (link
below).

I went through a do-it-all-in-Vim stage and left feeling as though I
had just spent too much time playing with my tool. Keeping a browser
and terminal open all the time anyway, I eventually dismissed the
all-in-one paradigm as some quixotic jab at Emacs.

Happy vimmings,
poiboy

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

exuberant ctags
http://ctags.sourceforge.net/

screenshot
http://aonalu.makahavalley.org/img/g...nq_ipython.png (197K,
1600x1200)
Check out the function prototype on the bottom of GVim's window.
Jul 18 '05 #4
On 1 Mar 2004 17:48:17 -0800, poiboy <bi*******@sa fe-mail.net> wrote:
Look at taglist.vim (links below), a popular souce-browsing Vim
script. It's the only major script I'm using right now. I don't know
of any definitive Python calltips available for Vim (I assume they
would be difficult with flexible parameters and return values), but
taglist.vim provides function prototypes in the form of parameter
lists (search for 'prototype' in the taglist docs).

I've tried a few nifty Python-specific scripts (search www.vim.org)
but always wound up forgetting the special commands and resorting to
Vim staples. For example, the following two lines in my .vimrc were
good enough to condense all the functions and classes in a file:

set foldmethod=inde nt
set foldnestmax=2

My .vimrc also includes this "execute code and output results in new
buffer" script (which should all be on one line):

map <F4> :w<CR>:let @a = system('`which python` ' .
bufname('%'))<C R>:silent botright new output<CR>:sile nt normal "aP<CR>

Normally I use GVim next to a terminal window tabbed with IPython
(ipython.scipy. org/) and a browser tabbed with whatever documentation
I may need - Python docs, RFCs, and project docs
(epydoc.sourcef orge.net/). IPython helps access the nitty-gritty
aspects of Python, Epydoc allows me to browse documentation and
package structures elegantly. And though I am by no means a Python
guru, I've posted a screenshot of my "modular IDE" in action (link
below).

I went through a do-it-all-in-Vim stage and left feeling as though I
had just spent too much time playing with my tool. Keeping a browser
and terminal open all the time anyway, I eventually dismissed the
all-in-one paradigm as some quixotic jab at Emacs.

Happy vimmings,
poiboy

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

exuberant ctags
http://ctags.sourceforge.net/

screenshot
http://aonalu.makahavalley.org/img/g...nq_ipython.png (197K,
1600x1200)
Check out the function prototype on the bottom of GVim's window.


very nice.
--
Ashot Petrosian
University of Texas at Austin, Computer Science
Jul 18 '05 #5
Not sure what you mean exactly, but this may do it:

http://members.nccw.net/kdahlhaus/py...n.html#pyhints
Is it possible to enable "calltips" while editing python documents
with vim?

Jul 18 '05 #6
On Tue, 2004-03-02 at 02:48, poiboy wrote:
Normally I use GVim next to ....


i always wanted to ask this...
why people use GVIm and not the normal-vim-in-a-terminal?

what is the advantage of gvim?

thanks,
gabor
Jul 18 '05 #7
[gabor]
i always wanted to ask this... why people use GVIm and not the
normal-vim-in-a-terminal? what is the advantage of gvim?


Mainly the ability to use the mouse for some quick operations, like
positioning the cursor between two characters, moving big distances by
dragging scroll bars, changing window dimensions by dragging the bars
between windows, wandering in help through clicking on index items,
clicking within the fold margin for opening and closing folds, etc.

I'm usually not fond on the mouse, but strangely (to me at least),
`gvim' is effectively taming me into using it. One thing which I often
do is repeating mouse fast positioning of the cursor with `.' typed with
the left hand. It is also surprising how many `vim' operations you can
quickly do with the left hand alone! :-)

One thing which helped me a lot is that, right from the beginning, I
took the time of carefully customising `gvim' so it uses readable fonts,
consistent colours, and such things. As for Python editing, of course,
`vim' customisation is equally available within and outside X.

--
François Pinard http://www.iro.umontreal.ca/~pinard

Jul 18 '05 #8
gabor wrote:
On Tue, 2004-03-02 at 02:48, poiboy wrote:
Normally I use GVim next to ....

i always wanted to ask this...
why people use GVIm and not the normal-vim-in-a-terminal?

what is the advantage of gvim?

thanks,
gabor


So when you need to use a command that you don't use frequently you
don't have to dig through docs somewhere, you can just find it in the
menus. Or, if you work in windows it's more natural.

Jul 18 '05 #9
> what is the advantage of gvim?

I switched to GVim after moving from desktop/mouse to
laptop/trackpoint because trackpointers (a must-have, little knobby
joystick in the middle of the keyboard) eliminate the expense of small
pointer movements (if any IBM reps are reading, I am your ThinkPad
cheerleader). On the desktop, I felt most comfortable leaving the
mouse alone and using 'screen'
(http://www.gnu.org/software/screen/screen.html) to organize multiple
Vim windows.

In addition to the benefits already mentioned, GVim maintained better
speed than Vim after I added:

autocmd BufEnter * :syntax sync fromstart

to alleviate (brutally) highlighting consistency problems with larger
files (500+ lines or so).

Aloha,
the poiboy
Jul 18 '05 #10

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

Similar topics

0
2974
by: RJS | last post by:
Hi all, I can't get a py2exe compiled app to run with numarray (numarray-0.5.win32- py2.2). Also wxPythonWIN32-2.3.3.1-Py22 and ActivePython-2.2.1-222. In the sample below, commenting out "import numarray" allows the exe to run. Left in, I get "4.exe has generated errors" etc. I'm going around and around and there isn't much on Google....
5
6476
by: Edward K. Ream | last post by:
Am I reading pep 277 correctly? On Windows NT/XP, should filenames always be converted to Unicode using the mbcs encoding? For example, myFile = unicode(__file__, "mbcs", "strict") This seems to work, and I'm wondering whether there are any other details to consider. My experiments with Idle for Python 2.2 indicate that os.path.join...
1
1979
by: C. Titus Brown | last post by:
Hi all, while playing with PBP/mechanize/ClientForm, I ran into a problem with the way htmllib.HTMLParser was handling encoded tag attributes. Specifically, the following HTML was not being handled correctly: <option value="Small (6&quot;)">Small (6)</option> The 'value' attr was being given the escaped value, not the
0
2374
by: Brano Zarnovican | last post by:
Hi ! I'd like to init curses and still have working Python interactive command line. I found that you can replace stdin/stdout/stderr like this: #!/usr/bin/python -i import curses import sys
4
6047
by: webdev | last post by:
lo all, some of the questions i'll ask below have most certainly been discussed already, i just hope someone's kind enough to answer them again to help me out.. so i started a python 2.3 script that grabs some web pages from the web, regex parse the data and stores it localy to xml file for further use.. at first i had no problem using...
7
1787
by: Kirt | last post by:
i have walked a directory and have written the foll xml document. one of the folder had "&" character so i replaced it by "&amp;" #------------------test1.xml <Directory> <dirname>C:\Documents and Settings\Administrator\Desktop\1\bye w&amp;y </dirname> <file> <name>def.txt</name> <time>200607130417</time> </file>
7
4600
by: John Nagle | last post by:
I've been parsing existing HTML with BeautifulSoup, and occasionally hit content which has something like "Design & Advertising", that is, an "&" instead of an "&amp;". Is there some way I can get BeautifulSoup to clean those up? There are various parsing options related to "&" handling, but none of them seem to do quite the right thing. If I...
3
2185
by: Pappy | last post by:
SHORT VERSION: Python File B changes sys.stdout to a file so all 'prints' are written to the file. Python file A launches python file B with os.popen("./B 2>&^1 >dev/null &"). Python B's output disappears into never-never land. LONG VERSION: I am working on a site that can kick off large-scale simulations. It will write the output to...
0
1587
by: newbie73 | last post by:
Going through the tutorial on http://swig.org, I created the example files (pasted below). After generating the _wrap file, I tried compiling (using mingw32) and received a lot of undefined reference compiler errors: ...\build\temp.win32-2.5\Release\example_wrap.o:example_wrap.c:(.text+0x670f): undefined reference to...
0
1403
by: bruce | last post by:
Hi Fredrick Thanks for the reply. But since I don't have control of the initial text, is there something with python that will strip/replace this... or are you saying I should do a search/replace on the "&" char with the "amp&;" prior to parsing??
0
7546
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
7740
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7985
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
7503
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...
1
5387
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...
0
5111
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
1962
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
1
1082
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
784
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.