1

How do I get ripper-tags to automatically generate a tags file for my ruby buffers upon save?

2
  • Is this a question related to Vim? I'm sensing that your question is not. But maybe you could explicit what you need and how it relates to Vim.
    – nobe4
    Aug 8, 2016 at 15:51
  • I edited the question to show how what I want to do interacts with vim.
    – Tom Hale
    Aug 17, 2016 at 6:03

1 Answer 1

4

Disclaimer: I don't have ripper-tags installed, this is my best guess on browsing the documentation.

In the documentation it says that the typical usage is:

ripper-tags -R --exclude=vendor

This parses all *.rb files in the current project, excluding ones in vendor/ directory, and saves tags in Vim format to a file named ./tags.

Using this with an autocmd on save I would get something like the following:

autocmd BufWritePost *.rb !ripper-tags -R --exclude=vendor
  • autocmd BufWritePost Sets up an auto command to do something everytime we write to a file
  • *.rb Only execute on ruby files (.rb extension)
  • !... Executes following command in a shell

Put this line in your vimrc file to enable the auto command.

See :h BufWritePost and :h ! for more info.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.