diff --git a/blog/vim_and_ctags.html b/blog/vim_and_ctags.html index 5fc45fd..7b7c8fd 100644 --- a/blog/vim_and_ctags.html +++ b/blog/vim_and_ctags.html @@ -145,18 +145,27 @@ Because I'm not yet a sed/grep expert in the context o

However, what I was missing most was "go to definition", which I had mapped in VSC and PyCharm to - C-] as it is by default in vim. + ctrl-] as it is by default in vim.

Getting It To Work + Timesucks to Avoid

As with most of my efforts to make vim more ergonomic/IDE-like, getting "go to definition" working took - longer than I had hoped. - The low-hanging options didn't work as advertised: I tried to +

+ For the uninitiated, while vim comes with ctrl-] out of the box, it + doesn't actually know where something is defined unless there's at least one `tags` file and you've told vim + where to find it/them. You can run `ctags` manually, but this can get tiresome if you want vim to + always have an updated index of where all the definitions are in your project: functions, modules, + constants, classes, types, etc. +

+

+ The first option I found for automatically updating the tags file didn't work as advertised: I tried to set up git hooks like Mr. Pope suggested, -but for whatever reason the tags file never refreshed on commit. Avoid this timesuck! And +but for whatever reason the tags file never refreshed on commit. Avoid this rabbit hold! And anyway, don't you want "go to definition" to work between commits too?

@@ -167,11 +176,11 @@ but for whatever reason the tags file never refreshed on commit. Avoid this time modified it accordingly.

- Then, interestingly, without python-kinds=-i "go to definition" + However, without python-kinds=-i, "go to definition" didn't work as expected on MacOS (it was fine on an Ubuntu droplet). Inspecting my tags file, - it was including imports, which caused by C-] invocations to only jump to the top of the current - module, where the import was, not to the definition of the function/module/constant/class. + it was including imports, which caused my ctrl-] invocations to only jump to the top of the current + module, where the import was, not to the definition of the entity.

Final Product + User Experience
@@ -188,7 +197,7 @@ but for whatever reason the tags file never refreshed on commit. Avoid this time

gf bridges a significant gap that ctags don't cover: -It stands for "go to file". Type gf when your cursor over a filename, and it opens it! +It stands for "go to file". Type gf in normal mode when your cursor's over a filename, and it opens it!