Here is the key stroke count I get expressed in a step-by-step manner:
;; Type M-< (Alt+<) to invoke beginning-of-buffer:
1. Alt
2. Shift
3. ,
;; Type C-M-% (Ctrl+Alt+%) to invoke query-replace-regexp:
4. Ctrl
5. Alt
6. Shift
7. 5
;; Enter the regexp pattern "f.." at the prompt:
8. f
9. .
10. .
11. Enter
;; Enter the to-string "bar" at the prompt:
12. b
13. a
14. r
15. Enter
;; Type ! to replace all matches in the buffer:
16. Shift
17. 1
> and a lot more keys off the home row. Four keys at once is quite a bit slower for many people than two or even three.
Yes, indeed. The Emacs default key bindings are not the most ergonomic ones. To be fair though, the more common operation is M-% (Alt+%) which is a three finger chord.
Also, if one dislikes a four finger chord, there are other alternatives. For example, https://news.ycombinator.com/item?id=26435874 . Or one can customize Emacs and map regex-based replacement to a more convenient key sequence.:
With that, the key sequence is now C-c C-r f.. <enter> bar <enter> ! which is 13 key strokes. I know I am violating my own assumption of "no customization" in this thread so far. If we allow customization, both Vim and Emacs can do very amazing things.
Having said that, I just use C-M-% when I do need regex-based search and replace. Otherwise, for most situations M-% suffices.
By the way, I am not claiming in my comments that the default Emacs key-bindings are superior to Vim. If we go back to where this thread started (https://news.ycombinator.com/item?id=26431864), I was only trying to show that a simple string replacement in Emacs is not as ridiculously complicated as the humorous image post in that comment made it out to be.
In my experience, the vanilla Vim key strokes are more convenient in some areas (e.g., o, O, gg, G, etc.) and the vanilla Emacs ones at other areas (e.g., C-x C-o for delete-blank-lines, M-\ for delete-horizontal space, M-q for fill-paragraph that I like quite more than Vim's gqq or gqap). If we talk about key sequences only, I don't think there is a clear winner. But if we start talking about functionality, extensibility, and customizability, that would be a whole different discussion where Emacs has a lot to offer.
I get 19 here, and a lot more keys off the home row. Four keys at once is quite a bit slower for many people than two or even three.