Skip to content

Finding db file in non-git repositories #26

Open

Description

@paulwalko

I noticed that this plugin only works correctly if the db for searching is either in the current directory or it's in the root of a git repository. Many times neither of these are true. Do you know the best way to do this?

I ended up modifying my path: 'set path+=;/' in .vimrc and just used findfile(db_name) where the db is being searched for. I'm definitely no vim expert so there might be a better way to do this.

It would probably be better to use something other than path, but I don't know to do this.

Thoughts? I'd be happy to submit a pr once we figure out the best method.

Activity

  1. devjoe commented on Jun 14, 2018

    @devjoe
    Owner

    Always run :CodeQueryMakeDB in the root of a git repository.

    A tip is that you can open any file (such as README.md) in this folder and specify the language you want to build (like :CodeQueryMakeDB python). Then you will have a database file which indexed all necessary files. What you need to do next is call CodeQueryMoveDBToGitDir python to archive this database file to .git/codequery/. Finally, you should not worry about the location of the database file.

    If the tip doesn't work for your case, please let me know the way you use vim-codequery.

  2. paulwalko commented on Jun 14, 2018

    @paulwalko
    Author

    The project I'm not working on is not a git repository, so your tip doesn't work.

  3. devjoe commented on Jun 18, 2018

    @devjoe
    Owner

    Gotcha!

    Maybe we could store database files under ~/.vim-codequery/ directory.
    Do you have any thought to design this feature?

  4. paulwalko commented on Jun 22, 2018

    @paulwalko
    Author

    I suppose something like that would work, using the path where the db was created as a key and then have vim search for the longest key that is included in the current path.

    What do you think of what I suggested in the original comment? I really don't know much about vimscript, but it seems much simpler because the functionality for search up your current is already built in.

  5. xfactor9 commented on May 20, 2020

    @xfactor9

    modify db.vim to force the lookup_path as getcwd(),
    and let lookup_path = findfile(git_root_dir . '/' . db_name, '.')
    where your start vim is the DB search folder, it's more intuitive and similar usage as ctags and cscope

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