Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 25 lines (16 sloc) 491 Bytes
#! /usr/bin/env python
"""Script to open source file of a python module in vim.
In the middle of serious python hacking, you might like to see how a class or function is implemented.
This utility helps you by opening the module of interest in vim.
Usage:
$ pyvi os.path
"""
import sys
import os
mod = __import__(sys.argv[1], {}, {}, ['x'])
file = mod.__file__
print file
if file.endswith('.pyc'):
file = file[:-1]
os.chdir(os.path.dirname(file))
os.system('vim -R ' + file)