Giter VIP home page Giter VIP logo

incremental-ctags-hooks's Introduction

#install via: git config --global init.templatedir '~/.git_template'

So, this is a rudimentary set of git hooks which will incrementally update a tags file for your project under .git/tags on basically any branch change.

This is basically directly inspired from @tpope's writeup http://tbaggery.com/2011/08/08/effortless-ctags-with-git.html on automating ctags with git.

My only problem with that idea was that it has to regenerate the whole ctags file on every branch change. With large repos, this can become a problem, and other attempts (search for inotify+ctags and the like) tend to have poor performance on large amounts of file changes.

#Implementation OK, this is the ugly part. We temporarily write and execute a C program to filter 'removed' files from your ctags, then feed the remainder of changed files as seen by git-diff into a ctags --append. While this is incredibly ugly, it is orders of magnitude faster than awk/sed/perl, and about 10-20% faster than CPython on my tests involving an approximately 80MB tags file.

#requirements

  • git 1.7.1 or newer
  • GCC (or a compatible frontend.)
  • POSIX/BSDish libc (we use hsearch())
  • zsh or bash (i've attempted to make these scripts use your favorite shell to pull in your environment of choice, but I have not recently tested this stuff under bash.)
  • logger which supports the -t argument, for syslog output

#caveats You probably dont want to run this on untrusted repos -- magic characters in filenames could do bad things to you! Also, I have only tested this on Linux and ZSH 5.0.5.

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.