Python indentation

G

G. S. Hayes

Jacek Generowicz said:
Just one thing (and please remember that I do not use vim, so much of
this is alien to me) ... I heard it mentioned a number of times that
Python must be compiled into vim, and in the link you posted the words
"for python enabled [g]vim" appear. Is vim typically Python-enabled
out of the box, or does the user have to compile it in?

Typically? I don't know. Red Hat Linux (including Fedora and
Enterprise Server) includes Python support in Vim by default in the
regular vim package which installs as /usr/bin/vim (but not in the
vim-minimal package which installs as /bin/vi).

To check on your machines, fire up vim and try:

:python print "test"

and see if you see the word "test" or an error message. Or do
:version and look for either +python or -python (you want +python).

Sumner
 
P

paolo veronelli

Just one thing (and please remember that I do not use vim, so much of
this is alien to me) ... I heard it mentioned a number of times that
Python must be compiled into vim, and in the link you posted the words
"for python enabled [g]vim" appear. Is vim typically Python-enabled
out of the box, or does the user have to compile it in? The problem is
that we have a lot of centrally managed software here, and if users
will need to replace the standard vim with their own version, then
that is likely to lose a lot of potential users.

freebsd 5.2.1 doesn't......
 
G

G. S. Hayes

Jacek Generowicz said:
OK, I've tried it again, and discovered that you can scroll beyond the
bottom of the screen ... and then some actual information
appears. Phew, what a relief! (On my previous attempt, I thought that
that the |python-commands| &co next to the 5 numbered titles were
links of some sort, and everything I tried resulted in frustration.)

The bits between bars are links to tags. Use Ctrl-] to follow them
and Ctrl-t to pop back to where you followed from.

For more info, ":help tags"
Hmm, that makes me slightly nervous ... do you get to see some
vi-specefic inerpreter state ... with which you might clash ?

If you use the embedded interpreter you can certainly clash with the
vim internals, that's why I use the vimsh approach (also, using vimsh
allows you to restart the interpreter without restarting the editor).
 
S

Steve Lamb

Typically? I don't know. Red Hat Linux (including Fedora and
Enterprise Server) includes Python support in Vim by default in the
regular vim package which installs as /usr/bin/vim (but not in the
vim-minimal package which installs as /bin/vi).

On Debian it is compiled in the vim-python package but not in the vim
package. I don't believe either is installed by default so it is up to the
end user to choose which one he wishes installed.
 
L

Lonnie Princehouse

OK, so this could be one way of emulating the REPL (but I hope that
there might be a more convenient way).

Yeah, a complete interpreter is lurking in the background, but it _is_
difficult to interact with. I use it mostly as a way to script VIM,
but not on the fly; I just keep a bunch of handy functions in a module
(called "vimfu") which gets imported by .vimrc. The vim module
provides a nice pythonic way to manipulate buffers, selected regions,
etc.

You can do all of this stuff with LISP in Emacs, but Python works
pretty well for scripting VIM.
So, am I right in thinking that it's just a single chunk of text, with
some colouring ... which one is supposed to read by scrolling up and
down, or is there more to it (it _looks_ as if there is ...) ?

It is indeed arcane. Ctrl-] will follow the colored links.
I guess I really should find the time to go through this with an
interested vim user.
Hmm, that makes me slightly nervous ... do you get to see some
vi-specefic inerpreter state ... with which you might clash ?

I doubt that is an issue. The vim module interacts directly with a
VIM session, which is why I don't think it can be run outside of VIM.
You could put it in your PYTHONPATH and give it a shot, though-- I
haven't actually tried =)
 
J

Jacek Generowicz

The bits between bars are links to tags. Use Ctrl-] to follow them
and Ctrl-t to pop back to where you followed from.

For more info, ":help tags"

Aaaah, great. Thanks. (Lonnie too.)
 
J

Jacek Generowicz

To check on your machines, fire up vim and try:

:python print "test"

and see if you see the word "test" or an error message. Or do
:version and look for either +python or -python (you want +python).

Looks like our standard version has it enabled.

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,999
Messages
2,570,243
Members
46,836
Latest member
login dogas

Latest Threads

Top