Git Product home page Git Product logo

Comments (15)

sunaku avatar sunaku commented on May 22, 2024 3

Perfect! 👍 The .notags file solves the problem for me. 🙇

from vim-gutentags.

ludovicchabant avatar ludovicchabant commented on May 22, 2024 2

Oh my, sorry, I totally forgot about this (I think I have too many projects going on :) feel free to submit pull requests if anyone wants to fix it themselves though ;) )

Anyway, turns out that the .tagsignore thing I mentioned is only a partial solution since it's more about being able to specify gutentags_exclude per project (kinda like a .gitignore/.hgignore but for ctags). It could solve the OP's problem, but not if you really want zero tags support in a given project. For that, I just added with 7316197 the ability to create a .notags file at the root of the project. It just flat out disables Gutentags for that project. I hope it helps!

from vim-gutentags.

Konfekt avatar Konfekt commented on May 22, 2024

Perhaps by abusing g:gutentags_exclude? (Supposedly meant to supply file extensions à la *.dll but perhaps accepting full paths as well)

from vim-gutentags.

justinmk avatar justinmk commented on May 22, 2024

g:gutentags_exclude just gets passed to ctags -x (which seems totally redundant with ~/.ctags). And as far as I know there's no good way to specify a -x pattern such that it will ignore a certain directory, yet not ignore subdirectories.

from vim-gutentags.

nikital avatar nikital commented on May 22, 2024

@justinmk Off topic: I used to have a ~/.git to manage my dotfiles and I had problems similar to yours. Various tools that are supposed to find the root of the project would find the home directory.

This was annoying, so I changed my setup to avoid this class of problems entirely: I moved the dotfiles to ~/.dotfiles and use GNU Stow to symlink them to ~.

Something like:
http://brandon.invergo.net/news/2012-05-26-using-gnu-stow-to-manage-your-dotfiles.html

from vim-gutentags.

justinmk avatar justinmk commented on May 22, 2024

Thanks, but using a tool to manage dotfiles is cheesy, and I doubt stow even works on windows.

nested git repos are a legitimate use of git, so tools built on git should be able to handle it. If gutentags supported projectionist, it could avoid this problem.

from vim-gutentags.

ludovicchabant avatar ludovicchabant commented on May 22, 2024

I myself use some ad-hoc install/uninstall scripts (both on Mac/Linux and Windows), because it's frankly not much to write, has no dependencies, and I can do funky stuff like generate an .hgrc file instead of linking to one, because I also need to bring in other local stuff with absolute paths, and I don't want to assume anything about where I cloned my dotfiles repo. See here: https://bitbucket.org/ludovicchabant/dotfiles/src/8b6ca7e40f371f9eea323aded0dfb1c66e8bdd43/install.sh?at=default

Anyway, back to @justinmk's original issue: If I understand this correctly, you have your whole home directory under Git, which is why you don't want to generate tags for it because it's super big? I have some changes coming up that add the ability to specify things like .tagsignore files and other things like that in the root directory (I'm not set yet on the design), which would let you ignore things more easily per-project. Stay tuned :)

from vim-gutentags.

justinmk avatar justinmk commented on May 22, 2024

@ludovicchabant https://github.com/tpope/vim-projectionist is a general solution to project "root finding" (and other things).

It would be ideal if I could tell gutentags to not try to find a root, and only build tags if projectionist#path() (the project root) is non-empty.

from vim-gutentags.

sunaku avatar sunaku commented on May 22, 2024

@ludovicchabant Any luck on the .tagsignore file? My CPU is pegged at 100% while this plugin attempts to index my entire homedir just because I happen to have a ~/.git folder. 😱

from vim-gutentags.

sunaku avatar sunaku commented on May 22, 2024

Here is a workaround I'm using to avoid this issue until it gets fixed properly. 😅

diff --git a/autoload/gutentags/ctags.vim b/autoload/gutentags/ctags.vim
index cf5a576..6292068 100644
--- a/autoload/gutentags/ctags.vim
+++ b/autoload/gutentags/ctags.vim
@@ -36,6 +36,12 @@ function! gutentags#ctags#init(project_root) abort
 endfunction

 function! gutentags#ctags#generate(proj_dir, tags_file, write_mode) abort
+    " Don't treat user's (massive) home directory as a project!
+    " https://github.com/ludovicchabant/vim-gutentags/issues/13
+    if a:proj_dir == $HOME
+        return
+    endif
+
     " Get to the tags file directory because ctags is finicky about
     " these things.
     let l:prev_cwd = getcwd()

from vim-gutentags.

ludovicchabant avatar ludovicchabant commented on May 22, 2024

Good!
FYI everyone, I also closed issue 17 which lets you write a standard .ctags options file at the root of your project, which lets you among other things specify --exclude rules for your project (so it makes the whole .tagsignore thing moot).

from vim-gutentags.

justinmk avatar justinmk commented on May 22, 2024

@ludovicchabant Cool, thanks!

from vim-gutentags.

sunaku avatar sunaku commented on May 22, 2024

To automate 🚀 this workaround, I wrote this snippet in my vimrc:

" prevent gutentags from indexing the entire home directory
" https://github.com/ludovicchabant/vim-gutentags/issues/13
let s:notags = expand('~/.notags')
if !filereadable(s:notags)
  call writefile([], s:notags)
endif

Cheers! 🍰

from vim-gutentags.

justinmk avatar justinmk commented on May 22, 2024

@sunaku You could just commit ~/.notags to your git repo, if you source-control your home dir. That's what I did: https://github.com/justinmk/config/blob/master/.notags

from vim-gutentags.

sunaku avatar sunaku commented on May 22, 2024

💡 Great idea! 👍

from vim-gutentags.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.