Also, if you use a GUI version of Vim, then it knows about "paste" and doesn't make the mistake of interpreting your paste buffer as keystrokes.
These consecutive key presses ("chords") are just there to provide default bindings and are one of Emacs' weakest points since they're universally horrid. However, there's no single best way to use Emacs[1]: everyone should configure it how they want it to. After years of using my own key bindings I've streamlined them with the rest of my OS[2] and couldn't be happier.
[1] Opposite IMHO to Vi(m) where one should use the default key bindings.
[2] CTRL/CMD-o to open a file, C-s to save, C-f for incremental search, etc.
Another advantage of vim is that most of the time at work I am working on a PC but editing files on Linux boxes. At home I am on a mac. I know I could run X, but I prefer running Putty, and I enjoy the lightweight nature of just bringing up vim. So, currently, vim is my editor of choice.
Also, I must admit that after 20+ years of using vi/vim, I still make the occasional mode mistake and type 'i' when in insert mode, or ':wq', but vim is still my favourite editor.
I guess I could go back to trying to hack together an IDE in emacs or vim with a bunch of buggy, half-supported third party plugins that interoperate poorly if at all, but why?
I've had a quad-core desktop chug under Eclipse (employer required I use it) and still had to fall back to a real editor regularly.
> I guess I could go back to trying to hack together an IDE in emacs or vim with a bunch of buggy, half-supported third party plugins that interoperate poorly if at all, but why?
Well, mostly people use the well-maintained, integrated, and first-party ones instead. Each to his own, I suppose!
If you are using vim, you should play per vim rules. When you are entering text, you enter insert mode. When you are done, back to command mode. Once you have that mental model, you don't try to c-v(or c-shift-v or whatever) in command mode. Also, if you are willing to try vim, grab a vim build with clipboard support and copy-paste from within vim(=+p paste clipboard, =p paste x selection, =+y{motion} copy to clipboard ... in command mode; or ctrl-r+ paste from clipboard, ctrl-r paste from x selection in insert mode)
> I find the concepts of modes jarring, even antiquated.
The thing I like about vim is translating intent to vim commands - delete 10 lines and then move to the top of the file 10ddG, delete everything inside these parens and put me in insert mode cib etc. Without modes, these won't be as short and sweet. You will be left with long key combinations - the way emacs does it.
> Emacs is better in this regard but I find Emacs's need to consecutive key presses (or a key press followed by a command) to be longwinded.
Isn't that obvious? If you always want to be in insert mode, how else will the special instructions be entered?
> The advantage of either is they're easy to use over ssh+screen (or tmux) for resuming sessions.
And they are very good at editing text, and majority of programming languages, though might require some configuration.
> For statically typed languages (eg Java/C#), IDEs (quite rightly) rule supreme. Static code analysis, auto-completion, etc are just so much better than text-based editors.
I generally am able to find something for Vim which makes language specific stuff easy.
Clojure - http://www.vim.org/scripts/script.php?script_id=2501 Java - http://eclim.org/ Go - https://github.com/nsf/gocode C - http://www.vim.org/scripts/script.php?script_id=3302 Python - http://rope.sourceforge.net/ropevim.html
And a lot more...
> I tend to think the speed differences over not using the mouse are largely illusory.
Doesn't that depend on the task? What will be faster - ctrl-f on this page or clicking edit(or some menu)->find?
Also, for me, it is more about having my fingers on home row is the sweet spot and moving my fingers from my sweet spot is irritating.
This issue is that studies show us vim's rules are wrong: modal editing is a source of confusion and error. I used vi[m] exclusively for 8 years or so and until the very last day I could still make major modal based errors.
The so called studies show people who aren't used to modes are confused when using a modal editor.
> I used vi[m] exclusively for 8 years or so and until the very last day I could still make major modal based errors.
I have been using vim exclusively for 5 years now. And I stopped making modal based errors after 2 weeks. My anecdote cancels yours?
From what I have seen, people who leave vim in insert mode are the ones making mode errors. Insert mode isn't the rest mode for vim, normal mode is. You are bound to make errors when starting because out of habit, your mind assumes insert mode as the rest state.
"Don't listen to this study, listen to my firmly held belief". That's not how this works. If you want to combat a study you need to do so with another one, not by just saying throwing out untested assumptions.
>From what I have seen, people who leave vim in insert mode are the ones making mode errors. Insert mode isn't the rest mode for vim, normal mode is. You are bound to make errors when starting because out of habit, your mind assumes insert mode as the rest state.
Thanks for the condescension. Have you ever started to type a word and had your hands just finish it for you? Sometimes there will be some relatively large word that I type out commonly enough that when my hands notice the first few letters of it they'll type it out automatically with me having to go back and delete it and type out the similar starting word I meant to write. I even recall having my hands do it again on the correction once.
Having this kind of muscle memory is a killer for vi usage. Lots of times I have intentionally left the editor in insert mode for just a second while I grab some text from, say, a website to paste in. What I didn't realize is that my hands knew to always get back to command mode when changing screens so even though my mind had tried to save keystrokes my hands defeated me. The result? Pasted a huge document into command mode. Great. Similar sync issues came up regularly enough that I typically mashed Esc 2-4 times (in case there was, e.g. a command active that would write in the Esc char) rapidly before starting anything to ensure that I was where I thought I was.
In my experience, I wouldn't get the time savings I should have been getting due to having to slow down for the mode management.
Yeah. Combat the studies that you totally provided the link to. Throwing claims around saying "scientists say that" or "studies have proved that" is surely not how it works.
> Thanks for the condescension.
What part was condescending? Leaving vim in insert mode causes errors? The rest state of vim is normal mode?
> Having this kind of muscle memory is a killer for vi usage for you
You are extrapolating personal anecdotes to absolutes.
Also it occurs to me that I may do some of those things like mashing esc repeatedly just to be sure subconsciously.
You can just show that the methodology is flawed, no need to repeat the experiments in all cases
If using vim is wrong, I don't want to be right.
Honestly, I can believe such studies, and I still would use vim.
One, my shoulder gets tired and sometimes hurts if I move back and forth between keyboard and mouse too much.
Two, by the time I move to the mouse and back, I could have done the equivalent twice on the keyboard and moved on.
Three, there is nothing sweeter than "How did you do that?" :)
>Two, by the time I move to the mouse and back, I could have done the equivalent twice on the keyboard and moved on.
Vim got this part right, and it ends up being better than Emacs in that regard: in Emacs you also don't need the mouse but all the chording requires moving the hands too much. Ideal would be to take Emacs' non-modal editing and combine it with Vi's simply edit mode: for example, say you are in "command mode" only if you hold down Caps lock, but when the button isn't held down the editor is always in insert mode.
Bret mentions Larry Tesla (starting at about 38:10) who made it his personal mission to eliminate modes from software.
This is the problem I've always had with Vim and I suspect I'm not alone in this. I find the concepts of modes jarring, even antiquated. Everyone who has used vi(m) has copied and pasted text in while in command mode and done who knows what.
Emacs is better in this regard but I find Emacs's need to consecutive key presses (or a key press followed by a command) to be longwinded.
The advantage of either is they're easy to use over ssh+screen (or tmux) for resuming sessions.
That all being said, give me a functional IDE any day. IDEs understand the language syntax. Vim can do a reasonable job of this. Emacs (with elisp) seems to do a better job (or so it appears; I'm no expert) but IDEs (my personal favourite being IntelliJ) just make everything easier. Things as simple as left-clicking on a method and going to its definition.
For statically typed languages (eg Java/C#), IDEs (quite rightly) rule supreme. Static code analysis, auto-completion, etc are just so much better than text-based editors.
Dynamic languages are more of a mixed bag and its certainly the norm for, say, Python and Ruby programmers to use one of these.
Still, give me an IDE any day.
One objection seems to be that people don't like using the mouse. I tend to think the speed differences over not using the mouse are largely illusory.
Anyway, I can use vim but I've never felt comfortable in it and I don't think I ever will and modes are the primary reason.
EDIT: I realize there are plugins and workarounds for many of these things but that's kinda the point: I don't want to spend hours/days/weeks/years messing with my config to get it "just right".
Also, instead of archaic commands to, say, find matching opening/closing braces (which tend to involve an imperfect understanding of the language), IntelliJ just highlights matching braces/parentheses, where a variable is used and so on.
[1[: http://www.youtube.com/watch?v=PUv66718DII