8 ms·
Thank you for posting this and giving me a reason to reread my all time favorite greentext: https://i.imgur.com/WLzeQMj.png https://i.imgur.com/WLzeQMj.png
by visviva 6y ago
Thank you for posting this and giving me a reason to reread my all time favorite greentext: https://i.imgur.com/WLzeQMj.png https://i.imgur.com/WLzeQMj.png
- susam 6y agoI know the image post in your comment exaggerates the Emacs input sequence for humorous effect but I got curious and decided to count the actual keystrokes for a real world common use case. Say, we want to replace one string with another, e.g., "foo" with "bar" as it appears in your image post. So assuming that we need simple string replacement, not regex-based replacement, and also assuming that we have vanilla Vim, vanilla Emacs, no customization, and US layout keyboard, Emacs seems to be at par with Vim. On Vim: <Shift>+; (:) <Shift>+5 (%) s/foo/bar/g <Enter> (16 key strokes) On Emacs: <Alt>+<Shift>+, (M-<) Alt+Shift+5 (M-%) foo <Enter> bar <Enter> <Shift>+1 (!) (16 key strokes) Now I know some of you might observe that I have not counted the initial <Esc> to escape to normal mode and the final i to enter insert mode again in Vim. That is correct, however, I find that experienced Vim users keep themselves in the normal mode most of the time. The normal mode is really the normal mode and the insert mode is a special mode that they get into for short periods of time to insert text. Also, they rarely use i to enter insert mode. Instead, they usually o, O, a, A, I, c<motion>, c<text-object>, etc. to enter insert mode. Then they return to normal mode again as soon as they are done inserting text, so I don't think it is fair to count the overhead of <Esc> and i while counting Vim key strokes.
- 01100011 6y agoConsider remapping ';' to ':' if you use vim a lot. Something like: " Use ; rather than : for commands nore ; : nore , ;
- pindab0ter 6y agoSee, I never understood these tips. If I use Vim a lot I will build muscle memory. If I build the muscle memory with these adjustments I’ll just keep tripping over myself whenever I edit a file on a station without those adjustments. And simply foregoing the shift key isn’t even that much of a time or effort save.
- cassepipe 6y agoThis. I really like the pedal idea but I won't ever get it cause I don't want to have to move around with it.
- emptyparadise 6y agoI personally spend a lot more time at my own machine than at anybody else's, so the rare muscle memory fault while deep in SSH bothers me a lot less than uncomfortable defaults.
- Lio 6y agoTotally agree with this. For me, editing is like using a musical instrument; you want to get to the point where you're not using much conscious thought to do things quickly. How you do that doesn't really mater to much. Many years ago (10 maybe?) I switched to the Colemak layout to help with an RSI. That messes up the vi home row navigation keys. For a while I tried remapping jkl but since that's not very portable to other vi-like software on my own machine. I gave up and just used muscle memory for new locations of those keys. That works surprisingly well for me. I like Vim but I'm pretty sure that a competent emacs user would have very similar relationship with its keyboard interface.
- interactivecode 6y agoOr with a regular text editor: Shift+ctrl+<- bar Way easier than either vim or emacs
- Hedepig 6y agoRegular search? I do '/ bar' on my emacs setup (Doom)
- susam 6y agoAdding further to my previous comment: What if we really need to do regex, say replace "f.." with "bar"? The input sequences then look like this: On Vim: <Shift>+; (:) <Shift>+5 (%) s/f../bar/g <Enter> (16 key strokes) On Emacs: <Alt>+<Shift>+, (M-<) Ctrl+Alt+Shift+5 (C-M-%) f.. <Enter> bar <Enter> <Shift>+1 (!) (17 key strokes) Although, the number of key strokes are close to each other for both Vim and Emacs, I am pretty sure most beginners would feel there is a slightly increased cognitive overhead involved in Emacs when compared to Vim. The Vim input sequence is just : to invoke the command line mode, followed by an ed-style substitute command. However, the Emacs input sequence is M-< (beginning-of-buffer), C-M-% (query-replace-regexp), pattern, replacement-string and ! (to prevent further prompts). For an experienced Emacs user, all of this becomes muscle memory and becomes as efficient, if not more, as the Vim equivalent pretty soon. Also, there is evil-mode in Evil for those who really want the Vim-editing experience along with the power of extensibility that Emacs offers.
- melling 6y agoWhen you spend hours in your editor, day after day, you aren’t a beginner for long
- lars512 6y agoThat’s unfortunately not my experience from observing other engineers. Many get stuck at a “good enough” level with their tools and never seem to learn the shortcuts which would allow them to code and edit faster.
- mvolfik 6y agoYes, that's exactly my experience with Emacs - I read their tutorial to do basic tasks (open files, open windows, switch windows, basic replace). Also, I never learned to use their "smart" (?) terminal, python console... Otoh, then I tried Pycharm community, and eventually redeemed my github student pack for free pro version, and now I can't imagine living without it. Also there's a great plugin that annoys you with small non-modal popup in LB corner whenever you use mouse and reminds you of the correct hotkey
- mfontani 6y ago> On Vim: <Shift>+; (:) nnoremap ; : I've never missed the default behaviour of ";" (to repeat the last "t"-like command), and the above has helped me tremendously
- penguin_booze 6y agoI, on the other hand, use ';' quite heavily: void theWorldsLongestFunction(int way, int too, int many, int parameters); Then, 0f,;;; Is my self-approved way to jump through the parameters.
- Lio 6y agoI use ; a lot. However I don't mind using shift as I always press it with the opposite hand to one that's pressing the key to be shifted. I also use a lot insert mode Ctrl commands. I think any keyboard interface that you can use without looking at the keyboard is Ok by me. I would probably be happy enough in emacs even with all the weird cording but I'm just too wedded to Vim at this point to want to change.
- nemoniac 6y agoEmacs users consider a keychord as a single action so that would be 2 keychords plus the foo <Enter> bar <Enter> for a total of 10 actions.
- Cthulhu_ 6y agoThis subthread is now keyboard-based editor golf, :p
- Lio 6y agoWell if you like it you'll love http://www.vimgolf.com/ http://www.vimgolf.com/
- lone-commenter 6y agoExcept the emacs sequence will get you tendinitis in the long run, won't it?
- TeMPOraL 6y agoThat's why your rebind Caps Lock to act as your foot pedal.
- susam 6y agoIt depends on the usage, I guess. I have been using Emacs with its stock key-bindings for more than 10 years. I don't even remap my Caps Lock to behave like Ctrl like many others do. Yet I have never felt any issues due to repetitive strain yet. I do touch-type though which means I use the left Ctrl/Alt/Shift key while typing a key on the right side of the keyboard and I use the right Ctrl/Alt/Shift for typing a key on the left side of the keyboard. Maybe that distributes the repetitive strain evenly to both hands. In the Emacs world, while remapping Caps Lock to Ctrl helps in reducing strain for many people, it also causes strain for some people. Every time, this discussion comes up in the Freenode #emacs channel, I have always noticed someone mentioning that remapping Caps Lock to behave like Ctrl caused them RSI. Surprisingly, I did suffer from pain due to repetitive strain under the base of my forefinger once which seemed to be linked to overuse of mouse. The repetitive clicking, dragging and dropping in the Windows world nearly 10 years ago had taken a toll on my right hand forefinger. Taking inspiration from how we use keyboard with both hands, I then taught myself to use mouse with both hands (alternating between left hand and right hand every hour or so) and the pain gradually disappeared.
- blggr 6y agoYes, that's why I use Vim and not Emacs. Much easier on the hands. I also avoid using hjkl all the time and use the arrow keys to counter RSI.
- Lio 6y agoPersonally, if my cursor was on the "foo" I'd probably use: *gcn<bar>. That is: * (highlight all occurrences of foo) gcn (globally changes the highlighted pattern) <bar> (the text you want to replace with) . (repeat the command as many times as you want). If you know you want to change all the occurrences at once you can highlight "foo" with * (shift-8) and then use :%s//bar/g as it will be set as the last regexp.
- sasaf5 6y agoOnce I tried Vim because everyone says it's faster, but I found that to be exaggerated. For example: save in Vim: [esc] : w enter 3 or 4 keystrokes involving two hands. save in emacs: C-x-s one 3 fingered chord with the left hand. And the chords can be hit much faster than key sequences.
- alpaca128 6y agoIf you're using Vim or Emacs with the default configuration you're wasting most of the potential. Add `map <C-x><C-s> <Esc>:w<CR>` to your .vimrc and now you have the exact same C-x-s shortcut in all modes. Although I personally prefer Alt-s(`<A-s>`). Vim can be much faster because it can be adapted to the user. For me that's the whole point of using it, otherwise I might as well just use VS Code and curse at the annoyances every day.
- tpoacher 6y agoNano: M-R f o o Enter b a r Enter A 11 keystrokes.
- daptaq 6y agoAlso note that with newer Emacs version there is project.el, where all you have to do to replace all instances of "foo" with "bar" is: <Ctrl> + x + p + r "foo" <enter> "bar" <enter> which are 12 keystrokes, if I'm not mistaken, and does more.
- MaxBarraclough 6y agoHence the EMACS name: Escape Meta Alt Control Shift.
- Lio 6y agoWhen I w' lad everyone knew it stood for Eight Megs And Constantly Swapping. ;) I'm pretty sure though that Emacs is actually short for Editor MACroS. A nod to the fact that Emacs is really an extensible Lisp system rather than just an editor or IDE.
- alpaca128 6y agoAs far as I know E was just the name of an extensible editor back then, and the very first thing named Emacs was a useful collection of custom macros. And then followed various reimplementations of the whole program until one written in C stuck around.
- bryanrasmussen 6y agoE-macs doesn't have two extra leopards, it has exactly the correct number of leopards ALL THE TIME!