Skip to content
This repository was archived by the owner on Apr 13, 2021. It is now read-only.
This repository was archived by the owner on Apr 13, 2021. It is now read-only.

[Request] VIM: load tags from predefined folder #1

Description

@ianliu

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:

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions