4 ms·
Not if you add about half a million partially conflicting add-ons to it, no it isn’t! Sorry. Yes, (n)vi(m) is great and useful and all, but it’s not an IDE.
by coffeeblack 4y ago
Not if you add about half a million partially conflicting add-ons to it, no it isn’t!
Sorry. Yes, (n)vi(m) is great and useful and all, but it’s not an IDE.
- falcolas 4y agoVim defaults to being a C IDE, no plugins required. The features I called out above are available with no plugins.
- coffeeblack 4y agoInteresting, didn’t know, will try it. Does it do “jump to definition” out of the box?
- falcolas 4y agoSure does. :) `gd`
- coffeeblack 4y ago:gd E492: Not an editor command: gd VIM 8.2 Do I have to activate it somehow? :)
- aidenn0 4y agoHave the following file: int foo () { return 3; } int bar() { return foo(); } put your cursor somewhere on the "foo" identifier in the second to last line and type "gD" (without the quotes). It should jump to the definition of foo. It's not perfect but works for much code without crazy preprocessor stuff. By default it's file-local, but you can give vim a list of include files to search as well.
- coffeeblack 4y agoAh, upper case D, yep that works! Thanks!
- aidenn0 4y agoyeah lower-case "d" is for local definitions (it just searches for the first appearance in the "[[" region if you are familiar with vim motions).
- falcolas 4y agoWhat aidenn0 said. Specifically it's one of the 'g' commands (like gg which goes to the top of the file and gG goes to the bottom). Just put your cursor on an identifier and gD (goto definition is the mnenomic). :help g
- aidenn0 4y agoprobably "gD" is what you want unless you're looking for a local definition.
- pjmlp 4y agoSo the days of using ctags are long gone?
- falcolas 4y agoNo, you still need ctags to jump to sources outside of your current file. But within the same file, it works fine without it. C doesn't have a defined directory structure, and a lot of the source/header files you'd use are stored in places like /usr/lib and such.
- aidenn0 4y agoNote that cscope is significantly better than ctags and also built into vim.
- pjmlp 4y agoYeah, but that is the thing, an IDE works with more than one file.
- falcolas 4y agoI feel like you're taking my words in bad faith. Vim works perfectly fine with multiple files out of the box, it just wants a tag file for jumping between multiple files and letting autocomplete work with those tags. This is hardly unique to vim (and emacs) - you can't work on a project in IntelliJ without first setting up a workspace and letting IntelliJ index all those files. The only difference is how the index is generated. Oh, and `:help cscope` (again, thanks aidenn0). In vim >=9.0 a tagging tool is now incorporated into the base vim install.
- pjmlp 4y agoNope, just making the point that vim has lots of things to catch up with a proper C IDE in a default install. ctags was just the first example of many things I can refer to. For example any basic C IDE on a default install is expected to have debugging integration, project management, among other stuff.
- alwillis 4y agoIt’s not an IDE but Neovim can do IDE-like things. And you can get Neovim with all batteries included: https://github.com/rockerBOO/awesome-neovim#preconfigured-configuration https://github.com/rockerBOO/awesome-neovim#preconfigured-co...