There are multiple ways of doing anything with vim, including going to where a function or object is defined, and I usually need to do something at least 3 times before I can do it without breaking my focus or train of thought.
I can’t remember everything I read and tried, but I trust my conclusions.
Looking in my
.vimrc I see that I have
<leader>x mapped to
GoTo and it works just fine, even when a module is imported from somewhere
outside the current project. The tool was working and ready to use, I just
hadn’t internalized it yet.
Commands to remember:
<Leader>x- GoTo definition - YCMs best guess at an ‘intelligent’ goto command, whether its a declaration or a definition.
<F2>- Toggle tagbar
Jump Lists and Change Lists
If you’re going to be jumping around to where things are defined, you will need to know how to jump back again. It seems there are two lists you need to be aware of, the jump list3 and the change list4.
- A list of locations that the cursor has jumped to.
- Relevant to jumping to a definition.
<C-O>move up the jump list
<C-I>mode down the jump list
- A list of locations where a change was made.
A change is something that can be undone using
'.will move you to the
.is a special mark that is automatically set at the location of your last edit.
''will bring you back to where you were before your last jump
g,will also move you up and down the
- The more powerful the tool, the more worthwhile it is to take a closer look at what it can and can’t do. ↩
- YCM and
ALE work fine for goto definition and linting, but they don’t give me
neoclide/coc.nvimlooks like it might offer some improvements. neoclide/coc.nvim ↩