rctags-watcher
This is a little tool which watches for file system changes on directories specified in the configuration file and then runs ctags
to generate tags files in them.
Why?
If you are using VIM and you need your tags file to be up to date, then this tool is for you.
rctags-watcher is a GNU/Linux program written in Ruby which uses inotify to detect changes on directories and then run ctags
to regenerate the tags file.
Features
- (Re)Generate the tags file when you change source code files (saving a file in your editor of choice will do that)
- Configure which file types can trigger a tags scan
-
ctags
configuration per project (see the configuration file)
Requirements
- GNU/Linux
- Ruby >= 2.1
- rb-inotify >= 0.9.7
- exuberant-ctags
Installation
Install the gem:
gem install rctags-watcher
Cloning the repo:
git clone https://github.com/vladbalmos/rctags-watcher
cd rctags-watcher
bundle install
# copy the default configuration file to your home directory and customize it
cp data/rctags-watcher.conf.dist ~/.rctags-watcher.conf
# start the program
bin/rctags-watcher.rb
Usage
rctags-watcher runs by default in foreground. You can run it as a daemon by passing the -d
flag when starting it.
bin/rctags-watcher.rb -d [--daemon]
Once in "daemon-mode" you can kill it by sending the stop command:
bin/rctags-watcher.rb stop
Communication with the daemon is done through a unix socket.
IMPORTANT: When running the program as a deamon change the logger destination from STDOUT to a file, or else you will see the any messages printed in your terminal.
Configuration
By default rctags-watcher reads the following configuration files if they exist:
- /etc/rctags-watcher.conf
- ~/.rctags-watcher.conf
The last one can override configuration options specified in the global one.
You can pass a different config file when starting rctags-watcher using the -c
or --config
flag
bin/rctags-watcher.rb --config /path/to/my/custom/config/file
This method won't load the main /etc/rctags-watcher.conf
file or the one present in your $HOME directory. Each configuration change will require you to restart the rctags-watcher process.
To get started copy the default config file data/rctags-watcher.conf
to ~/.rctags-watcher.conf
and create a new project section in it. See the sample project for more information.
Motivation
I wanted to learn Ruby and this seemed a great way to shoot two birds with one stone.