From e6e08cb80dc77348a6fae63da140ee29232bfdc1 Mon Sep 17 00:00:00 2001
From: zevav
@@ -122,7 +122,6 @@ set tags=tags
autocmd BufWritePost *.py silent! !ctags -R --python-kinds=-i --languages=python 2> /dev/null &
$ brew install ctags
-
Because I'm not yet a sed/grep expert in the context of search and replace, I still miss the
@@ -148,7 +147,7 @@ Because I'm not yet a sed/grep expert in the context o
ctrl-] as it is by default in vim.
As with most of my efforts to make vim more ergonomic/IDE-like, getting "go to definition" working took
@@ -156,9 +155,9 @@ Because I'm not yet a sed/grep expert in the context o
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,
+ 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 idea of where all the definitions are in your project: functions, modules,
constants, classes, types, etc.
@@ -172,10 +171,6 @@ but for whatever reason the tags file never refreshed on commit. Avoid this rabb
What ended up working to refresh the tags file *on every save* was a modified version of something I found in the comments of a StackOverflow answer. - I was only interested to start out with in tagging my Python projects, so I - modified it accordingly. -
-
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,
@@ -183,23 +178,31 @@ but for whatever reason the tags file never refreshed on commit. Avoid this rabb
module, where the import was, not to the definition of the entity.
- What's nice about this usage of ctags is 1) it runs in the background and never
+ I can now very quickly navigate to where whatever's under my cursor was defined
+ with a single keystroke. What's nice about this usage of ctags is 1) it runs in the background and never
interrupts you, 2) it's fast, and 3) it runs every time you save.
- I haven't tried this at all with JS yet, and Mr. Pope alludes to that ctags might not be as
- helpful there, but it is lightning fast and accurate for jumping around in large Python-based
+ I haven't tried this at all with JS yet (will be trying this), and Mr. Pope alludes to that , but it is lightning fast and accurate for jumping around in large Python-based
projects.
ctags might not be as
+ helpful there
gfgf
gf bridges a significant gap that ctags don't cover:
It stands for "go to file". Type gf in normal mode when your cursor's over a filename, and it opens it!
+ As mentioned above, you can tell vim about multiple tags files in multiple paths. It
+ doesn't come up as often that I want to "go to definition" of library code, but I can see how it
+ might come in handy.
+