5 ms·
What is your pattern for navigating to a function definition (as an example of a basic IDE operation that doesn't seem supported)? Grep?
by ryangs 2y ago
What is your pattern for navigating to a function definition (as an example of a basic IDE operation that doesn't seem supported)? Grep?
- angra_mainyu 2y agoBefore I learned the holy ways of g->d, that was essentially what I did (grep -nr).
- EasyMark 2y agowhat is g->d?
- embeng4096 2y agoVim keybind for jumping to the definition of the symbol under your cursor, I believe
- angra_mainyu 2y agoExactly! Neovim really changed my workflow.
- kevinsync 2y agoFrom NP++, you could just ctrl-shift-f to "find in files" and it'll be quick about it, but I personally would grep from the root of the project. I usually keep a handful of command line tabs open in Console2, one for git, one for grep, one for build commands, others that are running local services etc. Anyways, the reason for this is the mental map / spatial geography of a project .. enough repetition cd'ing through folders and seeing file paths while grepping helps me visualize actual locations of things, which helps me grasp the entire structure of a project. Meanwhile, in VS Code etc you can just hover over something and click to go directly to it, which is cool, but it's kind of like teleporting instead of actually driving to the destination enough to learn the roads. I do a similar thing with git PRs -- for example, if you build something that follows a bundled pattern (ex. a component that has frontend, backend and data-related files, plus naming conventions), having a clean + complete reference PR to revisit when you make new components helps ensure I don't miss anything and stay consistent. I usually view these in-browser since Github/Bitbucket/Gitlab all have nice interfaces to see what files you need, where they go, how they're named, etc.
- freedomben 2y agoI do the same thing (though with Vim as my editor instead of NP++). Grep is seriously underrated. (well technically I use my own grep replacement[1] instead for a few reasons, but plain old grep can get the job done very well) [1]: https://github.com/FreedomBen/findref https://github.com/FreedomBen/findref
- jbritton 2y agoctags plugin
- EasyMark 2y agoctags + cscope can take you far
- EasyMark 2y agoI can't live without ripgrep, it's so much faster than grep it's not even funny, especially if working with very large code bases with 100,000+ files
- SoftTalker 2y agoWhy is that? Does it build an index so later searches are fast?
- petepete 2y agoNo, I just think every last part of ripgrep has had the shit optimised out of it. Plus it's written in rust and as we know, it's blazingly fast.
- burntsushi 2y agoNo. I've written about why: https://blog.burntsushi.net/ripgrep/ https://blog.burntsushi.net/ripgrep/ That blog is eight years old now, but still pretty accurate. For more details at the level of the regex engine, see: https://github.com/BurntSushi/rebar https://github.com/BurntSushi/rebar