pysmell
pysmell copied to clipboard
[Request] VIM: load tags from predefined folder
It would be nice if the Vim plugin loaded tags from a predefined folder and don't issue error message if the PYSMELLTAGS is missing. This way you can open a simple foo.py file inside your Desktop and have completions for all tags in that predefined folder.
I've written a patch which does this by defining another variable named g:pysmell_extradir
which is searched for extra pysmell tags files.
diff -r 2ff3d6dee548 pysmell.vim
--- pysmell.vim Sat Feb 12 15:29:32 2011 -0200
+++ pysmell.vim Sun Feb 13 14:09:01 2011 -0200
@@ -32,9 +32,13 @@
if !exists('g:pysmell_matcher')
let g:pysmell_matcher='case-insensitive'
endif
+if !exists('g:pysmell_extradir')
+ let g:pysmell_extradir=$HOME.'/.vim/python.tags.d'
+endif
python << eopython
from pysmell import vimhelper, idehelper
+from dircache import listdir
import vim
import string
TRANSLATEQUOTES = string.maketrans("\'\"", "\"\'")
@@ -73,8 +77,12 @@
def vimcompletePYSMELL(origSource, origLineNo, origCol, base):
fullPath = vim.current.buffer.name
PYSMELLDICT = idehelper.findPYSMELLDICT(fullPath)
+ extradir = vim.eval('g:pysmell_extradir')
if not PYSMELLDICT:
- vim.command("echoerr 'No PYSMELLTAGS found. You have to generate one.'")
+ PYSMELLDICT = {}
+ for tagsfile in listdir(extradir):
+ idehelper.tryReadPYSMELLDICT(extradir, tagsfile, PYSMELLDICT)
+ if len(PYSMELLDICT) == 0:
return
try: