reddit / emacs

For Emacsers -> Evilers, Why did you stay after making the switch?

BayesMind · 2022-04-29 00:46
**TL;DR** Let's chat Evil, and if you're a convert, I want to know why you stayed, and if you had to change any fundamentals to make it work? I'm a longtime Emacser, custom `init.el`er, heavy user of custom key-bindings to "advanced"/obscure packages. I have more keybinding muscle memories than I have dollars in the bank. But for several years I've been tempted by **Modal Editing**. It sounds so thoughtful. So elegant. So a couple weeks ago I decided to make the Evil switch, and I've been giving a full-throated effort to trying out `Doom`. I'm not too impressed yet. I mean, they did a good job making *Doom* what it is. Terrific job, really. I don't particularly love the `evil`ness though. * I'm switching back and forth out of `insert` mode at a much higher frequency than I anticipated, and that just makes writing/editing feel sluggish. * I mistakenly thought that `evil` meant I wouldn't be using modifier keys. I need em a lot. Ex: Just scanning around needs `C-d` `C-u` which is such an ugly navigation pattern * I mistakenly thought navigation would be cohesive, and representative of the elegance in `hjkl`. Instead we have `gg` `G` to go top to bottom, `C-d` `C-u` to move by half a page, `f` `b` `e` to move by words, I have to go *far* off the home row to hit `Shift ^` `Shift $` or even `0` to perform one of my most common motions. Jumping by paragraphs is a common operation, but `{` `}` is awkward for doing it. * I use avy jump probably a few times a minute, and multiple-cursors many times per hour. These are buried under... I can never remember. Too many characters though. Do I just need to make better use of `/`? (for navigating results, `n` `N` strays from the elegance I liked in `hjkl`) * The cursor's weird. `p` never pastes where I expect. `a` vs `A` is just... why? Can you really remember on the fly whether you need to do `w` or `e`? * It feels like many keybindings are further away from my reach. Ex: `SPC b B` (4 keys in sequence) vs `C-x b` (2.5 keys, `C` and `x` are pressed at nearly the same time). Where my critques fall short: * I have a learning curve all over again, maybe once I get out of it I'll like evil more? * I can rebind everything I find inefficient, but, that starts to defeat the purpose of buying into Evil. * Some of my critiques are aimed at Evil, others at Doom's keybinding decisions. * Am I vimming wrong? Like, am I trying to edit in an emacs-fashion, but evil requires you to.. be different? I've heard one shouldn't highlight as much, and that there are usually shorter keycombos that are sufficient to solve what you used to think was the right way of writing/editing. I think some projects have addressed my concerns a bit - `modalka`, `kakoune`, `ryo-modal` - but there's less momentum in that space and that's been a dissuader from me trying them first, before Evil. **Have any "power-user" emacsers made the evil switch and stayed? Why? What changed, like, did you need a perspective shift?**
CorysInTheHouse69 · 2022-04-29 01:15
Not what you’re really asking but I switched from evil to regular emacs editing bc of these same complaints I had. I used vim for about a year and switched to emacs 9months ago, instantly installing evil. About a month ago I decided to try out vanilla style editing and I was shocked at how much faster it was to me. With vim style editing I was spending so much time switching modes rather than actually editing. For example, if I want to move forward 1 word in vim/evil (excluding arrow keys and using mouse) I have to leave insert mode, then move forward, and then enter insert mode again. Whereas with emacs bindings I just M-f. Imo, using vim/evil it *feels* as if you are very productive bc you are pressing all these keys very fast but in terms of the actual editing that is getting done you’re not actually that fast. Edit: It’s also important to note the learning curve of both. It took me about a month to become decent at vim but only a few days to become decent at emacs bindings. I think it’s obvious which is simpler
BayesMind · 2022-04-29 01:21
This is a perfect answer thanks! Modal editing sounds so great on paper! I wonder if there's a best-of-both worlds, like emacs, but character navigation is `C-hjkl`, and words are `C-HJKL`, paragraphs are `C-M-jk`, etc.
redguardtoo · 2022-04-29 01:30
You can use Emacs keybindings in insert mode.
BayesMind · 2022-04-29 01:35
Good point, but in that case I'd prefer to just use emacs.
_noctuid · 2022-04-29 02:37
> I'm switching back and forth out of insert mode at a much higher frequency than I anticipated, and that just makes writing/editing feel sluggish. > I mistakenly thought that evil meant I wouldn't be using modifier keys. I need em a lot. Ex: Just scanning around needs C-d C-u which is such an ugly navigation pattern Thinking about modal editing as an all-or-nothing thing is fundamentally wrong. There are cases where each is better. If you are constantly switching in and out of insert state, you're doing it wrong. See [Why Modality and Chording](https://github.com/noctuid/dotfiles/blob/master/emacs/editing.org#why-modality-and-chording). Even vim has insert mode chord keybindings by default. > I mistakenly thought navigation would be cohesive You can rebind keys you use more frequently. It's not a lot of rebindings. You can get a lot of leverage out of just a few commands as well: `evil-avy-goto-word-or-subword-1`, `evil-avy-goto-char-2` (or evil-snipe), `evil-avy-goto-char-timer`. There is no reason to not use these. I have all of these bound to single keypresses. > multiple-cursors many times per hour For what? > The cursor's weird. p never pastes where I expect. Like when? The rules are consistent/logical. > Can you really remember on the fly whether you need to do w or e? What? > It feels like many keybindings are further away from my reach. Ex: SPC b B Doom and spacemacs' keybindings are so long because they try to bind every possible command a user might want and are not tailored to your use case. > I think some projects have addressed my concerns a bit - modalka, kakoune, ryo-modal - but there's less momentum in that space and that's been a dissuader from me trying them first, before Evil. Anything that mimics kakoune's editing model is based on a [fundamentally broken model](https://github.com/noctuid/dotfiles/blob/master/emacs/editing.org#why-not-kakoune). If you use one of the minimal modal packages, you will likely have to do way more setup yourself than just making alterations to evil.
00-11 · 2022-04-29 02:42
+1. I'm glad you posed the question as you did, and look forward to the answers (in all directions).
fatnerdfromnextdoor · 2022-04-29 02:55
I think people chose vim bindings, not because they are good, but because people know them from vim. If you just want good, modal editing I recommend [Xah fly keys](http://xahlee.info/emacs/misc/xah-fly-keys_tutorial.html) and its siblings
bojinless · 2022-04-29 03:11
You have many valid concerns. I've been a long time user of both editors and paradigms, and I genuinely think it's a toss up. You may be interested in this long write up I did defending Emacs bindings against Vim: [https://www.reddit.com/r/emacs/comments/n3d4vv/comment/gwqcmnx/?utm\_source=share&utm\_medium=web2x&context=3](https://www.reddit.com/r/emacs/comments/n3d4vv/comment/gwqcmnx/?utm_source=share&utm_medium=web2x&context=3) And here is a long, in depth, subtle debate karthink and I had on this topic: https://www.reddit.com/r/emacs/comments/odjru1/comment/h42n3zh/?utm\_source=share&utm\_medium=web2x&context=3
CorysInTheHouse69 · 2022-04-29 03:16
You could change emac’s bindings to this. C-n > C-j C-p > C-k C-f > C-l C-b > C-h M-f > C-L M-b > C-H etc... The biggest problem with this is losing C-h, so you’d have to rebind the keys you lost. So maybe C-h > C-n C-j > C-p C-l > C-f C-k > C-b
naokotani · 2022-04-29 03:19
I first learned to code on vim and when I finally made the switch to emacs I was already way too far gone.
[deleted] · 2022-04-29 03:27
[deleted]
bojinless · 2022-04-29 03:36
\> Imo, using vim/evil it feels as if you are very productive bc you are pressing all these keys very fast but in terms of the actual editing that is getting done you’re not actually that fast. I definitely feel this. I'm a big advocate for the standard Emacs bindings, but I've been using Neovim lately because I feel like the LSP stuff is more polished over there (don't @ me) and my goodness you're right. There is a lot of wheel spinning to do basic things.
kruecab · 2022-04-29 03:44
I’m a UNIX sysadmin by trade and used vi (not vim) in my daily work. I recently took up emacs (spacemacs) and have enjoyed the extensibility and use evil mode. I find evil/modal editing well-suited to sysadmin work which is often patching together tab-delimited files, short scripts, but **ultimately a lot of repetitive editing / transformation tasks** (command mode). It’s like having a light version of sed/awk right in your editor. It’s handy for taking some output and reformatting each line for whatever the next task at hand was. I used it daily and constantly such that after 20 years I now have spinal macros for all the stuff I want to do to a text file. But for writing code or anything else, where you **spend most of your time writing** (insert mode), evil/modal editing can be quite tedious. Now I used to write all my email in vi so I’ve gotten prett proficient at using it for that purpose, but it’s just not as well-suited to simply writing.
frozeninfate · 2022-04-29 03:45
Ive tried the switch to meow as well but was having trouble making sense of its macros. Do you have any tips for going from Evil to meow?
ambirdsall · 2022-04-29 03:56
It sounds like there are a few things going on. First, it does sound like you haven't fully internalized the internal logic of vim commands and there's probably some room for improvement in "how you vim"; I would recommend looking for opportunities to use vim/evil's `.` command, which "replays" the last logical vim command at point. It really helps get a feel for the semantics. Vim, like shell scripting, is not really about the individual commands, it's about the power and flexibility of combining them differently to fit different use cases (for example, you can use a `/` forward search as the "target" for a `d` command in evil's normal mode, and repeat that "move" with `.`) Second, it's okay to ease into evil-mode. I personally have `(setq evil-disable-insert-state-bindings 't)` in my (also doom) config, which lets you use normal emacs keybindings in insert mode. You can take the best of both worlds; for example, I use a lot of emacs bindings in lisp and org files, and lots of evil bindings in non-lisp code files. Find your own balance.
BayesMind · 2022-04-29 04:29
> spinal macros I love that :D
bugamn · 2022-04-29 04:30
I was not an Emacs power-user before I started using Vim, but I wanted to comment in a few things and I hope it will be helpful and help you decide if you are vimming wrongly. >I'm switching back and forth out of insert mode at a much higher frequency than I anticipated, and that just makes writing/editing feel sluggish. If I'm working on an existing file, I tend to spend most of my time on normal mode, jumping into insert mode for quick changes as I see the need for them. When I'm working on a new file, I tend to enter insert mode and stay there as I'm adding text, although I'll sometimes go back to normal mode to go back and fix something. I'm just to used to these quick changes that I don't feel sluggish. >I mistakenly thought that evil meant I wouldn't be using modifier keys. I need em a lot. Ex: Just scanning around needs C-d C-u which is such an ugly navigation pattern I'll be honest, I didn't even remember what C-d and C-u do. If I'm just scanning and I don't know what I'm typing yet, I usually use page up and page down. It does help in my case that I have an ergonomic keyboard that makes those two easy to access (Kinesis Advantage 2), but even on the tenkeyless keyboard I'm using right now they aren't bad, I just put my hand on my trackball and my thumb can easily press them. If I know what I'm looking for, I'll use / to search for it. >I mistakenly thought navigation would be cohesive, and representative of the elegance in hjkl. Instead we have gg G to go top to bottom, C-d C-u to move by half a page, f b e to move by words, I have to go far off the home row to hit Shift \^ Shift $ or even 0 to perform one of my most common motions. Jumping by paragraphs is a common operation, but { } is awkward for doing it. I agree that many of these can seem awkward and I probably don't mind them because I'm used to years of using it. I'd like to mention that some might seem arbitrary, but they have historical reasons, like \^ and $ which come from regular expressions. Also, while some of these key placements are not ideal, are they really much worse than the emacs equivalent? I'm thinking particularly about C-d and C-u vs M-v and C-v. Neither option seems very elegant to me. Really, navigation is always a sore spot, so it's probably better to see what tools you like to use and maybe do some rebindings to make those more accessible. If you have a suggestion on how to rebinding paragraph movement I'd love to hear it because I like that motion but find it the position uncomfortable. >The cursor's weird. p never pastes where I expect. a vs A is just... why? Can you really remember on the fly whether you need to do w or e? a vs A is a pattern that matches i vs I It's also a very convenient way to not need \^ or $ if you are adding text, and I and A are very useful for command repetition. And I do remember w vs e. It's confusing in the beginning, but with practice the distinction can be very helpful for command repetition. >It feels like many keybindings are further away from my reach. Ex: SPC b B (4 keys in sequence) vs C-x b (2.5 keys, C and x are pressed at nearly the same time). I'm pretty sure that one's on Doom. The vim native way would be `:b <buffer_name>` which I feel isn't really much worse than emacs way but I've been using `C-x b <buffer_name>` and that doesn't affect the evil experience in any way. To close, I also wanted to add that the main reason I like vim's model is because I find it helps me do repetitive actions easily. I can easily do small things like add an extra parameters to function calls in three lines. More than that, I like that I don't have to memorize a lot of commands. The commands and motions you learn can be combined and that can be very powerful. That command to move by paragraph can be combined with the delete command to delete a paragraph. And if I want to do it again? I can just press the . and it works! I do that a lot: delete a word, realize I want to delete the next one too, press . and it's gone too. The best text I've found describing this experience is [this one](https://gist.github.com/nifl/1178878). The title can be a little elitist but that aside I find that it does a good job of explaining what is attractive about vim's modal interface. That said, it does seem that ergonomics are one of your concerns and I don't think that's really something that vim keybindings care about. You might also want to look at [Xah fly keys](http://xahlee.info/emacs/misc/xah-fly-keys_tutorial.html), who seems to have put a lot of thought on his model.
BayesMind · 2022-04-29 04:49
> modality and chording ... kakaoune thanks I'll check those both out! > multiple-cursors It's hard to describe, but I really do use it a lot. Level 1) I want to find and replace across the page, including off-screen. It's nice when I can multi-edit inflight, vs say `M-%` in which case it's either all-or-nothing, or you have to visit each instance. Level 2) Often, instead of simple find-and-replace, I'll want to also edit something along that line. For instance, I've had stuff like this in haskell: f Some f Constructor f Pattern f Matching and I want it to end up like f Some = some f Constructor = constructor f Pattern = pattern f Matching = matching I can make 4 cursors in a row in a few key strokes, highlight forward, copy, type `=`, paste, go back, lowercase. Done. Or maybe at every highlighted site I want to manipulate parentheses, or comments at the end of lines... this really is a part of my bread'n'butter. > w, e, and p In evil, the cursor seems to me to have a front side and a backside, and sometimes actions happen on one or the other sides. I'm sure it's sensible. But it's definitely not intuitive, and I haven't thought it out. Other than those direct responses, you also gave good advice. Thanks, I'll take it to heart and not give up on evil yet!
allarm · 2022-04-29 05:04
How is it better than Vim?
Alan_Shutko · 2022-04-29 05:04
> The biggest problem with this is losing C-h Wow. That is not my biggest problem. My biggest problem is C-k which I use almost all the time (and I have to figure out why twitch is messing it up in safari). In comparison C-h is useful but would not immediately drive me crazy.
Alan_Shutko · 2022-04-29 05:07
> I can make 4 cursors in a row in a few key strokes, highlight forward, copy, type  = , paste, go back, lowercase. Done. Fwiw, what is where I make an ad-hoc kmacro and run it a few times.
flyin1501 · 2022-04-29 05:17
Most complaints I have about Evil can be fixed with a simple `define-key` once you give up the fantasy of being able to open Vim on another computer and immediately feel at home. For example, I rebound C-a and C-e back to Emacs default, and I mapped C-SPC to Esc so "switching in and out of insert state" is no longer an issue. (define-key key-translation-map (kbd "C-SPC") [escape]) The `SPC b B` example you gave --- I don't like that binding either. It's a Doom Emacs thing though. I personally use `SPC b b`, which does not require holding Ctrl like `C-x b` (or `SPC b B`!) does. As for why I stayed --- I'm just used to it already, and switching to Emacs default bindings is just a hassle that won't be better for me. I also hate the idea that you need to hold Ctrl to move around. That said, I learned Vim keys first and have no reason to switch completely to default Emacs keys --- for people who learned Emacs keys first, it's probably not worth it to learn Vim keys either.
allarm · 2022-04-29 05:30
Clearly your problem with Evil is that you don’t grok vi. https://stackoverflow.com/questions/1218390/what-is-your-most-productive-shortcut-with-vim/1220118#1220118
[deleted] · 2022-04-29 05:33
[deleted]
LowCom · 2022-04-29 05:33
TBH, it seems you need much more practice and improvement with until the idea of modal editing sinks in. Many of the complaints you have will become automatically clear once you develop more practice and thus have automatic insights. It is hard to explain verbally but it will become more clear with time. One tip I can give you though right now is rebind "escape" (to leave insert mode) to a key combo like "jk", I can show you how to do this in evil (which I just learnt). Since you will be using this several times, having that key on home row will save you a lot of time and cognitive load.
leungbk · 2022-04-29 05:42
Certain things like deleting a word, moving to the nearest close paren, etc. are bound to single keys in XFK, which I guess is kind of handy. I do not think it is worth the loss of Vim-style text objects, composition, or ex cmds, though.
kamui78 · 2022-04-29 06:13
My solution is to use Evil for editing text. I have been using the modal editing for very long and to me it is a second nature. I used both Doom Emacs and Spacemacs only to realize that as much as convenient, these two opinionated configurations, fill the keyboard combination space almost completely. I realized that I need a subset of the packages and Evil + Evil-collection in order to cover all of my needs. I have now a personalized, built from scratch configuration, where the most convenient keyboard shortcuts are all for the functions I use more often, everything else is accessed through the M-x, which also has the alternative combination Space-; in normal mode. My minimal keyboard space is: Space - w: for managing the windows. Space - b: for managing buffers. Space - f: for FZF combinations. Space - g: for Magit combinations. Space - j: Avy jump chars. Space - k: For generating latex preview fragments. Space - l: Fuzzy and filtered locating of the buffers. Space - n: For managing my org-roam notes. Space - o: for the most often used org functions. Space - p: for managing project with Projectile package Space - q: for deleting buffers. Space - t: for running test suite when writing code Space - Space: Fuzzy and filtered searching in my home directory. All of these shortcuts are the ones I find most convenient and rely on all the time. The Evil suite provides me with a very powerful language for manipulating text. I mostly stay in the normal mode, since if find that it is really true that most of the time we spend reading and browsing text rather than modifying it. This setting works so well for me to the point that I use neovim only for rare and quick edits, mostly for my configuration files as a super user. I have tried Emacs vanilla shortcuts, but I find that I can have the best of the both worlds by using Evil. This works very well for me. Every time I integrate a new package I add new shortcuts only if I use it often. If I do not, I rely on M-x or Space-;.
Hydraine · 2022-04-29 06:25
`P` pastes behind the cursor, `p` pastes ahead. `i` moves to insert mode before, `a` moves to insert mode after. Its quite useful as far as positioning goes.
mmarshall540 · 2022-04-29 06:31
This does it with the Super key. You can change that on the bottom line if you want. But the nice thing about using Super is you don't have to worry about losing the default bindings. (dolist (kb '(("h" . backward-char) ("j" . next-line) ("k" . previous-line) ("l" . forward-char) ("H" . backward-word) ("J" . forward-paragraph) ("K" . backward-paragraph) ("L" . forward-word))) (global-set-key (kbd (concat "s-" (car kb))) (cdr kb)))
tom_dl · 2022-04-29 06:54
>Evil drops the ball in just enough places for me to feel irritated. Can you give examples?
bravosierrasierra · 2022-04-29 08:19
vim-native solutions without any Multiple Cursors: 1) :%s/from/to/g -- replace "from" to "to" in current file 2) macros. My vim/evil approach without multiple cursors: - Create macro "a": qa - Do edit: A= some<esc> - Go to next line: + - End macro: q - call macro "a" on current line: "@a" - repeat last macro: @@ Pros: we can quickly create up to 26 macroses and works locally, in any ide with VIM-plugin and on remote servers with vim. PS: My speedup to prevent moving hands from "home row" in any mode: emacs/evil ``` (global-set-key (kbd "M-h") 'backward-char) (global-set-key (kbd "M-j") 'evil-next-line) (global-set-key (kbd "M-k") 'evil-previous-line) (global-set-key (kbd "M-l") 'forward-char) (global-set-key (kbd "M-y") 'bss/first-non-blank) (global-set-key (kbd "M-o") 'bss/end-of-line) (global-set-key (kbd "C-M-h") 'evil-backward-WORD-begin) (global-set-key (kbd "C-M-j") '(lambda () (interactive) (backward-char)(evil-backward-WORD-end)(forward-char))) (global-set-key (kbd "C-M-k") '(lambda () (interactive) (evil-forward-WORD-end)(forward-char))) (global-set-key (kbd "C-M-l") 'evil-forward-WORD-begin) ``` My speedup for first problem, binded on M-r: ``` (with-eval-after-load "evil" (defun bss/thing-at-point () (interactive) (let* ((at-point (thing-at-point 'symbol 'no-properties))) (if at-point at-point (thing-at-point 'evil-WORD 'no-properties)))) ;; inspired from https://unix.stackexchange.com/a/604140 (defun query-replace-at-point (old new) "Invoke `query-replace-regexp', valuing OLD to symbol at point, replacing it with the input NEW." (interactive (let* ((at-point (bss/thing-at-point)) (at-empty-line-p (and (bolp) (eolp))) (old-symbol (if (use-region-p) (progn (deactivate-mark) (buffer-substring-no-properties (region-beginning) (region-end))) (if at-empty-line-p "^\n" at-point))) (new-symbol (read-string (format "Rename '%s' to (\\n = C-q C-j):" (if at-empty-line-p "<empty line>" (regexp-quote old-symbol))) (if at-empty-line-p "" (regexp-quote old-symbol)) ))) (list old-symbol new-symbol))) (save-excursion (goto-char (point-min)) (query-replace-regexp (regexp-quote old) new) ) ) (global-set-key (kbd "M-r") 'query-replace-at-point) ) ```
T_Verron · 2022-04-29 08:28
>The biggest problem with this is losing C-h For help, or for backspace? Both are easy to relocate. C-j and C-k are much more precious to me.
Horrih · 2022-04-29 08:29
Tried to make the switch as well : in standard emacs, my left hand felt really tired because of all the ctrl/meta chords all the time. Doing a chord with left + right hand is ok, but when both keys are on the left it twists and hurts your hand, and sadly a lot of emacs bindings require you to do this. However i was unsatisfied with the switch : too many core bindings felt wrong, especially on my french keyboard layout. Hjkl was a particularly bad trigger for me : h is a terrible binding for such a core movement, because it strains your hand too much from the resting jklm position that you should have if you are a touch typist After so much frustration I ended up writing my own modal edition minor mode, which is impressively easy to do in emacs. If you have the time, i would definitely advise you to do just that, the transition was really smooth since all the bindings make sense to you. What suited me in the end : - have an easy to use binding to exit emacs mode ("sd" keychord for me) - using ijkl for movement. - Have consistent movement bindings between normal and command mode - forbid any shortcut which would use ctrl/Meta on the same hand - escape and function keys are offlimits Here is my [emacs config](https://github.com/Horrih/config/blob/main/.emacs), relevant section starts around line 600 if you want to try your own way.
grimscythe_ · 2022-04-29 08:30
Believe me it's worth the switch. I was in the exact same place where you are. After a couple of months I finally realised that I "talk" to the editor and that's when the productivity kicked in. Touch typing is a must. Oh. I also had a big issue with page scrolling so I rebound that to C-j and C-k, those are obscure in Vim. For navigating menus, like helm I have M-j and M-k. Try it out that could make a difference. One more thing, bind Caps lock to Esc and switching between modes is not a problem anymore. Once you finish typing it will become muscle memory to tap that Caps lock and your back in normal, as in "navigation" mode.
bravosierrasierra · 2022-04-29 08:31
> (define-key key-translation-map (kbd "C-SPC") [escape]) why not use default "C-[" as <esc>? Works by default and keep hands on home row.
T_Verron · 2022-04-29 08:34
What do you use instead of C-SPC, to quickly create regions?
ThorstoneS · 2022-04-29 08:55
I looked at a few other modes, but they all seem to aim for minimum keypresses, where for me the power of vim is that it is actually more of a language with a grammar. So once you learn the vocabulary and the grammar, the memorisation is a lot easier than just remembering shortcuts.
ThorstoneS · 2022-04-29 08:56
I assume the problem is that you are looking at it from the aspect of minimising keypresses, or finger movement. That's not the main thing about vim. It's kind of a language, with a grammar and vocabulary.
pathemata · 2022-04-29 09:06
No one has mentioned this yet. But using the `caps-lock` key as `esc` *and* `ctrl` was something that really improved the experience for me. My pinky finger is practically always in the caps lock key. The commands that I use for this are: setxkbmap -option 'caps:ctrl_modifier' xcape -e 'Control_L=Escape' To your points: 1. always in `normal `mode, with short instants on `insert` mode. (with the caps as esc, it becomes second nature to always hit it) 2. yeah, some scrolling needs chords. I don't use this, usually, I'm with a document outlined (`outline-minor-mode`) or I search a line with `consult-line`. 3. yeah, `^` and `$` are painful. I use `spc l` for end and `spc h` for beginning. 4. `evil-mc` works for most part, sometimes I have to add commands to `evil-mc-known-commands`. `avy-goto-char-times` and `evil-snipe-s`(`f`) are my favorite functions to jump around. 5. You will get used to pasting correctly. 6. sometimes you have to change keybindings.
avindroth · 2022-04-29 09:11
multiple-cursors is really nice. It's a well-designed, ergonomic package, just works well out of the box. Unfortunately, it doesn't have a good evil equivalent, so I just enter emacs mode for it.
pxpxy · 2022-04-29 09:27
Fixed link to “why not kakoune”: https://github.com/noctuid/dotfiles/blob/master/emacs/editing.org#why-not-kakoune
ideasman_42 · 2022-04-29 09:53
My solution is to: - Use the leader key for a lot of my custom actions. - I use an split-ergo keyboard, so pressing Ctrl-Alt on the thumb cluster isn't a problem, adding many more key combos that might otherwise be a bit of a hassle to press. - Override some evil bindings I almost never used in VIM (C-f, C-l, C-o, C-d, C-y, C-i - mostly related to scrolling or moving the cursor up/down...). Besides this, you probably have to allow some time to learn evil to the point it's not "getting in the way" compared to your custom keymap.
RentGreat8009 · 2022-04-29 09:58
I just disable evil mode in places i don’t want it
RentGreat8009 · 2022-04-29 10:07
VIM bindings are far superior but the best situation is a combo of Emacs bindings in insert mode + VIM in normal Practice more, you will get there.
tgrnh · 2022-04-29 10:50
>I wonder if there's a best-of-both worlds Maybe a keyboard with QMK firmware? I was using vim first, so I'm not really the one you are asking. But after I built a QMK keyboard, I started to prefer holding a modifier key to have the arrow keys on my home row instead of having to switch to normal mode for using hjkl and then back to insert mode. So there was no benefit of vim's hjkl anymore, but instead I could use the same keys in every other application for navigating up, down, left, right. So when I switched to vanilla emacs keybindings, I kept using it instead of learning C-b etc. This is of course just a single aspect, vim is much more than hjkl. But it could be an approach when you are targeting for "best-of-both worlds".
nonreligious · 2022-04-29 11:05
I used Emacs on and off for a while, and decided to try to learn vim while tinkering with Linux systems. Learned to love: `ciw`, `yi(`/`ya(` as well as the `visual-line-mode` selection, which I never could remember/work out how to do in Emacs. I don't use it everywhere, as some of the navigation/scrolling is better handled in Emacs.
bspwm_js · 2022-04-29 11:28
See boon package
klikklakvege · 2022-04-29 11:48
I use viper and am happy right now. Just curious why viper is never discussed, only evil. That's evil! And way too many computer games!
gnuvince · 2022-04-29 11:56
> Imo, using vim/evil it feels as if you are very productive bc you are pressing all these keys very fast but in terms of the actual editing that is getting done you’re not actually that fast. That rings true to me. I would also extend it to certain operations which "feel" faster when using the keyboard, but which can be done just as quickly with the mouse.
flyin1501 · 2022-04-29 11:59
I don't know where [ is on your keyboard, but on a US keyboard I'd have to extend a finger to press [, whereas SPC is already under my thumb where I rest it. So I personally find C-SPC easier to type.
flyin1501 · 2022-04-29 12:06
I just use Evil's `v`. I never really learned about the mark though; I should probably use commands like C-x C-x more.
_noctuid · 2022-04-29 12:09
Better to dual-role escape and a modifier on an easily accessible thumbkey if possible.
jacmoe · 2022-04-29 12:33
I am using Boon, and it's great! &#x200B; Since I've never been a Vim user, Evil never appealed to me. &#x200B; If Boon is not your cup of tea, maybe Meow is? There's a lot of non-Evil options out there.
T_Verron · 2022-04-29 12:34
I see. Regarding mark commands, me too... I only ever use the mark to select a region, with transient-mark. C-x C-x is still very useful, to correct the far end of a region without starting over.
karthink · 2022-04-29 12:48
The USP of vim-style keybindings for me is not modality but composition. The (register-)verb-motion grammar makes arbitrary actions very efficient by applying a small set of ideas. I use Emacs with customizations to the default keybindings, but I miss Vim-style compositions.
_noctuid · 2022-04-29 12:55
> sometimes actions happen on one or the other sides In addition to the other answer, you also have consider that how text is pasted depends on how it was copied. If you copied linewise, it will be pasted linewise. If you copied with a visual block, it will be pasted potentially over existing text. > either all-or-nothing, or you have to visit each instance You can search and replace over a specific range with evil (:s with visual selection), or you can globally search/replace with confirmation. You can abort the search replace early if you are done. It's also worth mentioning `gn` (requires configuring `evil-search-module` to `evil-search`). Search for some text you want to act on. Act on it. `dgn` will then move you to the next occurrence of that search. `gn` by itself will move you to that search and select it. For example, to change a bunch of `foo` to `bar`, you could search for `foo`, use `cgnbar` then repeat with `.`. If there is one you don't want to change, you can undo and then skip it. Personally, I generally just use `:s`. For 2, you can continue to use multiple cursors or use macros. I'll add to the other comment to explain alternative ways of how you could would do that. 1. Not pretty but you can still use search and replace with backreferences. Something like selecting the range in visual mode and `'<,'>s/f \(\w*\)/f \1 = \l\1`. 2. Use a macro. The benefit of macros is that they scale to even operations that act on hundreds or thousands of candidates in a file. For smaller operations, you may prefer multiple cursors. Here is how you could do your example with a macro: - Go to the start of the first line - start recording the macro with qq - go forward a word - copy the word - enter insert at the end, add =, and paste with `C-y` (like you would with Emacs) or enter normal state and paste before - enter normal state and lowercase the word with the `gu` operator - go to the beginning of the next line and finish recording - repeat the macro with Q (which is @q for me) There are more advanced ways to automatically repeat macros. For example, if the start position of your macro is searchable, you can do something like this instead: - Search for \^f - Record macro as above - Instead of ending macro by going to the next line, end it with `n` to go to the next search - You can then run the macro after confirming you want to do so for each position - If you don't want to run the macro at that location, hit `n` - Otherwise run the macro, and it will automatically take you to the next candidate You can also have a macro call itself or use a high count so that it runs for all instances in a file. Alternatively, you can skip any commands to go to the next instance when recording the macro and just run a macro on each line in a range. > I'll take it to heart and not give up on evil yet! Depending on how interested you are, it may even help to go through vim tutor, ignoring anything that isn't about editing. I believe there is also an evil tutor package, but I'm not sure how it compares. Practical Vim is also a very good book if you find evil interesting enough to be worth investing some time to see what is possible with vim keybindings and things like `:g`. A lot of the book does not apply to evil, but it is usually obvious when this is the case (e.g. the chapters that talk about buffers or windows or non-editing functionalities of vim; not all the tips will be useful, but it is an interesting resource to skim; the chapters on macros, for example, are very useful). On the other hand, if you don't stick with modal editing, the best improvement you can make to non-modal editing is to put all or some of your modifiers on easily accessible thumbkeys (this can mean buying an ergonomic keyboard, or for me, using a "wide" layout where my right hand is shifted one key over to make ralt more easily pressable with the thumb).
in-some-other-way · 2022-04-29 12:58
Pretty much anything that derives from special mode? Read only buffers?
gf3 · 2022-04-29 13:24
i’m thinking about trying out meow while switching over to Dvorak
[deleted] · 2022-04-29 13:30
[deleted]
[deleted] · 2022-04-29 13:32
[deleted]
_noctuid · 2022-04-29 13:32
There are two fundamentally separate issues here: - Modality vs. chording - Object then operation vs. operator then object vs. no composability Comparing specific ways of doing things between Vim and Emacs often does not make much sense. If you're thinking of modal editing as all or nothing, you're not grokking *why* it potentially has benefits. Each model is objectively better for certain situations given you agree on certain (reasonable) premises (see [Why Modality and Chording?](https://github.com/noctuid/dotfiles/blob/master/emacs/editing.org#why-modality-and-chording)). In the end, the difference may not matter that much, but I would not say the same for compositional editing. Wrt compositional editing, yes it makes more sense to use single keybindings for the most used combinations, but you can't do that for all combinations; there are way too many. At some point, you will be using a selection-first model with Emacs, which is imo [fundamentally broken](https://github.com/noctuid/dotfiles/blob/master/emacs/editing.org#why-not-kakoune). That or you won't be acting on specific objects at all, which is inefficient. It's best to do actions in one go. Expand region, for example, is often incredibly inefficient, but this has nothing to do with modality vs chording. You can repeatedly expand region in either Vim or Emacs, or you can immediately select the exact object you want with either (Emacs just does not yet have a great package for non-modal compositional editing, though I will eventually fix that). Let's say you want to: - Delete the current function - Delete the next function after the point - Delete any function on screen without moving the point (e.g. selected with avy) - Delete any sexp within the current function using avy selection - Change inside a specific let binding - Change inside any string on screen - Delete any TODO comment on screen - etc. etc. etc. These should all be single operator/action combinations. In my head there is one thing I want to do. I should not have to split things into multiple steps because my editor cannot match my thought process. There are a billion useful combinations like this. You can't bind them all to single keys. As for object vs operator first (one point from the link I posted above): There are far fewer operations than objects that can be acted on. It does not make sense to pollute the global keybinding space with selection/object commands. Also > Pulling out the cs"* is a great party trick. `cs"*` is shorter, more location-independent, and more intuitive than the proposed alternative (i.e. it matches exactly the idea of the change I want to make as opposed to being ). How is this the same time to pull off?
nullmove · 2022-04-29 14:29
This is what I do in Vim as well ;)
chandaliergalaxy · 2022-04-29 14:53
> For example, if I want to move forward 1 word in vim/evil (excluding arrow keys and using mouse) I have to leave insert mode, then move forward, and then enter insert mode again. Whereas with emacs bindings I just M-f. THANK YOU! I could never figure out how people worked with this switching around all the time. I used to ask around in forums a long time ago (more than 10 years) but never an answer, except try using Ctrl-[. It might be that I don't think linearly as everyone else - so I don't write everything and edit in big chunks but alternate in smaller chunks. But also for programming code, like moving around parentheses, etc. I could not get that fast in Vim even when I used Ctrl-[ to change modes. I feel like I was in a isolation chamber crying out why I seem to be the only one to have this problem so it is very great to hear someone else finally say this.
CommonFiveLinedSkink · 2022-04-29 15:08
I came to emacs from pure vim, and still lean heavily on vim for quick editing tasks. Modal editing is a mindset, I think. It won't take you very long to go through the good old vim tutorial document; try doing that in a vanilla vim so that you can't lean on emacs chords as much. I would never have used emacs at all if it weren't for evil. Modal editing is so much a part of me that I am constantly having to backspace after typing a string of "j"s when I'm in some other program that *recklessly* allows me to always be in insert mode. I only want to be in insert mode when I'm actually typing, damnit -- I don't want to unwittingly commit pixel-ink to pixel-paper until I'm ready!
ambihelical · 2022-04-29 15:11
This. And also I find that many people new to Vi-style bindings completely overlook text objects altogether, as well as the ability to add new ones, e.g. in emacs you can add packages like evil-args and evil-textobj-anyblock.
bojinless · 2022-04-29 15:14
Great response! Lots of good stuff to think about.
[deleted] · 2022-04-29 19:15
[deleted]
onetom · 2022-04-29 19:15
Using Ctrl as a shift key for hjkl is a horrible idea, coz it conflicts with so many other programs and at the end such inconsistency might just keep you constantly annoyed, which is not exactly good for productivity or mental health in general... Also this fascination with hjkl... ijkl is just as valid, if not more convenient, because H is harder to reach than I. Plus most ppl are always familiar with the inverted T cursor keys, since they can't avoid it typically, so that muscle memory translates to ijkl very well. Similarly, how we like mnemonic keybindings, ijkl matches the meaning of the keys spatially, while j and k in hjkl is ambiguous. I was even experimenting with j/l being left and right and h/k being down and up, so i would always use my 2nd and 4th fingers, just shift them by one key, depending on which axis do I want to move along. I'm using SpaceFn layout for ~3-4 years btw, as implemented by @jeebak https://ke-complex-modifications.pqrs.org/?q=jeebak TLDR: it uses Space as a shift key, so cursor keys are Space-ijkl and Opt/Cmd/Shift is mapped to Space-a/e/r, so I can select something word-by-word with Space-e+r+j/l It doesn't conflict with any keybindings, but it's sensitive to the timing of how you roll keys. My Caps Lock is both Esc and Ctrl; that was not the greatest idea, because I often close dialog boxes, when i just accidentally pressed it as Ctrl and just want to release it.
CorysInTheHouse69 · 2022-04-29 19:17
You can do this with any keyboard, no QMK firmware needed. You can use `setxkbmap` or something like kmonad. I already have a custom xkbmap made with stuff like that for my setup
tonicinhibition · 2022-04-29 19:20
Thanks for the tip about `avy`!! I had no idea that existed, even though I use Vimium in Firefox and use that sort of movement daily. This looks especially helpful in org-mode, because `isearch` and `swiper` tend to expand the document tree, when I often just want to navigate to headlines so I can drill down further.
onetom · 2022-04-29 19:23
Correct! :D
onetom · 2022-04-29 19:38
If your Caps Lock is Esc, where is your Ctrl?
onetom · 2022-04-29 19:42
Does the jk sequence work over ssh in `emacs -nw`? I'd think it's sensitive to timing and an irregular network latency would interfere with it.
onetom · 2022-04-29 19:46
I keep pressing Esc accidentally, because I thought I wanted to press Ctrl, but changed my mind. Now I have to C-g in Emacs or reopen whatever dialog I had open in IntelliJ. Both are painful and annoying... :/ I might just need to shorten the time before holding Caps Lock is interpreted as Ctrl...
[deleted] · 2022-04-29 19:46
[deleted]
onetom · 2022-04-29 19:48
as I've gathered from reading discussions, but never really using viper nor evil (just Bram vim for 7 years), viper is missing even slightly advanced features of vim and not integrated with so many other packages as evil (via evil-collections)
klikklakvege · 2022-04-29 20:02
For advanced features I have emacs and elisp.
grimscythe_ · 2022-04-29 20:07
Where the normal Ctrl is, bottom left. Mind that I'm using Evil so ctrl is not that much used. Besides my pinkies are doing just fine.
onetom · 2022-04-29 20:16
I was just about to ask the same: where is your [ physically on your keyboard?
deaddyfreddy · 2022-04-29 21:41
> It sounds so thoughtful. So elegant. it sounds like that, but it isn't (vim->emacs w/o evil switcher here)
deaddyfreddy · 2022-04-29 21:42
most of the time `avy` works perfect for movements
deaddyfreddy · 2022-04-29 21:43
> Rather than re-invent the Vi wheel Emacs reinvented that wheel earlier than vim did, btw
[deleted] · 2022-04-29 22:05
[deleted]
deaddyfreddy · 2022-04-29 22:10
nay
poiu- · 2022-04-29 22:32
Is there any documentation on this that helps to understand what these things are?
karthink · 2022-04-30 03:45
`evil-mode` integrates poorly with the rest of Emacs, with or without `evil-collection`. If I were using Emacs only for editing text files (as opposed to email, RSS, shells, file management, minimal web-browsing etc) I would use evil. But if I were using Emacs+evil only for editing text files I'd just use Vim instead.
dpoggio · 2022-04-30 04:28
It’s curious. I just don’t use C-k. I map kills and deletes to prefix maps bound to C-k and C-d. So C-d C-l deletes a line and C-k C-l kills it. This keeps my kill ring useful. Both prefixes have C-l for the line, C-a from the beginning of the line to the point, C-e from the point to the end of the line, C-w for the current word and C-c for a character. However, I do use a lot C-k C-l and C-d C-l. C-k C-e is very useful as well.
howardthegeek · 2022-04-30 05:16
Exactly. Don't worry much about being one way or the other. When I'm in insert mode, I'm in Emacs, and I'll hit M-b to jump back a word. That said, hitting ESC and typing `das` and then using `(` and `)` to move around by sentences before `p` to drop that cut sentence is pretty slick.
RentGreat8009 · 2022-04-30 07:55
Yup
RentGreat8009 · 2022-04-30 07:56
Yup that’s exactly How I view it
abhibansal53 · 2022-04-30 09:33
Same here. Started with vim, so evil was a no brainer and must for me.
_noctuid · 2022-04-30 10:50
If you like link hinting in vimium and tridactyl, you might also be interested in my package [link-hint](https://github.com/noctuid/link-hint.el). You might also find `consult-outline` and `consult-org-heading` to jump to headings useful. If you want to focus on the content of a specific heading, you can also narrow to it. I personally like to use [worf](https://github.com/abo-abo/worf) for keybindings (it's a better version of org speed keys if you're not familiar with it; if the point is before an org heading, keys run commands instead of inserting text).
Starlight100 · 2022-04-30 12:28
> key combo like "jk" Try "fj"or "dk". It's better to spread the load across 2 hands for key chords. Feels better on the finger tendons.
ambihelical · 2022-04-30 20:26
Here's an article that is vim centered, everything but the vim packages mentioned carries over. https://blog.carbonfive.com/vim-text-objects-the-definitive-guide/
poiu- · 2022-04-30 22:36
Thanks! (I should've thought of adding "vim" to the search \*sigh\*)
poiu- · 2022-04-30 22:38
This is an excellent SO comment. I wish I had read that earlier.
poiu- · 2022-04-30 22:44
Just a general heads-up that I really love how you take the time to explain so many things in this thread. Awesome!
tonicinhibition · 2022-05-01 05:21
Thanks, I will look into those
quote-only-eeee · 2022-05-08 11:45
I missed the memo about "fundamentally broken" being redefined as "I happen not to like it"... ;-)
_noctuid · 2022-05-08 23:44
I'm not sure how you can read the link and summarize it as "happening to not like it." It's an objective analysis based on evaluation criteria I think most people will consider sane (including goals kakoune itself claims to share). It of course won't be a fundamentally broken model for anyone who happens to not care about those criteria. If you actually disagree with any of those points, then fine I guess, but I at least actually explained why I think the model is broken.
quote-only-eeee · 2022-05-09 07:12
It's a list of arguments, sure, and I even agree with a lot of it. But the words "fundamentally broken" are far too strong to match what you've written. "Reversing the Verb Object Grammar Hurts Key Reuse". This is a solid argument, with which I agree. Doesn't mean Kakoune is broken, though. "Navigation and Selection Are Not the Same". Here you literally say that the model is "unintuitive to [you]", which is very subjective. "Instantaneous Feedback is Usually Unnecessary". Here you disprove a single example. "Visual Selections Don’t Prevent Mistakes; Overlays Do". This argument I don't understand. Visual selections *do* help to prevent mistakes. Perhaps you mean they aren't *necessary* to prevent mistakes? Again, you're right about a lot of things, but it doesn't mean Kakoune is "fundamentally broken", which you keep repeating in this thread.
_noctuid · 2022-05-11 00:12
> But the words "fundamentally broken" are far too strong to match what you've written. Maybe to you, but this is an appropriate characterization for me of the premise that switching selection and operation is a major improvement to the standard modal model. For me to not consider it fundamentally flawed to switch the order of selection and operation, there would have to be clear benefits to offset the clear downsides, and I don't see any. > Doesn't mean Kakoune is broken > Again, you're right about a lot of things, but it doesn't mean Kakoune is "fundamentally broken", which you keep repeating in this thread. I only used that phrase that in the original comment, and I never said that kakoune itself was "fundamentally broken." Just to be clear, like the link says, I'm only talking about the idea of putting selections first. Just that single aspect. The premise of the changes to the model does seem fundamentally flawed to me, but if that's hyperbolic to you then let's just say it's "highly questionable" to me that kakoune claims it has improved the standard modal model like it's some obvious truth. I'm not saying that kakoune is a completely useless editor or that the selection-first model will be unbearable. I only brought it up in the first place because I think it's a mistake that people are mimicking this single aspect of kakoune (and not the arguably more useful features) and claiming that vim's operation-first model is fundamentally flawed without carefully considering it. > "unintuitive to [you]", which is very subjective. Sure, but that's not the main point of the section. I gave my own opinion to counteract the idea that everyone will find automatic selections useful. It wasn't a mistake that I qualified those statements as my opinion. I think it will probably be unintuitive to anyone who hasn't learned kakoune before anything else, but in the end, that's not really a huge deal. The main issue is the inefficiency of trying to treat navigation and selection as the same and how this requires extra keybindings. > "Instantaneous Feedback is Usually Unnecessary". Here you disprove a single example. It was the main one given by kakoune when I wrote it (not sure if it's changed). Is there a better example I'm missing? I'll revise my opinion if I see any case where it is the best solution. > "Visual Selections Don’t Prevent Mistakes; Overlays Do". This argument I don't understand. Visual selections do help to prevent mistakes. Perhaps you mean they aren't necessary to prevent mistakes? No, I mean they *can't* prevent mistakes, only help fix them. They can't magically make you get a count right. If you use a count of 3 for a motion or object when you should have used 4, you can fix it before running the delete/copy/whatever operation, but you still made a mistake. This may be better than having to undo and redo the whole operation, but in both cases you failed to get the motion/object right the first try. Selecting with overlays doesn't require counting and can actually help prevent mistakes. If you'd have to use a count you aren't immediately sure is correct, overlays are a better type of visual feedback to prevent ambiguity.
FluidDr1nker · 2022-07-27 04:22
If you were using emacs in a terminal only for magit/denote/orgmode/clojure(with repl integration) would you still avoid evil? sorry, have choice paralysis ;)
karthink · 2022-07-27 10:36
I'd probably use evil if it was limited to that. Also I'd prefer vim style bindings if I was using Emacs in a terminal, since many of my current chorded keybinds wouldn't be recognized. I didn't start out using Emacs for everything though -- I was only editing text files in the beginning, well before evil-mode existed. Over decades, it progressively assimilated more of my computer needs, to the point where getting evil to work across everything without friction became annoying.
OutsideNo1877 · 2022-09-28 01:46
What was confusing about meows macros i found them mostly pretty straightforward although they could have dived a bit more in depth
frozeninfate · 2022-09-29 15:39
Since then, Ive fully switched to meow and its great. I dont really use macros much though. For column edits, I use rectangle select. I do use meow macros for editing the beginning/end of multiple lines. For more complex cases like changing third word on every line, or doing every other line, I find I never remember how to do it. Its not that big of a deal though