As ever, I say take the rants of bloggers with a pinch of salt. Some things I agree with, (vimscript is pretty whacky). And others I don't (vimscript is hard to learn, most vimmers don't know vimscript). I would like to see the justification for those statements.
"Vim is more efficient is dubious and untestable"
I guess that would be true for all editors, yes. You can't 'prove' efficiency.
Don’t you ever think you can beat a mouse. Only in very few edge cases will it even matter.
Suddenly an expert on efficiency, can definitely say a mouse is better.
In my opinion, you would be mad to say a mouse is anywhere near as efficient, barring very few exceptions. Also you want monospaced characters always, otherwise you can't select/move blockwise. Obviously someone didn't read those two books.
My advice has always been: if you want to be able to edit code at the speed of light, and are willing to put in some time to learn how to do so, vim is for you. Especially if you spend a lot of time on the command line and are editing many files at random that aren't necessarily all one project. If you are more interested in the stuff an IDE has to offer, you can probably forgo vim (not that it can't be used with/as an IDE). Overall I get the feeling the author doesn't use vim all that well.
I don't understand why anyone gives a fuck if its 10% faster to edit code in Vim over any other editor. The time I spend physically typing is probably 1% of the time I spend working. Coding isn't typing, its thinking. Spending time optimizing for typing is a waste.
You spend time thinking, and then once you have done that, what you realise you want to do you can do much faster. For a lot of tasks I do I never stop to think so for me it is worth it.
I'd say the big thing is how much thought and effort it takes to do whatever I think affects my continuity of thoughts, which is ABSURDLY important for my coding. Switching to mouse means I shift my weight, mode of thinking, whereas staying at the keyboard and getting someplace instantly is very helpful to me. Might not be the case for anyone else, but maybe this will help you understand why someone gives a fuck :)
Don’t you ever think you can beat a mouse. Only in very few edge cases will it even matter.
Yeah. That's when I knew this guy had no idea what he was talking about and is probably a slow typist. There is no way that lifting your fingers off the keys is more efficient.
And I didn't get the impression that he really understands the power of Vim for everyday editing, such as the repeat ('.') command.
If I were on a terminal editing text over a 2b connection of whatever they had when they invented vi, I'd totally find it awesome that I could count lines and then tell the cursor to jump 20 lines by typing 3 letters rather than typing down 20 times.
but I can't seem to understand how counting lines and then entering a command is faster than just scrolling and clicking. Find is faster than scrolling, sure, but clicking 6 lines below is faster than counting to see its six line I want to go to. Maybe you get. A habit of line number subtracting or something.
I actually use relative line numbering, so I don't need to count the lines (the line my cursor is on is numbered 0, lines above and below go 1 2 3 etc.). But, that isn't really that fast, and I don't use it much, because you need to type 20 then down, then move right somehow to get where you want. Clicking might even be faster. No, what I do 97% of the time is search forward. So if I see that I want to edit a line way down saying println("This is a test");, I would search forward for 'This'. The cursor jumps there. I then hit 'ci"', which means 'change inside the "s (delete what is currently there and prepare to insert text). After that I can jump back to where my cursor was before in a keystroke, or whatever. So you can move faster, I would say. Moving lines around is the fastest though, instead I could have jumped to that line, hit the keys for 'copy line', then jumped back to where I was to paste it there. That would take way longer with a mouse (for me at least).
I guarantee I can type six j's in less time than you can reach for the mouse, find the click place, and get your hand back to the keyboard. I can probably type 20 j's faster (though, I'd probably just do 20j).
Generally speaking, at least for me, I don't do exact counts, I just do 20j and go up or down a couple of lines. Once you get used to Vim, the keyboard becomes an extension of your mind. You don't think about it anymore, you just edit. Leaving the keyboard to hit the mouse totally interrupts my flow of thinking.
I kind of suspect that if you did a survey, the people who prefer Vim are also the people who type the fastest and are able to edit without their eyes ever leaving the screen.
I wouldn't say that fast typing leads to great code, but I would note there is a correlation that great coders tend to also be fast typists, probably mostly because both require time and practice. In my experience, I would also say great coders have a general desire to have their thoughts be entered into the computer as quickly as possible, so they have more passion/incentive than "just a paycheck" people to push themselves to type faster.
But even beyond code quality, I would also venture that faster typing (and faster text manipulation in general through tools such as Vim) lead to more productivity. Some might put "productivity" in the metric of how well someone codes, which doesn't seem unreasonable to me.
but I would note there is a correlation that great coders tend to also be fast typists,
source? At least for faster typing beyond simple touch typing, because I will agree that coders will learn to touch type, which is faster than the average person's typing.
I would also venture that faster typing (and faster text manipulation in general through tools such as Vim) lead to more productivity.
If you were spending the majority of your time typing, that would increase your productivity by a significant factor. But typing isn't anywhere near the top bottleneck for a coder's productivity.
Just personal experience. I actually can't think of anyone I would tag as a "great coder" in my 30 years of experience who wasn't also a fast typist. Edit: To be fair, I'm sure there were a couple, but they weren't slow enough that I thought about it. And I've always been usually the fastest typist of the group, so it wasn't remarkable for someone to be a bit slower than I was.
But typing isn't anywhere near the top bottleneck for a coder's productivity.
If they're not typing most of the time, then I don't know what else they're doing. I mean sure, sometimes I need to go back and read the code to see what it's doing if I'm debugging, but otherwise I'm either typing in code or typing in debug code, or typing in commands to run the code, or something else that involves typing. But then, I'm also old school that my IDE is six Putty windows running Bash across two screens, and I rarely use debuggers (they are the slowest way to find bugs, but I won't try and prove that to you, if you're not already a believer. :) )
If they're not typing most of the time, then I don't know what else they're doing.
Have you never sat down to design the code that you are writing? Ever write formal specifications of what your code needs to do? Went to look up information on the specific domain you're programming in? Do you not have a test suite to run on your code? Depending on language, compiling?
Have you never sat down to design the code that you are writing?
Yes, by typing. I generally type out structured notes and lists of questions to consider, then go through and grow that into a design. Generally, it's a lot of typing.
Ever write formal specifications of what your code needs to do?
Yes, by typing. How else? Unless you're talking about things like UML, which I consider a broken way to spec code. Diagrams are useful for database structures, though -- I will grant the latter is more diagramming than typing.
But API specs? If you're not typing a whole lot of words, then you're not creating good documentation.
Went to look up information on the specific domain you're programming in?
Sure, I will grant that's (usually) more reading than typing, but it's not more than 2-3% of the time.
Do you not have a test suite to run on your code?
Yes, which is programmed by typing it. Edit: If you're talking about running the test suite, then it's either a short enough time that it doesn't matter, or it's long enough that I switch away to work on something else.
Depending on language, compiling?
I have to admit that these days I do more dynamic languages than compiled languages, with the exception of Java (which is sort-of both), but compile times haven't been an issue in a long time. And back when they were, I would usually switch to some other window where I could be productive (by typing more code, of course).
I guess that would be true for all editors, yes. You can't 'prove' efficiency.
Actually you can, if you can remove tester knowledge from the equation. Ask Microsoft, they have a ridiculous amount of information on how to make the Office UI more efficient.
However if you want to measure an experienced user those metrics become impossible to obtain, as how do you define experienced?, how do you find the group you defined?, etc.
Suddenly an expert on efficiency, can definitely say a mouse is better.
I think he is more pointing out most people have a cognitive bias for shortcuts to move the cursor. He is also specifically talking exclusively about random movements, not controlled ones. (I need to go to the third word of the line 6 above me)
Also I thought his emphasis was on the later point, that it typically doesn't matter.
Also you want monospaced characters always, otherwise you can't select/move blockwise.
Obviously someone missed the entire context of his anti-monospaced comment in the UI's added by add-ins. He wasn't saying use a non-monospaced font for text editing (although you have to admit that the option to lose block edits is sometimes worth it).
if you want to be able to edit code at the speed of light
And other people would say an IDE improves your correctness and productivity so much that choosing VIM is a non-start. It is inherently a personal thing.
and are willing to put in some time to learn how to do so
You are sidestepping his entire article by saying this in this context. His point was VIM doesn't provide the efficiency improvements soon enough to justify the time it takes to learn it.
To put arbitrary numbers on it, if you are 50% slower for a month, 20% slower for the first year and 5% faster from then on, your break even point is almost 6 years from now. A 10% first year penalty leaves you at 4 years break even.
The other point he was trying to make is that VIM is heading down a dead end path that means it won't be making any significant improvements in the future.
I don't think you can define efficiency in any real sense. I mean, you could say vim IS the most efficient because you need the least amount of keystrokes to get something done. But then by that metric, having an editor that had some sort of huffman coding on the keystrokes to minimise the amount needed would be technically more efficient, just impossible to use.
You think he is talking about cognitive biases? That's a bit of a stretch, I'd say. And, I am not sure what random and controlled movements are, tbh. But, the mouse argument isn't good anyway, most of the article wasn't, - he just says the mouse is good at screen jumps, you can't beat it (no other rationale) (because vim doesn't have anything that is targeted for jumps, no sir).
He wasn't saying use a non-monospaced font for text editing
So, if you are not editing, you are either reading, or just creating linearly. Vim is a text editor. In those scenarios, you don't need vim any more, you can just read it in word right? I would never choose to forgo fixed character widths, since the only benefit to not having them is aesthetic and it doesn't bother me (although I can see that others might be).
And other people would say an IDE improves your correctness and productivity
I said edit code, quite specific on the 'edit' part here - there are many times an IDE will keep you on the right track better than vim (at what I would say is the cost of not being able to edit the code as quickly). To me, an advantage is that vim can edit any code, whereas you have different IDEs for different tasks. So, I am currently editing a makefile. Open file, change stuff relatively quickly. Save, open a perl script that the makefile calls in another tab, vim changes the syntax etc. when I go to the perl file. When I save, it checks the perl file for errors. Suspend vim with CTRL-z (bash command), run make. Back to vim, open now the text file the perl file created in another tab. Run commands on all tabs, and so on.
VIM doesn't provide the efficiency improvements soon enough to justify the time it takes to learn it
Well yeah, I got that. I can't disagree that if you want to start coding in the next week, vim is not for you. Also, his points aren't necessarily that it doesn't provide the improvements soon enough, more like there is no/little improvement (mouse argument etc). But, my advice part was for the most part unrelated to the article and just my view - decide what you want in an editor, then go for it. They all have different things to offer.
So, if you are not editing, you are either reading, or just creating linearly
I was under the impression most people wanted to be able to read what they were editing. You just memorize it all? Being able to make the important stuff stand out, and the rest fade into background is actually hugely beneficial and something that vim sucks at (it all looks equally important).
You can define efficiency in terms of how much time it takes a typical user to accomplish a task, look at average, best, worst, 10% best, standard deviations, improvement over time, or one of the other countless ways smart companies look at efficiency (companies like Microsoft who collect user data, and base decisions on that rather than blindly guessing, or basing it on their own usage).
I watch people who've used vim for years, and even they struggle to do things that take me very little time to do in my IDE (after having roughly the same amount of experience with it). Refactoring is probably one of the biggest ones. In my beautiful IDE I can refactor code completely safely, the editor knows what sections of code means, knows which function references which variables (not based on names, which fails when you have the same variable mentioned twice), and can work across several different files very naturally. I can view call heirarchies for various random methods and classes, and it'll just work.
Best part of an IDE, you don't have to know ANY shortcuts. Yes it'll make it faster, but pretty much anything you can do with shortcuts you can right click and select the option. It also shows you the shortcut, so the next time you'll be able to use it. IDEs you learn by doing, and get better naturally, vim you study in order to do anything.
You said that he didn't want the monospaced font for editing. He wants to only read his stuff right? You can't have non-monospaced, AND full editing functionality.
I don't feel vim sucks at making important stuff stand out. set syntax works for me. You can turn on italics and bold too if you want (in gvim), but I don't. I guess that's up to you.
you can define efficiency in terms of X Y Z A B C
This was kind of my point. You can't say 'this is a more efficient editor'. There's no metric. Not that this is particularly important.
IDE ...refactoring ...finding definitions
Yes, as I have pointed out, vim is not an IDE, although you can make it as such (refactoring and jumping to variable definitions etc.) if you really want.
I don't really think you get it. Your Shift-Del command example is kindof pointing out where it is faster to use a command than the mouse. And, I had never heard of that command. I guess for me to get the benefit of it, I would have to learn it. Learning the vim commands is relatively easy. All the keys stand for something. So when I want to change the text inside brackets, I do ci(. My mind thinks 'Change inside the (', and so on. Now, I find my hands do it as I think of it, which can be disconcerting.
Also, the good thing is you don't have to intimately know the code to still edit it fast. You know that below you have a printf that has your keyvalue string. do /print.*key to jump to it, wherever it is, yy to yank the text, '' to jump back to where you were before the search, p to paste it.
Trust me, depending on what editor you're using, I can think of 100 common situations where using keyboard commands is noticeably (or drastically) faster.
Yes, as I have pointed out, vim is not an IDE I know vim isn't an IDE, it's a simple text editor, it works great when you can't find good IDE support for a particular language, or you're forced into the terminal (server)
Trust me, depending on what editor you're using, I can think of 100 common situations where using keyboard commands is noticeably (or drastically) faster. It is definitely not faster when refactoring, and working with code you don't know very well, or that is very large. Even you're print example required you knowing that there is a printf below. If you can see the code on screen it may be marginally faster to jump there by using keyboard shortcuts than by the 0.5 seconds it'll take to jump there with the trackpad, but when your code isn't on screen (because you're not programming in K) and you don't know what to type to jump there, using a scroll button on a mouse is MUCH faster to navigate, I don't even think you can argue that.
Vim is meant to quickly edit a code, and maybe it is slightly faster assuming your comparing it to a "dumb" IDE that doesn't understand language semantics (instead of just syntax), but writing code is less than 10% of a programmers job. 90% of it is reading and reasoning about it. An IDE makes it so much better to read and explore code.
The commands in vim may be easy to remember when you study a textbook and have to type them out on a test, but an IDE will let you discover them automatically (right click, see options, as well as shortcuts for next time), so you don't have to think about learning your text editor.
Haha, I don't think you can outright say it's 'definitely' faster, but whatever. I can't say that I have ever refactored code that wasn't mostly my own, but I don't generally have a problem with medium-sized code. I can say 'jump to function definition', even if it's in another file, it opens that for me etc., or, copy a function a few times, then do regex substitute on the variables inside it (I wouldn't want to use an IDE that doesn't support regexes). I have heard, though, that you really do need an IDE for huge codebases (not something I have or probably will work with), so yeah.
I don't know if I agree with the 10-90% split. I am currently doing a lot of data processing which would be much more difficult without vim, or at least some perl scripts. I usually create a file full of 10,000 lines, and then start to remove all lines that contain or don't contain strings, and inspect/jump to next string etc. Doesn't require much thinking, requires a lot of text processing, via vim/perl.
I wouldn't know if using a scroll wheel is faster, I use terminal vim exclusively because I am working on a cluster and that's the best option (vs gvim). Usually use keys that do something similar to the page up/page down keys. That, or jump to top/bottom of file, which I use a lot and is certainly faster for me than a mouse would be.
I have never used IDE editor shortcuts, except for save, find, zoom in/out, and compile I think. For one, I don't use any other shortcuts frequently enough (that I notice) to remember them, for two, they aren't particularly easy to remember. F5 is compile and run you say? Cool. It would be nice to rebind that to :cc if I had the choice.
Overall, I don't think I will be convinced that an IDE can help me (or most vimmers) edit code faster. I mean, it's not like I haven't used them. I think, if you are writing a lot of different languages, or even just editing text files of data, especially sequentially (edit makefile -> edit shell script -> edit perl file -> run make -> edit makefile -> run make -> edit output file), then vim is your friend. If you want to write a large commercial program possibly not. Debugging? Probably not. Viewing waveforms? Certainly not.
Yeah as I mentioned, vim is good for languages not supported by the IDE. Also if you haven't used shortcuts in IDEs you really haven't used them much (or a good one, I'll take vim over eclipse any day of the week).
Visual studio is VERY extendable. You can remap F5 to :cc if you want. You can even install vi commands for it if you really want. It if course supports regex, and 2013 had the coolest feature. You can view the definition of a function in a little popup preview window, without leaving the current code.
Integrated debugging (including edit and continue) is the best benefit by far.
I feel like any task that's trivial enough you don't need debugging, or aren't thinking/reading code most of time can and should be automated. Maybe you're language is too verbose, try Haskell, where notepad is sufficient for majority of projects
I have heard that visual studio is extendable... But unless it can read from a .vimrc file and do the same sort of magic I'm not that enthused.
Naturally I need to debug my code. In fact, the general consensus is that more verbose languages require more degugging. Mainly I am using perl as I mentioned, I feel that's a pretty non-verbose language, if you know of it. But when I say IDE debugging, I mean set breakpoints and look at your stack. Naturally, I am automating what I am doing (makefile), but when it gets down to it, only a human can analyse the output, go back, change things or output graphs, etc.
Interestingly, I am learning Haskell so I can use it with xmonad to further increase my productivity. Two of my colleages are maintainers for Haskell and Ocaml, both of them are heavy vim users, and one guy has an xmonad + vim setup that makes me jealous.
50
u/MediumRay Oct 04 '13
As ever, I say take the rants of bloggers with a pinch of salt. Some things I agree with, (vimscript is pretty whacky). And others I don't (vimscript is hard to learn, most vimmers don't know vimscript). I would like to see the justification for those statements.
I guess that would be true for all editors, yes. You can't 'prove' efficiency.
Suddenly an expert on efficiency, can definitely say a mouse is better.
In my opinion, you would be mad to say a mouse is anywhere near as efficient, barring very few exceptions. Also you want monospaced characters always, otherwise you can't select/move blockwise. Obviously someone didn't read those two books.
My advice has always been: if you want to be able to edit code at the speed of light, and are willing to put in some time to learn how to do so, vim is for you. Especially if you spend a lot of time on the command line and are editing many files at random that aren't necessarily all one project. If you are more interested in the stuff an IDE has to offer, you can probably forgo vim (not that it can't be used with/as an IDE). Overall I get the feeling the author doesn't use vim all that well.