run-ctags (Rust UNiversal ctags)
Enumerates all dependencies for a given project allowing a flexible way to build a tags file.
This is intended for use with Vim or Emacs in combination with universal-ctags.
Installation
This crate depends on univeral-ctags. Please follow the installation instructions for universal-ctags.
After universal-ctags has been installed, install run-ctags.
Install run-ctags
cargo install run-ctags
Usage
Once universal-ctags is installed, use the following command to enumerate all root directories and then pipe the results to ctags. From there, ctags will recurse through all files, starting from the root directory, and create a file named ctags in your project's root folder.
From the root directory of your Rust project, run the following command:
build the tags file
|
This command pipes all of your project dependencies to ctags which then in turn builds an index for your project saved in a file named tags. If you now open vim in your project's root directory, you can use ctags to jump in and out of different definitions.
Here are a few helpful commands to run from within vim after the tags file has been created:
commands
Ctrl+] - go to definition
Ctrl+T - Jump back from the definition.
Ctrl+W Ctrl+] - Open the definition in a horizontal split
Note, vim can only find the tags file if you start vim in the project root. However, the following command can be added to .vimrc which allows vim to open the tags file from any subdirectory:
.vimrc
set tags=./tags;/