This question already has an answer here:
I often see people express a preference for vi or vim for text editing or even for programming.
I've tried it and I can't see how it could possibly be any faster or easier. If you use one of them, why?
|
This question already has an answer here: I often see people express a preference for vi or vim for text editing or even for programming. I've tried it and I can't see how it could possibly be any faster or easier. If you use one of them, why? |
|||||||||||||||||||
|
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
|
Essentially it comes down to the fact that you can do whatever you want without ever leaving the keyboard. There are lots of key bindings that let you do lots of things. There is a steep learning curve for those used to graphical (mouse) editors as it is a very different way of doing things. However, once you get familiar with it, you can move around and edit files quickly. |
|||||||||||||||||||
|
|
There is two good reasons to use vim:
These two combined explains why the original vi is very popular on Unix systems in the first place. vim then fix a lot of the short comings of vi, making it even more attractive to these persons. Personally, the reasons I use vim as a replacement for notepad on Windows systems, are:
I consider it to be a power tool, which takes learning to use well. If you do not want to do that, it is not the editor for you. |
|||||||||||||||
|
|
Vi (or it's variants) is installed by default on most unix/linux systems, and its keybindings allow you to keep your fingers mostly on the homerow instead of fumbling with combinations of CTRL and ALT to do commands. |
|||||||||||
|
|
Don’t forget scriptability. I’m not talking about plug-ins here (although these are great, and in fact far superior in scope and power to other editors). I’m talking about the fact that every keyboard command can be arbitrarily combined using movement commands. For example, Now use This in itself is amazing, and cannot be approximated in any other editor (save Emacs, possibly). Now add macros recording to the mix. Press Assume you’ve got a file with some text and you need to number the lines, so that each line starts with Easy. Simply type the following (starting at the start of the first line): I 1 . ␣ q a y f v ␣ j P 0 Ctrl+A q 50 @ a Explained:
Show me any other editor that can do that. And I’ve not even mentioned search and replace. |
|||||||||||||
|
|
One uses vim if his time is valuable. Generic reasons for using a terminal-based editor over an IDE can be found in Time to drop Emacs and vi? |
|||
|
|
|
In my opinion, the biggest advantage for programmers who use vim as editor, are all about faster text editing (text object concept, macro... etc) . We all type hundreds lines of code in front of the computer screen each day, and it takes time. Why would one not want a effective way to do this ? Not to mention there are tons of good plugins make vim even better. 7 Habits For Effective Text Editing 2.0 by Bram Moolenaar Here is a good presentation about how to improve your text editing skill, by using VIM. |
|||
|
|
|
Make you efficient in text processing related work.Take some time to learn a advanced classical tool pays much more than the effort you had got involved in. |
|||
|
|
|
Another consideration, which no-one has so far mentioned, is the efficiency of vim when being used blind. By blind, I mean that you cannot see the results of what you are typing immediately, or within a reasonable time. An example of this is when you are using a connection with a long lag time where it may take several seconds between typing a character and it being echoed back to your terminal. Even half a seconds lag can make interactive editing frustrating, much more can make it nigh on impossible. A mode-less editor like I discovered this effect working on slow serial links many years ago, but it is still relevant today. Given the limitation of the speed of light on communication links, the round trip time of a signal up to a geostationary satellite and back is around 1/4 of a second. |
|||||
|
|
Vi is a bloody good editor and by extension so is vim (although I actually prefer nvi of the two, it's closer in UI to the vi I learned some 20 years ago). It's, however, not the editor I do most of my editing in, as I use the other one. |
|||
|
|
|
When I first started using Unix I tried both vi and emacs and I preferred the latter because it behaved in a way my brain expected it to. These days I use VS for Windows work and Eclipse for Linux work and emacs has been relegated to those times when I have no GUI. Why? Well, it all comes down to using the most productive tools for the job at hand. The jobs I've had recently had a much greater emphasis on testing than coding, and when there was a lot of new code to write, there was a lot of boilerplate code that could be automatically created using macros (yes, there's macros in VS). When I'm writing code, I rarely touch the mouse and with intellisense I get prompts as I type (it helps to be OK at touch typing). When I'm debugging or browsing I use the mouse so my fingers get a rest (don't want to get RSI now). To answer the question then, people use vi because it maximises their ability to type and works in the way they think (i.e. the model for editing matches their internal model of how to edit). Now, people who use an editor because "that's what all the cool people use" are probably being inefficient. As for Konrad's procedure for creating a list of numbers, it's not something I need to do often, and when I do, I'd open a spreadsheet and get that to create the list then copy and paste. Neat, definitely. A reason to use vi, hmmm. |
|||
|
|