Question: After generating a tags file with `exuberant-ctags` I can jump from a function call to its declaration with `<C-]>` which is pretty convenient.

My question is how to do it in the other way? When my cursor is on the definition of a function, how can I go to the lines where the function is called?

When I look to the file generated by ctags I only see informations related to the location of the definition and not of the calls, does it means that I can't do that, that Vim as a clever workaround or that I need to use something else than `exuberant-ctags`?

Answer: 
You could use Vim's **grep** command to search all the files in your project:

```
:grep! "\<<cword>\>" . -r
:copen

```

Let's put that in a keybind:

```
nnoremap <F4> :grep! "\<<cword>\>" . -r<CR>:copen<CR>

```

I find this one-key project-wide search invaluable when I am exploring a large unfamiliar codebase.

`\<` and `\>` are regexp sequences which indicate the start and end of a word, so you won't get partial matches. (The `-w` option to grep might be another way to achieve this.)

However, this is an **unintelligent search**, so it can produce false-positives if the same word appears in unrelated contexts.

---

Truthfully, I use my own [modified version of the grep.vim plugin](https://github.com/joeytwiddle/grep.vim) instead. This is slightly friendlier to use:

* It lets you edit the search pattern, and also the grep commandline (so you can target specific folders like `src/ lib/` instead of `.`) and remembers the changes.
* I added support for Google's [**csearch**](https://github.com/google/codesearch). This can be much faster than grep (on HDDs) because it builds an index of words rather than scanning each file every time. Notably, csearch uses a slightly different regexp standard, so `\b` must be used instead of `\<` and `\>`.

I configure it and exclude some standard files [like this](https://github.com/joeytwiddle/rc_files/blob/5e67249194407360d12f38e7f5b2f085937fd286/.vimrc#L147-L170).

For fast access, I create [two keybinds](https://github.com/joeytwiddle/rc_files/blob/5e67249194407360d12f38e7f5b2f085937fd286/.vim/plugin/joeykeymap.vim#L557-L592). `F3` lets me edit the commandline, `F4` uses the previously configured commandline without any extra keystrokes. The mechanism is pretty ugly, and could use some cleanup, but it has served me well.
One option is to add your own search patterns on the command line or in the config:

```
--regex-c++='/(\.|->)([[:alnum:]_]+)[[:space:]]*\(/\2(/i,function instance or call/'

```

This creates a new tag "kind" with the code 'i' (for Instance or Invocation) to distinguish it from other tags. It also creates the tags with a trailing '(', because when you are looking for the definition, having 100 invocation results can muddy the waters. So searching for 'my\_func(' limits the results in either case. If you don't like that, you can just remove the `(` after the `\2`.

You can use this options multiple times for the same kind. So, instead of trying to come up with a single regex that will match all calls, you can have several, simpler ones that capture different kinds of calls.

This isn't foolproof, and with the patterns I've built up, I still get non-call results, but it's definitely better than nothing! :)