Skip to content

Instantly share code, notes, and snippets.

@david-batranu
Last active August 29, 2015 14:01
Show Gist options
  • Save david-batranu/33562c545328f643a2fe to your computer and use it in GitHub Desktop.
Save david-batranu/33562c545328f643a2fe to your computer and use it in GitHub Desktop.
Generate a tags file for the pythonpath
#!/usr/bin/env python
from __future__ import print_function
import sys
from subprocess import call, STDOUT
LEN = len(sys.path)
FILENAME = "pyfiles.list"
print("Finding package paths:")
with open(FILENAME, "w") as out:
for idx, path in enumerate(sys.path):
call(["find", path,
"-type", "f",
"-name", "*.py",
"-o",
"-name", "*.vpy",
], stdout=out, stderr=STDOUT)
print("{0}/{1} done!".format(idx, LEN - 1), end="\r")
print("Generating ctags:")
call(["ctags", "--python-kinds=-i",
"--extra=f",
"-L", FILENAME])
@david-batranu
Copy link
Author

Best used with

nnoremap <C-]> :execute 'tj' expand('<cword>')<CR>zv

in ~/.vimrc

and

[mktags]
recipe = collective.recipe.cmd
on_install = true
on_update = true
cmds =
    curl https://gist.githubusercontent.com/david-batranu/33562c545328f643a2fe/raw/mktags.py > mktags.py
    ${instance:location}/bin/interpreter mktags.py

in buildout.cfg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment