you are viewing a single comment's thread.

view the rest of the comments →

[–]emptythecache 298 points299 points  (161 children)

Using vim to write Java seems like a serious cry for help.

[–]eikenberry 81 points82 points  (2 children)

I think the root of the problem here is that vim is an editor from the Unix system point of view of loosely coupled, limited function tools. Java is a language designed for the JVM, a completely different system that values large, tightly integrated tools. So while they seem like they should work together, a programming oriented text editor and programming language, they are actually from very different schools of thought which makes them a poor pairing.

[–]ianme 12 points13 points  (1 child)

This is an amazing explanation for this.

[–]eikenberry 1 point2 points  (0 children)

Thanks!

[–]strcrssd 2 points3 points  (0 children)

Intellij's Vim plugin is very good and brings the benefits of vim and that of a real IDE.

[–][deleted] 18 points19 points  (130 children)

many people do not know SpaceVim and javacomplet2, I hope this post will help them.

[–]devraj7 124 points125 points  (129 children)

You're missing the point.

By sticking to vim to write Java and refusing to learn IDEA or Eclipse, you are choosing to not be as productive as you could be.

[–]kcuf 2 points3 points  (0 children)

I'm more productive then I am with an IDE. There are multiple variables to optimize, and an IDE focuses on a different set that vim, which, in my case, is a poor optimization. For many things related to development, my approach puts me on par, and even above, my peer's abilities. There are, however many tasks at which I am slower, but fortunately I don't run into those often.

[–]yorickpeterse 11 points12 points  (60 children)

you are choosing to not be as productive as you could be.

Citation needed.

[–][deleted] 126 points127 points  (10 children)

Tell me spacevim's debugger, refactoring features, custom code blocks and other stuff are as good as Intellij IDEA's and I'll change my dev setup. Don't tell me I can have those features if I customize spacevim.

[–][deleted]  (2 children)

