可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
...or is vi/vim only used when developing on a non-Windows OS?
If not, what feature(s) does vim provide that modern IDEs such as Eclipse do not? Why would one elect to use vim over Eclipse (or IntelliJ, Websphere, or other feature-rich IDEs) when developing on a Windows workstation? Note that I'm referring to Java development and to some degree compiled languages, not shell scripting or other forms of scripting.
回答1:
Java is a ridiculously complicated language and I can't think of a single person who has memorized all the method parameters and return types of even the builtin classes in the JDK. Being that Java is self-documenting via JavaDoc comments and turning those into manual pages to be paged through seems pointless when you have an IDE like Eclipse that will call up the specific documentation for a particular method or class.
In short, when you're using (g)Vim, unless you're using some heavy extensions, you're flying blind most of the time and have most of the logic figured out in your head (or, you're using screen(1)
and have the man page opened on the other terminal).
I'm a big fan of Vim, but for larger, more library-heavy languages like Java, I wouldn't use anything other than Eclipse. A friend of mine once conjectured that Java development was nearly impossible without an intelligent IDE and I agree.
回答2:
When you are used to a powerful "text editor", be it vim or Emacs (no flamewars here), it can be at time very difficult to use a "lesser" text editor, like the ones provided by default by the various IDEs.
What I do is simple: sometimes I do need to do things in my .java source file that are simply done fastly under Emacs. So what do I do? I switch from my IDE to Emacs (it's one shortcut away, on another virtual desktop), do my stuff, and switch back to IntelliJ IDEA (my Java IDE of choice).
Problem is, as amphetachine pointed out: using only vim or Emacs to do Java development feels like living in the stone age.
In the best of both world the "text editor" at the center of my IDE would be Emacs (or vim) and yet feature all the shiny real-time errors/warning, code-completion, code traversal and whatnots that good Java IDEs have.
P.S: here's a +7 upvote, +4 favorites question I asked as to how to always sync .java (or other files for that matter) between Emacs and IntelliJ IDEA:
Emacs: Often switching between Emacs and my IDE's editor, how to automatically 'synch' the files?
回答3:
vim allows remote, thin-client access over Telnet or SSH, whereas Eclipse cannot. The most you can do is remote desktop, which can be inconvenient and slow. Also, vim has been developed for many, many years and some people are quite used to the environment. vim is also blazing fast, and allows dominance over the code through a multitude of key commands, if you are an expert :)
It is possible to use the features of Eclipse through vim (see Eclim -- http://eclim.org/) but this is still in development and can be unstable or hard to set up.
What you get from Eclipse is a very fast UI if you are using it locally, with lots of powerful refactoring tools. However, some people like the simple route :)
回答4:
vi editor is "mostly" used by a *nix user in a command line environment for example if the only option to connect to the Unix / Linux box is through a telnet / ssh clients.
If your client machine / desktop is for example, Linux with Genome or KDE etc, you would always prefer Eclipse type enviroments which give you rich features like creating and managing projects, connection to code repositories, easy navigation through multiple files and debugging etc.
But, I know some die-hard fans of vi or emacs who would still, invariably use vi or emacs for all practical purposes.
vi or emacs are very rich programming tools. you can do almost any king of navigation and editing with the key combination based commands. But they are a bit hard to get handy with them and even if you are an expert, working on multiple files and large projects is difficult as per my experience.
But using vi on a Windows machine is very rare and if someone does it, I can't imagine the reason behind.
回答5:
See answer to this question:
Despite Vim's multitude of plugins, nothing comes close to the language-aware refactoring and coding capabilities of the modern IDE.
When you work with large projects, powerful editor is never enough. You need to be able to navigate through hundreds of classes, find all usages, overrides and stuff. You need to be able to refactor your code easily. IntelliJ IDEA and Netbeans have plenty of functionality and shortcuts that are specifically targeted at java development. Vim is a great tool, but java is better suited for IDEs, and you should use this to your advantage.
回答6:
I was a hardcore vim user, but I switched over to Eclipse.
There are two vi plugins/keybindings for it. One is free, the other is commercial. I preferred the commercial one: seems to work better for certain things.
Eclipse can do a lot of things that gvim can't do (or make them easier).
Compiling/debugging/running.
Setting up build environment.
Javadocs, code completion, etc.
Refactoring, source control pluins, code organizing.
Project setup, etc. It's easy to share a project with other developers. Lots of FOSS java projects have eclipse files for easy setup.
Just to name a few.
回答7:
Download gvim for windows, it seems exactly the same as the linux equivalent.
回答8:
Vim also does syntax highlighting for multiple programming languages. This, along with the keyboard shortcuts, makes it a better tool for making minor code changes than launching Eclipse and going to the relevant file.