How to setup etags for fuzzy symbol searching in Spacemacs on Windows

What do etags do?

Want to be able to search for symbols in your source code? You can index your source code and search it quickly with Exuberant Ctags. There are 41 languages supported.

Install etags

Navigate to the ctags page.

Download the zip file:

download the ctags binary

Extract the folder:

extract the ctags folder

Move the folder to a location of your choice. In the folder you should see ctags.exe:

verify the ctags.exe exists

If you want, add the directory (e.g. c:/ctags) to your system path (example here).

Edit your .spacemacs

Let's tell Spacemacs how to create these tags. Add the following line to the user-config section of your .spacemacs file:

(setq projectile-tags-command "c:\\ctags\\ctags.exe -R -e")

The -R is for recursive (scan sub-directories) and the -e is for creating Emacs tags.

Restart Spacemacs to finalize this configuration.

Create a Project

We're going to generate tags for a project under a certain directory. If you haven't already, make sure you've created a project.

Generate Tags

We can generate tags from within Spacemacs. Open a file inside your project's directory, and press SPACE p G:

projectile regenerate tags option

You should see a tags file appear in your project directory:

see tags file

Fuzzy-searching for tags

Now press M-x (ALT x) and type helm-etags-select:

helm etags select option

You'll see a fuzzy search window appear:

fuzzy search tags in spacemacs

Now, start typing and see results filter:

fuzzy search should work now

Now we just need to map a keyboard shortcut to run helm-etags-select.


This tutorial is based on very helpful guidance from dotneter on Reddit.

Next: How to generate etags for a huge project in Spacemacs on Windows


Leave a comment

What color are green eyes? (spam prevention)
Code under MIT License unless otherwise indicated.
© 2020, Downranked, LLC.