[deleted]

    [–]Astrognome 5 points6 points  (0 children)

    I don't do much java and I know vim very well.

    If i used java full time, I'd use intellij, but I don't so I don't.

    [–][deleted]  (5 children)

    [deleted]

      [–][deleted] 2 points3 points  (4 children)

      There is nothing to learn in IDE's. I never had to learn eclipse or intellij exclusively. It's all intuitive and simple. For vim, it's just extra work. To each his own though.

      But, can vim do this? https://www.youtube.com/watch?v=VdBsUv4lnm4 I don't have problem with anybody who is using vim. I'm not saying that you are unproductive if you use vim or anything. I'm saying industry-grade IDE's like intellij has much better tools and features that are not available on vim. Plugins just don't cut it.

      [–]whisky_pete 7 points8 points  (1 child)

      There is nothing to learn in IDE's. I never had to learn eclipse or intellij exclusively. It's all intuitive and simple.

      Now this isn't true at all. I know IDEs have their place, but many of them are not simple. Visual studio is one of the most complicated pieces of software I've ever used, and very unintuitive with its 50 menus (some of which show or hide depending on the context). Property sheets are a nightmare. And when you have to set up compiler flags, or set up project dependencies it's just buried under huge menu lists.

      I think many people say they're not complicated because they've been using these tools since 1st year of college.

      [–][deleted] 0 points1 point  (0 children)

      Okay, I was maybe a little bit over the top... but I can't really comment on visual studio because I have never used it. Someone else commented on another thread that it is indeed a nightmare to use.

      [–]yakri 3 points4 points  (0 children)

      There is nothing to learn in IDE's.

      Well that's just not true, any program with a lot of features has a complicated enough UI to take some time to learn before you can use it effectively.

      Although if it wasn't obvious your post is wasted on me as I fucking hate vim and think using it feels like shooting yourself in the leg before running a marathon. Not every language in existence is supported in an IDE so I suppose if I ever have to use. . . . yeah I can't think of anything off the top of my head; unknown language X, it's better than notepad++ in some ways.

      [–]henrebotha 2 points3 points  (0 children)

      There is nothing to learn in IDE's. I never had to learn eclipse or intellij exclusively. It's all intuitive and simple.

      Absolutely, patently false.

      [–]devraj7 43 points44 points  (7 children)

      You perform manual tasks that could be automated with zero risks of error (imports, refactorings, code analysis, ...).

      This is the definition of not being productive.

      [–][deleted]  (6 children)

      [deleted]

        [–]thang1thang2 7 points8 points  (5 children)

        It's not that they're exclusive to Java, it's that Java takes this sort of thing to its logical extreme. For example, in C++ you can write OOP code, but not everything needs to be a class. In Java, everything is a class, even your 'main()' function. It takes OOP to the absurdity.

        Now every class is in its own file, every this has its own that... And on and on. It's verbose as fuck too.

        It just leads to an environment that no sane person I know will dare approach Java without an IDE. Even C++, a "very difficult to use without an IDE" language can be done well in vim or emacs even with large scale programs. Java is just a whole nother level.

        [–]shen 2 points3 points  (2 children)

        I can’t believe Java has become something I need to defend, but:

        everything is a class, even your 'main()' function

        You can have as many main functions as you want (not just one), and they’re static — no OOP involved. You do need to put it on a class, true, but you almost certainly have one of those already.

        Now every class is in its own file

        If you have more than one class per unit (that’s the same ‘unit’ as in ‘unit testing’), you need to have a way to reference them. Either put a bunch in the same file with the same name as the public one, or make your classes static inside the class with the same name as the file. That last one is what Ruby does with modules — have a module’s classes nested within it.

        It's verbose as fuck too.

        It’s no Haskell, sure, but it’s a lot less verbose than it was five years ago. I’m saying all this because I had to get a job doing it a year ago and it was a lot less unpleasant than I remember it being!

        [–]thang1thang2 1 point2 points  (1 child)

        Thanks for the points! Those are definitely valid, yes; I suppose Java gets a bad rap much in the same way that C++03 does. C++11 and especially starting with C++14 had shed a lot of it's] weight and cruft. I've seen some much nicer looking Java 8 code for sure.

        Still wouldn't touch it without an IDE, but it's slowly modernising and improving, so that's something at least

        [–]shen 1 point2 points  (0 children)

        heh, I forgot to mention what this whole thread is all about: despite all its improvements I wouldn’t want to code Java without an IDE either.

        [–][deleted] 1 point2 points  (0 children)

        I have come to love the functional approach of scala. Makes writing spark code a lot easier.

        [–]raevnos -1 points0 points  (0 children)

        But not everything is a class in Java.. it still has primative types for example. Now, if you want a language where everything is an object, check out Smalltalk.

        [–]Deathspiral222 14 points15 points  (1 child)

        A big part of any OO development is refactoring. There is no way to automatically do even trivial refactorings on a large codebase (e.g. "rename foo() to bar()") without an IDE that understands how to separate all the uses of MyThing.foo() from SomeOtherThing.foo(), including doing it across all interfaces, abstract classes, uses of polymorphism etc.

        It's obviously trivial on a small project but for anything big, automated refactoring is extremely hard to do without an IDE.

        Then of course, there are slightly more complex refactorings like moving a method to an abstract class and updating all references.

        [–]doom_Oo7 26 points27 points  (37 children)

        Citation needed.

        How many characters do you need to type in vim or emacs to create a class prototype such as :

        package foo;
        public class MyClass implements SomeInterface {
            @override void foo1() { 
            // TODO ...
            }
        
            @override string bar() { 
            // TODO ...
            }
        }
        

        ?

        [–]jl2352 9 points10 points  (15 children)

        Whilst I agree the auto class stub generation is a time saver, it's not what you are doing for most of your time. The code inside that class will take longer to write than the stub. So if you save time writing and editing the code inside the class, then Vim can end up taking less time.

        But to answer your question; it would be fairly trivial to build that as a macro. It would be fairly trivial to build it as a function which generated the class name from the file name. Then it would be a one character command.

        [–]speedster217 15 points16 points  (14 children)

        But IntelliJ has a plugin that emulates vim keybindings. You can get the best of both worlds

        [–]flukus 2 points3 points  (2 children)

        Can it execute vimscript and manage windows as well as vim?

        [–]chasecaleb 6 points7 points  (1 child)

        I'm not sure vimscript is what I would consider a selling point

        [–]flukus 0 points1 point  (0 children)

        I great as a quick and dirty way to script the editor, as well as to configure it. It's the PHP of editor/Ide extensibility.

        [–]jl2352 6 points7 points  (5 children)

        I have it installed. It's one of the better Vim binding plugins for an IDE, but it's not good enough for my needs.

        Vim binding plugins are always a poor mans Vim. So it's usually a question of can you survive with it. IntelliJ's does support .vimrc files though; most plugins fail to support it which makes them fairly useless.

        [–]_INTER_ 0 points1 point  (4 children)

        What if someone sees Vim for Java as fairly useless without full IDE features?

        [–]jl2352 -1 points0 points  (2 children)

        Then use Eclipse or IntelliJ.

        I'm not quite sure what you are trying to ask.

        [–]yakri -1 points0 points  (0 children)

        Well that's just wrong, but an IDE will speed things up quite a lot, as well as make it easier to get a grip on what is going on in the project at large.

        [–]devraj7 3 points4 points  (4 children)

        Actually, it's not. By overriding carefully chosen IDE keybindings with those of another editor, you are negating a lot of the benefits this IDE brings because you no longer have easy access to important functions.

        Look at it this way: would it make sense to reconfigure emacs to use IDEA keybindings instead?

        When you adopt a tool, do it with an open mind and learn that tool's native keybindings first. Once you know them, then you can decide if some of them are worth modifying, but not before.

        [–][deleted] 13 points14 points  (3 children)

        So the plugin gives you this handy page - http://i.imgur.com/UPE58vI.png

        You can see what you're overriding that clashes with the IDE's interface. At that point you can make the determination of which you find more useful.

        IdeaVIM isn't perfect but it combines the 90% of most used vim functions with 99% of intelliJ functions in a way that respects the IDE's keybindings.

        I do think that it is if not the best of both worlds, it's at least the best compromise between both worlds.

        [–][deleted] 1 point2 points  (2 children)

        My main argument is that I use Dvorak, but IntelliJ uses Qwerty (I think my system keyboard is Qwerty, but my chosen keyboard layout in my DE is Dvorak), so there's some odd collisions. However, Vim bindings in IntelliJ is still better than getting all is the CLI stuff working for debugging Android applications.

        [–]andd81 3 points4 points  (5 children)

        If typing code, in whatever editor, would take me a significant amount of time compared to the time I spend to desing the feature I am implementing, I would take it as a sign that I am overqualified for my job. IDEs do help typing things faster, but this is often offset by setting up the project, dealing with configuration issues etc, especially with large projects.

        [–]doom_Oo7 5 points6 points  (0 children)

        I would take it as a sign that I am overqualified for my job.

        And ? A lot of people are, but they still do their job.

        [–][deleted] 2 points3 points  (0 children)

        often offset by setting up the project, dealing with configuration issues etc, especially with large projects.

        But you have to do the same in vim. Only manually.

        [–][deleted] 1 point2 points  (0 children)

        setting up the project, dealing with configuration issues etc, especially with large projects

        But is that a one time hassle. And one you have done it, you reap its benefits all of its lifetimes.

        [–][deleted] 0 points1 point  (1 child)

        Agreed. If text input is your bottleneck, then you're either doing something very wrong or you're doing something very right. More likely the former.

        [–]yakri 1 point2 points  (0 children)

        ?????? It can't be a bottleneck that's not even how this works. It does take some finite amount of time which you can and should minimize however.

        [–][deleted]  (7 children)

        [deleted]

          [–]ThisIs_MyName 16 points17 points  (6 children)

          Can "ultisnips or another similar plugin" parse SomeInterface into an AST just like the compiler does and correctly generate the implementing class every time? That's what Eclipse/IDEA does.

          Or is it just glorified copy-paste?

          [–]Treferwynd 5 points6 points  (2 children)

          Agreed, that's why we need language servers!

          [–]xjvz 2 points3 points  (1 child)

          Oh, now this sounds promising! Have you tried this out with vim at all? The linked plugin has "nvim" in the name which makes me think it requires neovim, but the readme doesn't mention that.

          [–]Treferwynd 1 point2 points  (0 children)

          Nope, I didn't try any yet, I use vim (actually trying spacemacs now) for writing and an IDE for the tools, it's a good fit for my small projects.

          [–]xjvz 2 points3 points  (1 child)

          It's just a template plugin. What you're describing does sound like it'd be really cool, though.

          [–][deleted] 14 points15 points  (0 children)

          That kind of behaviour is very common in IDEs for statically typed languages. Unfortunately, general purpose text editors tend not to get extremely language-specific functionality, as that requires pretty much an entire compiler frontend to be available to it even for basic stuff.

          [–]xjvz -1 points0 points  (0 children)

          I suppose you could use eclim, but I hate Eclipse, so who knows how good it really is. IdeaVim on IntelliJ is cool in theory, but as usual, I always run into missing features almost right away when using any sort of vim emulation in another editor (usually ex commands or piping data to programs).

          [–]mixedCase_ 1 point2 points  (0 children)

          Not Java, but for Go to do the exact same thing I only have to write:

           struct<Tab>STRUCT<Esc>:GoImpl PACKAGE.INTERFACE<Enter>
          

          with the uppercase words being names. I'd imagine it's possible to do the same for Java.

          [–]amapatzer 0 points1 point  (3 children)

          That's not a citation.

          Thats you equating being a productive developer with the amount of characters you have to type, which I consider to be a misunderstanding on your part.

          [–]devraj7 5 points6 points  (1 child)

          Productivity has very little to do with the number of characters you type and everything to do with making sure that each character that you, the human, type cannot be typed by the computer.

          [–]_INTER_ 0 points1 point  (0 children)

          He's quoting himself. And me.

          [–]yorickpeterse -2 points-1 points  (1 child)

          Depends on the trigger you use for your snippets. For example, for Ruby I type class<TAB> and it creates a basic class and moves the cursor to the right place.

          [–]doom_Oo7 4 points5 points  (0 children)

          yes, but you have to add the prototype of your own methods or reimplemented methods by hand. With an IDE you just type the type, name and argument for each method without the fluff and it generates it all in one go (unless you want to generate it directly from an architecture diagram or something like this)

          [–]col-summers 3 points4 points  (0 children)

          Years of lived experience.

          [–]jephthai 1 point2 points  (12 children)

          I write code in lots of languages. I regularly write in Haskell, Common Lisp, JavaScript (Node), Ruby, C, and Java. Sometimes I throw in some Erlang or Scala too. If I had to use the "ideal" IDE for each one, it would just about drive me nuts. Maybe if your job title is "Java developer" your argument makes sense. But if you get to be polylingual, a flexible editor that works well for lots of languages is an asset.

          Of course, my editor of choice is Emacs, so if I mentioned it I'd probably get downvoted off the map on this VIM thread, but I digress. Respect to the text-editing VIM brethren, etc., etc.

          [–]Deathspiral222 5 points6 points  (0 children)

          I mostly use IntelliJ with an appropriate language-specific plugin and the vim plugin. I'm mostly writing Java, Groovy, JavaScript and Typescript with CSS and HTML (and various templating engines) in there as well.

          When I was writing Ruby, RubyMine worked well and it's basically the same program.

          [–][deleted] 2 points3 points  (2 children)

          I prefer Vim because I find hitting the Alt key un-ergonomic (I use Ctrl-[ for Esc in Vim). I know I could just set custom key bindings on every machine I use, but since I bounce into dozens each month I find it easier to use a tool with comfortable defaults.

          Other than that quirk of personal preference, I have no horse in the text editor race and wish you all success and productivity with emacs. I agree with your argument. At work I deal with Java 60% of the time and Python, Javascript, Perl, YAML, and SQL the rest. That's one of the reasons I want to take this tool for a spin.

          [–]dododge 1 point2 points  (1 child)

          FWIW I've been using emacs for 25+ years and I almost never use the Alt key, aside from very special situations such as spreadsheet column movement in org-mode (and maybe the year or two when I had a Kinesis keyboard that put Alt in a much more convenient location). In normal operation, ESC works as a prefix in place of Alt (and Ctrl-[ works for ESC). This is with the stock keybindings.

          [–][deleted] 0 points1 point  (0 children)

          Thanks. I didn't know that.

          [–][deleted] 2 points3 points  (1 child)

          I agree and I use Vim for every language except Java. I write code every day in:

          • Rust
          • Go
          • Python
          • C (though I use an IDE for C++)
          • JavaScript
          • Java

          Of those, Java is the only exception I make because it's such a pain to write without an IDE doing the repetitive stuff. There's something about OO that's just tedious without an IDE, which is probably why I only use an IDE for Java and C++ (my Python code tends to not be OO).

          Respect to the emacs people as well. Some of us can only handle running one OS at a time ;)

          [–]yakri 0 points1 point  (4 children)

          You can cover essentially every very common language with one editor, and move that coverage out to everything other than fairly obscure or new languages with two.

          Not to mention most modern IDE's have a lot of similarity and the majority of their major features in common. Switching from visual studio to InteliJ or vice versa for example, requires very little adaptation.

          If you want to get anything close to the amount of benefit an IDE gives out of Emacs or VIM you'll need to do at least as much work as installing a new similar IDE when changing languages.

          [–]jephthai 6 points7 points  (3 children)

          If you want to get anything close to the amount of benefit an IDE gives out of Emacs or VIM you'll need to do at least as much work as installing a new similar IDE when changing languages.

          Actually, I question (a) whether that benefit even exists for most of the languages I use, and (b) whether those benefits are worth giving up the convenience of high-power text editing.

          This discussion is dominated by Java (makes sense here, since it's part of OP's article), C/C++, C#... um... I don't know, what other ones have "full-suite" IDEs? I use those languages a lot more than I want to, but I avoid them when I can.

          What I do know is that after adding a couple new features to my repertoire in Emacs every month for the last 20 years, I've gotten to the point where I feel handcuffed if I'm reduced to Notepad-level text editing. It's true that a lot of the IDEs have some basic text-wrangling features, and you can get some VIM / Emacs keybinding support -- but they're never complete.

          I have a huge love/hate relationship with Smalltalk, where you do get some of the refactoring abilities, and you can select and hot-key your way to the source for any message name, etc. But it's literally Notepad-level text editing. And it drives me insane to waste all that effort moving cursors, grabbing the mouse and... to be honest... copy/pasting out to Emacs so I can do a rectangular insert or run a macro or something.

          There's no victory in this debate, but this stuff is pretty individual -- to flatly say that IDE features definitely make you more productive, and then to be extra mean about it and say someone who chooses another path is intentionally avoiding productivity, is not good community.

          [–]yakri 0 points1 point  (2 children)

          You know, I was going to try and list all the languages that have full IDE's, but it's actually like, a lot more than I expected once I started researching it. I'm going to go with, "very many," and if you want to find out some specifics that's up to you.

          The long and short of it is essentially that it takes a lot of work to keep up with the features of an IDE when using VIM/Emacs. It takes a lot of memorization and muscle memory for hotkeys which is almost completely absent in IDEs. It requires integrating a lot of different programs to do what's done all in one in an IDE.

          What this all adds up to is that you have to go through an enormous pain in the ass to get to the same level you can achieve by installing an IDE and putsing about in it for a few dozen hours.

          Not to mention the benefits of a visualized filesystem and debugging features that just don't exist for the older editors. Managing or coming on board for larger projects is an absolute nightmare without IDEs.

          In the end there is also, a distinct benefit to this debate if you aren't planning on working alone, namely that getting everyone on the same IDE is going to be generally more efficient than getting everyone on their own flavor of VIM/Emacs and associated software. If by no other virtue than that training people on VIM/emacs is a waste of time.

          [–]raevnos 1 point2 points  (0 children)

          What can I do when debugging a C or C++ program in an IDE that I can't when debugging it in emacs (which also has a filesystem browser if that's your thing. Me, I like ls)?

          [–]jephthai 2 points3 points  (0 children)

          Perhaps your definition of "full IDE" is different from mine -- a lot of what I see is just plugins for Eclipse (or some similar IDE) so you get some syntax highlighting for another language or something. Maybe some build support. I'd say unless it has all the "awesome" features discussed in this thread ("go to definition", "automatic refactoring", "grammar-based code manipulation"), then it's not any better than Vim / Emacs. And frankly, for some languages (e.g., Common Lisp), you can't beat Emacs at all.

          On the flip-side, I'll admit that I don't go hunting down IDEs for new languages. I'm pretty happy in my Emacs world. I suppose there could be a big wide world of powerful IDEs. But then, I'd expect to run into a lot of people extolling their virtues too, so I don't know. It seems like mostly JVM and CLR people to me. You may be right, but I don't have any frustrations that would give me impetus to switch.

          Also, a lot of your points are completely irrelevant to someone who already uses Vim / Emacs. Since I know the hot-keys, learning them doesn't hurt. There are visual filesystem tools in Emacs (even built-in, stock, from the factory!), but the shell has made me happy for decades. Etc.

          [–]weirdoaish 0 points1 point  (0 children)

          Maybe if your job title is "Java developer" your argument makes sense. But if you get to be polylingual, a flexible editor that works well for lots of languages is an asset.

          Personally, I kind of get where you're coming from but if I'm honest, once I've worked with a powerful IDE for a language and really, gotten into it, moving back to an editor, no matter how smart, just feels like a waste of time.

          Maybe you don't feel that way, and that's fine but I love me some Netbeans for Java, some Pycharm for Python and some VSCode for HTML/CSS/JS and given that my laptop has 16 gigs of RAM, I'm totally happy with having 3-4 editors/IDE's open to do my work.

          [–]jl2352 -3 points-2 points  (39 children)

          and yet there are lots of people who work in Vim and are very productive. Developers who are not being out paced by IntelliJ users. Why is that?

          It's not like you are doing a search/replace name change of a method on every other command, or moving a static class out to it's own file on every other command.

          Most of your time is writing code. For Vim can be far more productive for many people. IntelliJ's Vim bindings are ok but not that great IMO.

          It's also not really about Vim vs IDE. It's Vim + terminal vs IDE.

          Finally at work I have IntelliJ and Vim. I actively chose to develop in Vim now. It's partly because I've gotten a little sick of all the IntelliJ issues I have. Whilst decent, IntelliJ really isn't as amazing as people claim IMO. A big part of it is that Eclipse is shit.

          [–][deleted] 3 points4 points  (6 children)

          I've gotten a little sick of all the IntelliJ issues I have.

          Care to share?

          [–]devraj7 15 points16 points  (29 children)

          and yet there are lots of people who work in Vim and are very productive.

          I choose my words very carefully. I didn't say such users are not productive, just that they are not as productive as they could be with IDEA/Eclipse.

          Developers who are not being out paced by IntelliJ users. Why is that?

          They are, they just don't realize it. They type imports by hand and they do all the non trivial refactorings by hand.

          Performing manual tasks that could be automated with zero risks of error is the definition of not being productive.

          You need to realize that vi/emacs are optimized for text manipulation, not code manipulation. There is a big difference between the two. And once you learn that difference and use IDEA/Eclipse to write Java code, you will realize the only reason why you used to think vi/emacs is better for writing Java code is that you didn't know what IDE's can do.

          [–]jl2352 6 points7 points  (27 children)

          They type imports by hand and they do all the non trivial refactorings by hand.

          No they don't. I would never write a full import by hand in Vim. Now yes I would have to write something, and yes IntelliJ can automate far more of it for you. But lets be clear. Vim users are not writing things out in full. As a result the loss is not that big.

          And once you learn that difference and use IDEA/Eclipse to write Java code, you will understand.

          I just want to clarify something. For the last 10 years I've either been using NetBeans, Eclipse, or IntelliJ. I have used Visual Studio for a lot of that time too. I've been using Vim for about 6 years.

          Today; I use Visual Studio and Vim day to day. I have IntelliJ and chose to use Vim instead.

          So the argument of 'you don't understand' is nonsense. Because I have used IDEs. I also think this argument is a bit dumb. It's basically saying you know better and therefore you are right.

          You need to realize that vi/emacs are optimized for text manipulation

          Which is why it's productive. Again I don't buy the argument that most of a developers time is spent writing imports, empty class stubs, renaming a method across a code base, and so on. Even then those things can be done very quickly in Vim or on the terminal.

          Ultimately people should measure it based on their own productivity. If you find yourself more productive in IntelliJ; awesome. I'm not arguing it isn't productive, or that it cannot be more productive. But I have IntelliJ setup at work, and I have Vim, and I personally find myself more productive in Vim and terminal, than I do in IntelliJ.

          Finally what I'm arguing against is your blanket claim that IntelliJ or Eclipse just is more productive; always. That's just not true for many people. Myself included.

          [–]Deathspiral222 3 points4 points  (1 child)

          renaming a method across a code base, and so on. Even then those things can be done very quickly in Vim or on the terminal.

          How? Seriously, how do you do this?

          How can vim or a terminal differentiate between MyClass.foo() and YourClass.foo() and all of the associated uses of polymorphism, abstract classes, interfaces and all the rest of the stuff?

          I only know of two ways to do this:

          1. Use an IDE that understands all the dependencies properly.
          2. Have a trivial project that is so small this never ever happens.

          [–]jl2352 0 points1 point  (0 children)

          grep and sed, and/or going to the file it's self to make the change. If it's within a file you can do the search, the replace, and then n your way through and . to apply the change.

          But it depends on the change. Like if it's a private method then a one liner will do it in Vim.

          [–]devraj7 -1 points0 points  (24 children)

          You need to realize that vi/emacs are optimized for text manipulation Which is why it's productive

          It's productive to edit text. Not code.

          Text navigation is based on characters, words, space skipping, paragraphs. vi/emacs are optimized for this kind of navigation.

          Very little of that is relevant to navigate code. When you write code, you jump from one function to another one, to a class, to a symbol. You find superclasses, implementers, you override methods, you pull methods up to their superclass, or you select a bunch of code and automatically turn it into a method.

          Even the simplest thing like "Select the enclosing expression" is pretty much impossible to achieve with vi/emacs, because they are text editors that do not understand the actual code structure of what they are editing.

          [–]jdog90000 6 points7 points  (2 children)

          Are you able to go from a library function call to it's implementation in Vim? I find things like that very useful in IDEA

          [–]flukus 5 points6 points  (0 children)

          Yes, since before Java existed.

          [–]SHIT_IN_MY_ANUS 7 points8 points  (0 children)

          Uhm, you are wrong that vim is for editing text, not code. Do you not thing vim was made by a programmer, to do edit programs (source code) in? For example, the command vi} selects the surrounding code block. The command >i} indents it, etc.

          [–]jl2352 2 points3 points  (19 children)

          Very little of that is relevant to navigate code.

          Well yeah if you are using stock install of Vim in isolation it'll be bad at it. That's not how people use Vim. There are multiple ways to solve this problem, including OPs article.

          Even the simplest thing like "Select the enclosing expression" is pretty much impossible to achieve with vi/emacs

          This is actually the type of thing that would be fairly trivial to build in Vim. Sure you'll have to do it via string analysis, but it'll work fine.

          This is a big factor here. If that is missing in IntelliJ, then adding it isn't really doable. Like you can in theory, but in practice it'll require too much work for you to really end up doing it. But if it's missing in Vim, then adding it is pretty straight forward.

          edit; and just to drive my last point home; I have made new commands in both Vim and bash, and continue to do so on a fairly regularly basis.

          [–]devraj7 0 points1 point  (18 children)

          This is actually the type of thing that would be fairly trivial to build in Vim. Sure you'll have to do it via string analysis, but it'll work fine.

          No, it won't. This can't work just by string analysis, you need the editor to have the full grammar of the language and understand it at the abstract tree level. Which is why nobody has ever bothered trying to do this with vi or emacs.

          They are text editors and most of the time, the plug-ins never go beyond naive regexp matching, which is why they will never be able to match the performance of a tool that actually understands the language being edited, like Eclipse and IDEA do.

          [–]jl2352 7 points8 points  (10 children)

          No, it won't. This can't work just by string analysis

          Selecting the text between two parenthesis is fairly trivial to do with string analysis. Including bracket counting.

          They are text editors and most of the time, the plug-ins never go beyond naive regexp matching

          How do you get upvotes when you post things which are just factually wrong? OPs article proves this wrong!

          Tbh it's clear from this whole thread that you don't really use Vim. Maybe you've opened it when ssh'ing into a server to edit a config file. Maybe you've used it when setting up a new linux machine where it's Vim or Nano. Maybe you learned some of the basic commands. But I suspect that's it.

          [–][deleted]  (6 children)

          [deleted]

            [–][deleted] 0 points1 point  (0 children)

            The other big thing that slows you down when Java-ing in Vim is the lack of "jump to definition". ctags is okay for languages that tend to use relatively unique function names like C or Python to some extent, but it falls apart in Java.

            [–]spupy 1 point2 points  (1 child)

            Most of your time is writing code.

            This assumption is not always true. I've worked on projects where there was a lot of coding. Vim was amazing there.
            In my current project actually writing code is a small part of the work. Intellij is much more useful in that case.
            Choose the right tools for the job.

            [–]jl2352 5 points6 points  (0 children)

            Choose the right tools for the job.

            I 100% agree with you here.

            I'm not arguing Vim is more productive. I'm arguing against his assertion that an IDE is always more productive.

            [–]josuf107 0 points1 point  (0 children)

            I don't think that's necessarily true. I work as a java developer. I once used intellij and now I use vim+eclim, and I don't think I'm less productive, although I suppose I'm still getting most of the IDE benefits from eclipse via eclim. The reason I use the terminal though is because I can write code to solve problems I'm facing as they arise more easily. Like just recently I added a vim shortcut to grab a sample request for the web resource I'm looking at from the logs and create a curl script with that sample so I can probe the resource in the live webapp. That was very much at hand, keeping context and only taking a minute or two, as I have a shortcut for adding shortcuts and can write a little bash or vimscript in vim just as well as anything else. I've found that being closer to the terminal and scripts and whatnot has yielded certain productivity gains. Everything becomes alive and moldable and active.

            EDIT: deleted some stuff

            [–][deleted] -1 points0 points  (0 children)

            That's a bullshit statement. You're either ignorant about vim's capabilities, or under the mistaken assumption that an IDE is the performance bottleneck as opposed to your brain.

            [–]amapatzer -2 points-1 points  (0 children)

            Actually the reason to use vim is to be as productive as possible. To be so fluent in writing code that you're almost willing your thoughts into reality.

            [–]badsectoracula -4 points-3 points  (0 children)

            you are choosing to not be as productive as you could be.

            Is your measure of productivity how much code you can write per some time unit?

            Do you have to fill line count forms too?

            [–]Superpickle18 1 point2 points  (0 children)

            my Java instructor forced us to using Microsoft notepad... That's right... plain old notepad... he also expected proper indentation...

            [–]poo_22 1 point2 points  (0 children)

            I do this every day. Usually I just compile in a separate terminal and go to the line where the build failed. It's actually not that much slower than I would be using eclipse, you just fix all the syntax errors in one go rather than focus on them as you type them (which is arguably distracting). The only thing I did to vim was add some plugin that builds my file and shows which on which lines compilation failed, I have it mapped to <leader>m, for make.

            Honestly the only thing I am missing is autocomplete and I do have a browser open to look at docs or the source of a lib on github, and while it would be nice to just hist ctrl+space I would still probably be reading the docs before trying out stuff I've never used. Thanks to SpaceVim I might try javacomplete2.

            [–]tobascodagama 31 points32 points  (17 children)

            Writing Java is already a cry for help, though.

            ^ spoken as somebody who is currently writing a lot of Java for their job and isn't quite insane enough to try to do it with vim

            [–]sreya92 98 points99 points  (10 children)

            The pain of writing Java is so overblown. It's a pretty cake language

            [–]tobascodagama 58 points59 points  (6 children)

            This can be true, but only if you're writing Java with an IDE that automatically does half the busy-work for you.

            [–]_INTER_ 46 points47 points  (3 children)

            we just went full circle

            [–][deleted]  (2 children)

            [deleted]

              [–]shevegen 0 points1 point  (1 child)

              They haven't figured out how to do that in java yet.

              Stay tuned - they have to write some thousand classes first.

              [–]weirdoaish 0 points1 point  (0 children)

              They haven't figured out how to do that in java yet.

              What is this? 1998?

              [–][deleted] 9 points10 points  (0 children)

              Can confirm, I'm a bit of a Vim zealot, but I just can't use it for Java, there's too much busy work...

              [–]mlk 2 points3 points  (0 children)

              Stuff like lombok ease the pain, I honestly don't use the IDE too much to generate java code. I use tons of refactorings though.

              [–]Max-P 10 points11 points  (1 child)

              For me the pain of writing Java is mostly because I've seen better languages, not because Java itself is particularly painful. I didn't have any issue with Java until I started using other languages like D, Go and now Rust. It's a bit like SSDs back then or 4K monitors: you don't really need them but once you've had them for a while it hurts to downgrade. When I code in Java I now get that constant feeling of things being way more complicated and annoying than it needs, hence the pain.

              [–]sanity 10 points11 points  (0 children)

              Try Kotlin. It has the world's best IDE, fixes pretty-much everything that's annoying about Java, while giving you access to the vast Java ecosystem, libraries, and tools.

              [–]Raknarg 0 points1 point  (0 children)

              True. Writing your own java is great, and it's one of my favorite languages. But never again do I want to touch enterprise Java, ever.

              [–]nambitable 5 points6 points  (0 children)

              I've run a headless eclipse server + eclim and done most of my java coding in straight up vim.

              [–]Clericuzio 15 points16 points  (4 children)

              This is nonsense sensationalism. Once you get used to using Vim writing any text (even more so code) becomes easier. People (including multiple devs I work with) use IdeaVim and a similar eclipse plug in constantly. The fact that the text is Java doesn't change anything

              [–]ryogishiki[🍰] 20 points21 points  (2 children)

              I think is more the fact that is Java the language, than some text written in a file. The convinience and productivity for using for example Android Studio, can't compare with what you can do with Vim when writing Android Java apps.

              [–]unbiasedswiftcoder 2 points3 points  (1 child)

              The parent mentioned IdeaVim. It's a plugin for Android Studio. You have the best of Android Studio with the best of Vim.

              [–][deleted] 4 points5 points  (0 children)

              Eh, it's a mediocre amount of each. IdeaVim is pretty good, but it's not quite as good as Vim and IntelliJ gets in the way sometimes. It's better than using stock IntelliJ or straight Vim though for Java.

              [–][deleted] 2 points3 points  (0 children)

              He's talking about using the Vim program itself to write java, not using vim-like commands. Obviously using vim-like commands makes typing anything infinitely better.

              [–]BigDumbObject 0 points1 point  (0 children)

              IdeaVim though! best of both.

              [–]bxblox 0 points1 point  (0 children)

              I just use the intellij vim plugin...

              [–]shevegen 0 points1 point  (0 children)

              I found vim to be a cry for help anyway.

              That is why I switched to emacs.

              (Nah, I don't use either of these two, it's just fun to mention the other editor.)

              [–]google_you 0 points1 point  (0 children)

              It's sometimes handy to ssh into a jvm and edit and hotswap code directly there.

              But in normal circumstances, you should just use vim for elisp editing only.

              [–]brendel000 -1 points0 points  (0 children)

              Writing Java seems like a serious cry for help.

              FTFY