Wingide is a beautiful application

sjdevnull at yahoo.com sjdevnull at yahoo.com
Tue Dec 20 18:41:12 EST 2005


Tony Nelson wrote:
> > 1. Python syntax checking: as I'm typing along, if I input a syntax
> > error then the line is immediately highlighted in red.
>
> What do you use to do this?  Cream doesn't seem to do this oob.

Nope.  I'll try to package up my vimrc and get it uploaded somewhere
next week (busy with holiday stuff).  The meat of it is:

import vim
def cur_x():
    return vim.current.window.cursor[1]
def cur_y():
    return vim.current.window.cursor[0]
def find_current_block():
    block = [vim.current.line]
    current = cur_y()-1
    while len(block[0])==0 or block[0][0] in " \t#":
        current = current - 1
        if current < 0:
            break
        block = [vim.current.buffer[current] ]+ block
    return block
def check_current_block():
    import code
    vim.command("syn clear Error")
    block = find_current_block()
    length = len(block)
    try:
        code.compile_command("\n".join(block))
        print ""
        return 0
    except:
        (type, value, tb) = sys.exc_info()
        line_no = cur_y()-1+value.lineno-length
        badline = vim.current.buffer[line_no]
        badline = badline.replace('"', '\\"')
        print "Error at line %d: " %(line_no+1), badline
        return 1

> > 2. Normal tag-jump stuff: Ctrl-click on a function/method call (or
> > class or whatever) will jump to the function/method/class definition
> > (Ctrl-T works as well if you don't like clicking).  It keeps a stack of
> > visited files so you can drill down through your call stack and then
> > pop back up to where you came from.
>
> Do you set up ctags for this?  I get error messages "E433: No tags file"
> and "E426: tag not found: xxx" when I Ctrl-click on a method call.

Umm, either click the "build tags in current directory" button on the
toolbar, or "find . -name '*.py' | ctags -L -" in the top directory of
your python file.

> > 3. Python class browsing stuff: A Class menu shows the parent and child
> > classes of the one you're currently in, and all the methods of the
> > current class; selecting any of the above jumps to the appropriate file
> > and line.
>
> Is this the Tag List?

No, this is more complex, I'll post it w/ the rest of my stuff.

> > 4. Interactive documentation stuff: When I type an open-paren, it looks
[SNIP]
> This stuff doesn't happen either.  How is it set up?

Likewise, I'll post.

> > 5. A client menu selects which client I want to work in (so, say, I get
> > a bug report for Client A, I select them from the menu).  The Class
> > menu and other functions respect this (if I'm in the generic Company
> > class, the Class menu will list Client A's Company subclass before the
> > subclasses of other companies; if I jump to the Company definition,
> > it'll go to Company A's client-specific version).  It also restarts
> > development httpd servers on the current machine running with conf
> > files appropriate to that client.
>  ...
>
> Where is this "client menu"?  How is it set up?

It's a listing of all the clients we work with.  It's a more
project-specific thing, but illustrates that you can easily integrate
vim into whatever your development system looks like (indeed, when I
get a python error in a page on my dev server then it opens the file
where the exception occurred in my vim and jumps to the line, setting
up the stack appropriately).

That stuff I can't post.




More information about the Python-list mailing list