r/programming • • Sep 24 '15

Vim Creep

http://www.norfolkwinters.com/vim-creep/
1.2k Upvotes

844 comments sorted by

View all comments

Show parent comments

4

u/cadekat Sep 25 '15

What do you need to consider it an IDE? Almost everything can be added with plugins.

19

u/vplatt Sep 25 '15

How about method extraction with automatic parameter and return value creation? How about automatically adding imports I haven't added yet for a library function I'd decided to use?

Just curious. I haven't seen those abilities outside of IDEs.

3

u/tagesticket Sep 25 '15

The only place I've seen those outside of IDEs are in the Go ecosystem with goimports, oracle, gorename and similar static analysis tools. However, after all that I end up using IntelliJ for Go as well. I can just get stuff done vs tweaking my vim configs and plugins endlessly.

35

u/Deathspiral222 Sep 25 '15

To me, an IDE needs to understand the meaning of the code, not just treat it as a bunch of symbols. I mentioned this in another comment, but in a large codebase, with twelve functions all called foo(), I want to refactor all references to THIS SPECIFIC method foo() to rename them to something else. IntelliJ can do this in a keypress but I've never found anyone who can do it in vim.

20

u/rycars Sep 25 '15

The vim users I know often don't seem to realize you can do things like this in an IDE. I don't know how I'd live without the ability to find all references or jump to definition with a couple key presses.

Vim-style editors for use within an IDE are news to me, though (obvious when you think about it, but it's never occurred to me before). I might have to try one out.

6

u/Deathspiral222 Sep 25 '15

They are pretty good but usually not complete, so they get kind of annoying when most things work but some things don't.

Perhaps the number one downloaded plugin for IntelliJ is one for vim-style controls.

Also:

find all references

I just realised vim can't do this. Holy crap, that would drive me crazy.

6

u/rlbond86 Sep 25 '15

Totally agree. Visual Studio will even show a call tree so you can easily see which functions call functions that call your functions.

1

u/davidchristiansen Sep 25 '15

The key for that is compiler support for the editor, which is perfectly possible in vim or Emacs. For example, the Emacs mode for Idris does this. Traditional command-line compilers have rubbish support for editing, but it doesn't have to be that way. Things like this exist for C# (omnisharp) and other languages as well.

1

u/clothes_are_optional Sep 25 '15

why not just a combination of both? i use xcode for swift. i enjoy all the benefits of the IDE along with the vim plugin for typing and jumping around a file. best of both worlds.

-1

u/vplatt Sep 25 '15

IntelliJ can do this in a keypress but I've never found anyone who can do it in vim.

This.

-1

u/mightdropout Sep 25 '15

Yeah IDE's right now are better than vim for specific stuff like that, but vim is better at general workflow, and that's more important IMHO.

Plus, I'm in it for the long haul. NeoVim should be finished by the end of next year and there probably will be Lua plugins for that kind of super specific stuff. I'm treating learning vim as an investment.

2

u/Deathspiral222 Sep 25 '15

I thought this too until I watched Notch (Minecraft creator) coding in an IDE on a livestream. The guy has total mastery of his tools and it shows - and he was doing a lot of stuff in a single keystroke (refactoring mostly) that would take a Vim user far too long to do because it simply isn't possible to do some of this stuff outside of a tool that understands both the syntax and the semantics of a language.

1

u/mightdropout Sep 27 '15

Dude idk, I see it differently. There's definitely a tradeoff but I think vim's still better. I don't refactor that much and I like being able to open vim in like 1 second from the console, instead of having to get my mouse, click the IDE or whatever and wait for it to load. Plus every IDE looks super ugly to me. And I can use vim wherever I want. If I'm SSHed into my server, or on my phone, no problem.

-1

u/thrashmetal Sep 25 '15

Doesn't take long to grep the entire code base for the include file, open results and do a regex search replace to refactor.

6

u/Vile2539 Sep 25 '15

with twelve functions all called foo(), I want to refactor all references to THIS SPECIFIC method foo()

The problem is you have 12 different methods called foo(), and you only want to rename a specific one. Find/replace won't help you there, since it will only find all the calls to foo() methods, not just the specific one you want.

1

u/thrashmetal Sep 25 '15

So now I have 12 functions all called foo defined in the same file, with the same number of arguments? I would find the person who wrote that and yell at them. Then I would just change the name, compile and fix the errors.

2

u/Vile2539 Sep 25 '15

No, I don't think /u/Deathspiral222 was saying that. What he was saying is that over your entire codebase, you have 12 functions named the same thing. He uses foo() as an example, but it could be something common like a getter called getName(). He now wants to rename the base function to bar() in one case. A find/replace won't help you here, since it will find calls to every foo() function, instead of only the specific one you want to rename.

→ More replies (3)
→ More replies (1)
→ More replies (5)

12

u/Merad Sep 25 '15

Basically what /u/Deathspiral222 said. Intelligent navigation, code generation, and refactoring are the big ones, IMO. My work environment is VS 2013 with R#, so I'm used to much more than that, but every IDE I've tried (Netbeans, Eclipse, IntelliJ, PyCharm) delivers on them in some form and I don't think I've ever seen vim or emacs set up with comparable features.

4

u/almond_butt Sep 25 '15

I need to be able to see call and type hierarchy, have run configurations, refactor smartly, provide default implementations, getters/setters, point out syntax errors, show lint warnings, build automatically with each save, organize imports, correctly import the right classes based on code, debugging with expressions/stepping, etc.

0

u/scarymoon Sep 25 '15

...have run configurations ... provide default implementations, getters/setters, point out syntax errors, show lint warnings, build automatically with each save, organize imports...

To clarify, these are possible with vim.

Of course, its not as easy to get vim to a point where it can do them as it is an ide. And the other ones you mentioned(hierarchy, refactoring, and debugging, which I think are the more important tasks out of what you mentioned) either aren't possible or easy with vim.

2

u/whichton Sep 25 '15

Thing is, typing is a very small part of coding, probably no more than 10%. 90% of coding is reading code, thinking, reasoning, debugging, testing, etc. Actual typing is very less. IDE helps with all of the above (except the thinking part). So even if you are a vim expert, it makes much more sense to install a vim mode for your IDE than go the other way.

1

u/Purpledrank Sep 25 '15

The amount of focused that an IDE brings to a specific language is way beyond what various VIM plugins can achieve. Like OP said, I use vim for writing scripts, absolutely. It's fast, lightweight, and opens form my favorite app, a terminal.

But, something like IntelliJ is much better for a large Java project just because of how well refined all of its features come together. No hacking anything together.... also, I use IntelliVim, a vim keybindings program for my editor. So if anything, I rather vimifiy my IDE than turn vim into different kinds of IDE's.

0

u/dpash Sep 25 '15

Ctags and etags is useful for navigation too.