Suppose I want to "go to definition" for a class named Saver.
/^class Saver\>
19 times out of 20, this works. It's also instant; my vim will likely get me there faster than your IDE's go to definition functionality. (Looking at you, pycharm!)Here's my flow.
>>> import tensorflow as tf
>>> tf.train.Saver
<class 'tensorflow.python.training.saver.Saver'>
>>> from tensorflow.python.training import saver
>>> saver
<module 'tensorflow.python.training.saver' from '/usr/local/lib/python3.7/site-packages/tensorflow_core/python/training/saver.py'>
Then I open /usr/local/lib/python3.7/site-packages/tensorflow_core/python/training/saver.py.Suppose I want to know: Where are all the places that Saver is used in all of tensorflow?
time find . -type f -name '*.py' | xargs merge | ft py
Vim: Reading from stdin...
real 0m0.930s
user 0m0.243s
sys 0m0.414s
/\<Saver(
:%v//d
Boop: https://i.imgur.com/EJ5bZSW.pngLiterally every usage of Saver in all of Tensorflow.
So let's say you're interested in a specific line. This one, for example:
# being added to the GLOBAL_VARIABLES collection, so that Saver()
Boop: https://i.imgur.com/YSAzhCJ.pngI did that by highlighting "being added to the GLOBAL_VARIABLES", ctrl-c, then pressing "u" to undo the :%v//d, then / followed by ctrl-v.
That might sound hard, but with muscle memory I don't even think about it -- it's like explaining how you open a can of food. Do you really think about where you place your fingers, or the pressure of your nail on the flap of the can? No, you just open it up. Same thing here; it's automatic.
Way faster than IDEs, and I get just as much (or more) info.
I'd love to use pycharm, but the slowness keeps pushing me back to this technique.
But I'm curious, what benefits do you see in your approach over just doing a grep in the folder (or e.g. Ctrl+Shift+F "Find in Files" in Pycharm)?
I just want to add that in Intellij you can do Ctrl + Shift + R "Saver" and it will search in all files (as dumb text matches, not usages), plus optional checks on extensions, etc. This is pretty fast too, and quite convenient, since it has a preview for each file. Not saying it is better, but it is an alternative.
I haven't found any IDE that can easily and effortlessly do that.
i use `venv`s for every project inside the project folder so uctags also generates tags for all libraries installed and i can "drill all the way up" to classes and definitions.
it's also possible to have the system libraries show up in the tag database, it's just a matter of telling uctags which path's, files to include/exclude or alternatively use another tag file for that, vim can use multiple tag files.
the real pain point is keeping the tag file update. gutentags makes this a bit more easy for me.
it's also possible to have the system libraries show up in the tag database, it's just a matter of telling uctags which path's, files to include/exclude or alternatively use another tag file for that, vim can use multiple tag files.
Oh?
Yours is the first system I've found that has this very important feature -- the whole reason I do it my way is because I can dill down into the actual installed libraries, whereas IDEs almost always fail. (It's hit or miss. Yeah, theoretically you can configure the IDE properly if you spend your life becoming an IDE master and have a 96-core workstation, but it never seems to "just work.")
If you ever do a writeup of how precisely you've set up your environment, do ping me! I'm https://twitter.com/theshawwn. I'd be very interested and would happily retweet it.