Is It "WRONG" To Learn Emacs With The Evil Bindings
HTML-код
- Опубликовано: 21 авг 2024
- There is some debate within the Emacs community about whether it is "wrong" to use the Evil keybindings (the Vim bindings). Are you using Emacs the wrong way if you go the Evil route? Is it worth learning the Evil keybindings if you new to Emacs? Let's discuss!
WANT TO SUPPORT THE CHANNEL?
💰 Patreon: / distrotube
💳 Paypal: www.youtube.co...
🛍️ Amazon: amzn.to/2RotFFi
👕 Teespring: teespring.com/...
DONATE CRYPTO:
💰 Bitcoin: 1Mp6ebz5bNcjNFW7XWHVht36SkiLoxPKoX
🐶 Dogecoin: D5fpRD1JRoBFPDXSBocRTp8W9uKzfwLFAu
📕 LBC: bMfA2c3zmcLxPCpyPcrykLvMhZ7A5mQuhJ
DT ON THE WEB:
🕸️ Website: distrotube.com/
📁 GitLab: gitlab.com/dwt1
🗨️ Mastodon: fosstodon.org/...
👫 Reddit: / distrotube
📽️ LBRY/Odysee: odysee.com/@Di...
FREE AND OPEN SOURCE SOFTWARE THAT I USE:
🌐 Brave Browser - brave.com/dis872
📽️ Open Broadcaster Software: obsproject.com/
🎬 Kdenlive: kdenlive.org
🎨 GIMP: www.gimp.org/
🎵 Tenacity: github.com/ten...
💻 VirtualBox: www.virtualbox...
🗒️ Doom Emacs: github.com/hli...
Your support is very much appreciated. Thanks, guys!
It's Emacs, it's your GNU driven right to do whatever you want.
But it is disrespectful of your God
@@MarquisDeSang Richard Stallman?
I use the default key bindings, but I never used vim. If I had learned vim first, I would have installed the vim key bindings to make it easier to use emacs. Thanks for your video's, I have viewed quite a few and they are very helpful.
Ed is the standard text editor.
Part of the fun of these open and highly configurable systems is being able to do it your own way.
Having said that I always seem to end up with the vanilla Emacs key bindings there is a method to the madness.
Damn I've never even beard of es thanks for the info brother
@@paulnelson9270 Ed was the original Unix text editor (ed being short for editor) and it was a line editor as opposed to a full visual text editor. Later the Ex editor was released by Bill Joy as an "extended" editor which was essentially just an upgrade on ed. Ex would feature a visual mode that allowed viewing the document while editing it without having to specify a print command. The command for this visual mode was "vi" and would go on to supplant the Ex mode as the main editor vi. Later Bram Moolenar would create vi improved "Vim" for short, which is the editor we use today (with many upgrades since then).
There's also NeoVim which is a fork of Vim that provides Lua support for plugins and configuration among other improvements and changes. It's very similar to Vim and even supports many if not most Vim plugins but the two editors are slowly diverging from eachother.
Also, apologies if you were just joking and already knew all this.
(Edit) Further apologies for replying 4 months later. This just popped up in my feed and I blindly assumed it was recent, I just now noticed the timestamp on your message (and on this video).
I recently discovered your channel a week ago when I was looking to learn how to use doom emacs/org-mode and Linux. You've been a tremendous help, and I appreciate all the videos you've made! I've seen a ton, and you always explain stuff so well for beginners like me
The entire point of Linux is to have it the way YOU want it!
This has very little to do with Linux. You can customize most developer tools just as much as Emacs. VI emulations are nearly universal. There are actually rather hard criteria that answer the question of whether Evil is "right" for someone. Someone who is used to use the mouse and likes to do it, will benefit very little from Evil (or Emacs). They will suffer much more from quirky behaviors of mouse interactions and copy-paste actions. Evil/VI is great to reduce mouse interactions, because they make keyboard actions easier accessible, easier to remember and thus more powerful, reducing the need for mousing. Evil has many advantage over Emacs-Acrobatics, but you need to add a layer of abstractions to all interactions with the computer, because of the universal presence of *the mode*.
We could ask the same question for VSCode on Windows or Mac, and the same reasons for deciding one way or the other would apply.
I used evil mode in emacs in the past just because of the not very practical positions of the alt and ctrl key. Then I discovered that you can redistribute keys freely as you please with xmodmap. Now I am using only the emacs key bindings.
I mean, C-x C-s is actually fewer keystrokes than :w, especially if you just hold down Ctrl. So I can't agree with you there. Sometimes emacs commands are longer but if you're counting keystrokes you can't ignore the fact that in vim you have to switch out of insert mode to perform your command anyway, so it's not much of a difference to holding Ctrl in emacs since the command essentially is prefaced by an ESC press.
i've used default keybindings for a couple years, if you're new to this and considering it, i'd highly recommend remapping the control key to something that can be hit with your thumb. i'm on a macbook and remapped the control key to the command key, it makes default bindings significantly less painful.
especially if you're young, be proactive and take ergonomics seriously. you can't write code if you can't press keys.
Hi @dt,
just FYI: you don't have to stretch your fingers when using default emacs keybindings, because you (usually) have 2 ctrl-keys.
E.g. just use the right ctrl-key to perform ctrl-x ctrl-s (for saving).
Cheers! 👋
I can't believe people don't do this...
Most underrated comment
I'm a dvorak typer, and the evil bindings are actually fine for me. H and L are still on my right index and pinky, and J and K are right next to each other on the bottom row on underneath my middle and index fingers. I do also type with qwerty, and I've used evil with both layouts, and for me, I actually find that the HJKL bindings are *more* ergonomic on dvorak than they are on qwerty. As for the rest of the bindings, they're all mnemonic, so their locations on the keyboard aren't really an issue except for muscle memory.
Split spacebar. Rebind CONTROL to the thumb side you don't use for normal space when typing. Split spacebar should really be the default on all keyboards now.
On a non-programmable keyboard you won’t be able to bind the two spacebar halves to two different keys I believe. And you want to have the modifiers on both sides anyway, so the problem is that regular keyboards have an unnecessarily long spacebar.
I use the defaults as I somehow prefer chorded keys to modes.
But I switched to ergo dox years ago, before I started to use Emacs as my default shell and only installed it for org-mode.
I have (back space, del, ctrl, alt, begin, end) and (space, return, page up, page down, altgr, ctl) on the two thumb clusters.
IMHO it's perfect for my strongest fingers and I can't get, how both thumbs are doomed to space on a regular keyboard!
15:30 I think the mistake here is trying to apply the vi commands to Emacs. I would just M-d to delete a word instead (or any of the other commands).
I also use a lot the feature that searching (and other commands) set the mark where they started. For example: C-s type enough text to get where I want, and then the mark was left where the search started, so I can just hit C-w and get rid of the text. Or M-% replace a string within the region. Or undo within that part of the file (ignoring other changes made elsewhere).
This is very powerful, but in a different way than Vim.
Started using Emacs in fall of 2000, in 2003 I switched to Vim, then I switched back to Emacs couple years later.
I tried Viper mode many, many years ago, but wasn't a fan.
If I'm on a remote server, I launch vim for quick edits, no problem. For longer sessions, I prefer using TRAMP.
And I usually use Emacs with the default keybindings plus some custom ones.
The point is, I can use both, I like both, anybody should do whatever they want to do.
Edit: I have a mechanical keyboard with the ctrl keys next to space (akin to the command key in Mac). I got used to this layout when on a Mac in the late 2000s, and I stuck with it.
Ctrl is to Emacs, what Esc is to Vim. I cannot even reach Esc (can anyone) without moving my hand far away from the home row. Long live the option to remap key!
I use keyd which offers the option to use an overload, meaning if I tap Caps it will be an Esc, and if I keep Caps pressed it behaves as Ctrl. I also bound Caps-hjkl to replace cursor keys so I can basically use hjkl everywhere.
Why don't you just use your TWO Controls?
@@exnihilonihilfit6316 because of where they are positioned. The "caps" key is on the home row. I cannot reach the regular Ctrl keys with my fingers, just like the Esc key. Remapping Caps makes it much more useful.
Ive been a colemak user for several years now, and it can be frustrating having hjkl only really accessible by my right index finger as a Vim user. I usually only ever need one at a time, which is just enough of a saving grace for me to feel like its not worth it to swap hjkl with neio. But the temptation is very real.
I am also Colemak user with ctrl-capslock swapped and with I love vanilla emacs keybindigs.
The real tragedy is that customisation has largely vanished outside of free software, especially on the web. Changing key bindings and theming at least the colours should be considered baseline for any professional software.
On the subject of emacs keybinds, I think there's a lot of value in using them in anger before switching to vi keys. One thing that puzzles me is seeing relative line numbers in emacs - if you are moving several lines, it's easier to isearch for the specific text you want to move to, and that doesn't require taking your eyes and brain off the target. You can miss these little cognitive bonuses if you don't try it vanilla first.
TRAGEDY? Seriously?!? My god, people today!...
"That's twice as many keystrokes" - When in Emacs mode, I put my pinky on Control and then hit x-s and x-c with pointer and middle finger. That basically 3 keys for 2 actions. In VI, depending on the mode, I hit Esc S-; w q, That's 5 keys. But then there is always the risk that I try to be smart and omit the ESC to be efficient but I was wrong about being in command mode, and then I have to delete `:wp` from the text and start over.
My point being, I actually doubt that Evil in itself is so much more efficient, unless you are well tuned to use it. The biggest advantage are key chords (not needing a modifier key).
There are some really annoying problems with Evil too: If you use long insert-cycles, like writing a couple of paragraphs in one go, then you make a mistake and undo, the whole insert cycle is a unit. In Emacs mode, you have undo for every single command (bascially each character you type). I'm certain you can configure evil to preserve the fine granular undo, but by default undo can often be an all-or-nothing proposition.
Another example that's really annoying is when I'm using automatic line breaks (with org/proportional fonts), vi's movement commands default to move based on data in lines (
) and not what you see on the screen. Cursor keys do "the right thing", VIM users would use `gk` or `gj` instead of `k` and `j`. But that doesn't work in evil-org. All that can easily be fixed, but it has to be fixed, while it's just working in Emacs. And of course, if you fix it, you develop "bad habbits" for VIMisms.
I don't want to say that Emacs mode is better, just that in such a comparison, there are only very few hard properties that you can compare. And these really come down to:
- Can your brain get used to modes
- Is your hand hurting in Emacs
- Do you want to use a mouse
- Are you willing to learn key bindings
- Do you want to learn Emacs (where to find command name, help, write an elisp function, etc)
Depending on answers to these questions, I think you can make a solid suggestion of whether evil or emacs bindings are a better point to start with.
I am an apostate Vimist, just recently converted to the Church of Emacs. Last night in fact, I finally removed vim from my computer. One huge advantage of using evil mode becomes obvious when you're editing your init.el. If you have electric-pair enabled (which I do), you will often find yourself in a construct such as (global-set-key (kbd "C-c d") 'insert-current-date) where after type the 'd', you need to move forward a character or two over the auto-supplied "). In vim, you would need to hit escape, tap 'l' a couple of times then hit 'i'. In Emacs with evil mode enabled, you don't have to exit insert mode at all, since the Ctrl-f and Ctrl-b emacs bindings work just fine. Not all the vanilla bindings work the same in evil-insert-mode though. On my computer, for example, in evil mode Ctrl-e in evil-normal-mode seems to add a blank line below the cursor, while in evil-insert-mode it simply moves the cursor forward a space, though in other contexts, it seems to act like the vim 'dd' binding, deleting the entire line the cursor is on.
In any case, it helps enormously to be familiar with both. sets of keybindings, especially when running Emacs with evil bindings
I will mention C-x C-s is the same key strokes as :w... , ;, w, .. But Most of the time if you count a key chord as multiple strokes then vim nearly always less strokes.
I am not a programmer so I never learned to use Vim or Emacs beyond the basics. My interest in exploring Emacs beyond the basics is for system administration. Now that my hands have become arthritic with age I find that the standard emacs keybindings are easier for me than evil. Using the Gnome Shell for years has taught me to reach for the C-M keys habiltually. Thanks to custom key bendings in Emacs I am using both the C and M keys rather easily. It really does come down to personal choice so thank you foper making this video.
What I don't like about the evil keybindings is that it is not quite universal even if you turned the evil mode on. It sure is better than vim keybindings on vs code but still not quite there in emacs. So, stuck at neovim atm
learning doom emacs- please keep up the great content!
There is no "wrong" way to do it. I started with Doom and Evil mode and I don't think I'd be using Emacs at all without them. I would have never started.
As a longtime emacs user (I actually use it for everything from browsing to listening to podcasts to editing code), there's nothing wrong with changing keybinds. Use your software in the way that makes most sense to you.
I think it depends. If you use evil in vanilla emacs you have vi keys in text editing but you end up with emacs keybinds and chords for anything other.
This is why there is doom. They do a incredible job in making evil in emacs a coherent experience
@9:14
C-x C-s, vs :w
...
twice as many?
shift ; w, 3
control x control s, 4
then consider your finger doesnt have to come off control,
then consider you can slide from x to s, almost like it's one key press...
and then consider you have to take your finger off shift between ; and w,
then it starts looking like the emacs keybinding in your example here, is the easier and simpler. far from the asserted twice as many key presses.
and shift ;'s a little akward i find. though maybe that gets fine once you're used to it.
having said all that in defense of emacs bindings,
i dont really like it (though i like vim bindings less)
and, i have cua mode, to satisfy the 19 years of muscle memory i picked up from before starting emacs in 2014. n_n
(does that put me in the "really weird" category?)
:D
I really like the which-key in spacemacs. Great point from DT is "software is just a tool and you just need to get the result using this tool".
That was my doubt about why use evil mode within emacs, and in a way, I was trying to follow the absurd idea "the emacs way" like a mandatory use only C-whatever, but the emacs way, as you already said, is "the emacs way, use it whatever you want" Thanks for that, I had forgotten it.
I use both Emacs and NeoVim. It’s just nice to have a fallback when I don’t remember a native command.
Evil = Emacs Vi Lisp
E=Emacs
vi=vi
l=Lisp
Honestly knowing some emacs key bindings is helpful.
But that’s all.
The evil bindings are much more powerful than vanilla emacs. This already shows when copying a line. In vim that’s yy.
In emacs that is C-a M-SPC C-e (to mark the line) and M-w to copy it on the clipboard.
That is why there are many extensions with bindings available for emacs, some modal, some not.
"'C-x C-s' in Emacs or just ': w' in vim"
In fact the vim's stroke is ":w" but if you are in the edit mode then " : w " The vim-ers love to don't mention additional keys of the stroked.
I have only used evil because I learned first vim. But I'm too lazy to learn the Emacs default key binds, everytime I need something that is not possible with evil mode, I just look for it with Mx or with a custom keybind I preconfigured, or use the options offered by the menu in doom...
The trick is to move your whole hand so your index finger is on alt.
Learn touch typing people! It helps a lot!
12:27 On Ergodox EZ and Moonlander you wouldn’t be reaching with pinkies because you would be using your thumbs for Ctrl.
it's not Emacs. it's keyboard fault. the control buttons are in the wrong place. I set Enter to be R-Ctrl, Backslash to Enter, R-Ctrl to Backslash and switch L-Ctrl with Caps-lock
Isn't this just mincing words? To make this meaningful, there needs to be a common understanding what "wrong" means. Since there is no such common understanding, people who would ask that question just don't have the criteria at hand to make up their mind.
If you use evil-mode in Emacs, you get an experience very similar to the VI family of editors. If you are familiar with, you know what that means. If not: VI uses modes. That means basically that you either enter text with your keyboard, then VI is mostly like any other program or you are in command mode. In command mode, keys let you issue commands instead of adding letters to your text. The advantage is that in command mode you have the whole keyboard available for "function keys", and they come with mnemonics. `f` for find, `c w` for change word. That is incredibly efficient and you also don't need to combine keys with control/alt/shift (for the most part).
The price for using evil or more generally modal editors, is that you need to be aware in which mode the editor is at any moment in time, and whenever you are wrong, the editor behaves weirdly. Either weird stuff happens when you expect text to appear or you find `:wq` in your source code.
Whether this is for you or not, depends on whether the increase in efficiency outweighs the potential confusion.
When it comes to Emacs and Evil-mode or not, there are some additional things to consider. A lot of documentation presents the default keybindings (which unsurprisingly in Emacs are not VI bindings). So this documentation may not help you. Not a big deal because there is always an easy way to find the actual keybinding of a command and also a way to find all commands available to you. So if you know your way around Emacs, this is not an issue.
Another problem is that depending on how you use Emacs, you may have a more or less complete translation from Emacs to Evil keybindings. Doom does a great job to make things consistent and cover a huge set of modules with consistent Evil support. They also define a whole lot of key-chords which are available to both Emacs- and Evil-mode which you can always switch back and forth to using C-Z. Like this, it actually matters very little which binding you chose, because you can even define this on a per buffer or per mode base.
But - and this is worth some consideration - you then use 4 different configuration mechanisms, Emacs-bindings, Evil-bindings, Doom-bindings and finally whatever you do on top of all that.
You might also consider that since some kind of VI emulation is available in most if not all mainstream IDE's and tools, being familiar with Evil bindings might make your life easier even outside of VIM and Emacs. If modal editing is for you, something that you need to check out for yourself.
I personally can work equally well with Emacs-, VI- or mainstream (mousy) paradigms, and since I switch environments regularly depending on my work context, this really helps me. I like the flexibility that my approach provides, but I'm probably not benefiting from any paradigm as much as I could if I would be more dogmatic about i. Then I would know more key combinations by heart and would be faster whenever I work in my native environment, but it would be much more devastating to have to switch.
So if you are already familiar with Emacs and don't get along with modal editing, Evil is wrong. If you are new to Emacs and rely on its documentation and don't use something like Doom, Evil is probably wrong. If you are a VIM user, Evil is saving your life .Then you also should use something like Doom to make Emacs more VIMish. If you are like me, know both VI (as opposed to VIM) and Emacs, Evil especially in combination with Doom is awesome but neither right nor wrong.
In Vim I find it hard to constantly switch modes just to get my movement ability back
change caps lock to escape. is a blessing
Can confirm that. Caps lock is an almost useless key anyway.
@@kenneth_romero or bind it to Ctrl for Emacs. Yes, the CapsLock function is useless.
in vim you also can use ctrl+c as alternative for escape, i prefer use cap lock for ctrl rather than esc
Aw this is such a sweet video!
Excellent!
If anyone wants DT to use the "Default" settings, they really are watching the wrong channel. Anyway, in Linux, there are too many ways to get things done. Each his own. But in the end, we hope to make Peace among peers. That is what is all about, right?
Yes! 😁
Yes, you MUST learn to write on a typewriter before you touch a keyboard as well
Have you tried xah-fly-keys ? There's a problem with CI" in evil, I had to create a text object to fix it. Nano keybindings are hard for sure lol. Any benefit from to switching from vanilla to doom ? I have a big vanilla config so I would be overriding alot of doom things which defeats the purpose of using doom.
I like my navigation keys to be global. so either use Vim everywhere or Emacs. using evil mode makes it confusing for me
The absence of an entire QMK playlist on your channel continues to baffle me..
Evil is great for lisp. As a vim guy.
My question is, is doom emacs an entirely separate project or more like a collection of patches? because if it's the former if the devs of the fork decide to quit or if the projects go in different directions that the changes become too much to maintain then i still have to learn the default key bindings.
It's a separate project. They don't actually alter the emacs source code (hence why it's not a fork), they just provide a pre-built set of configurarions for it that makes it a bit easier to get into
It is an extensive set of configuration sitting on whatever Emacs distribution you pick. You install a version of Emacs first and then add Doom on top. Doom comes with a CLI utility to properly sync updates.
Everything VIM is way too cool for me so I am just gonna stick with good old GNU Emacs with the default key bindings.
Don't use GNU Emacs key bindings if you don't have pinkies! 😆
I think colmak and vim work very well together
binded =/= bound ;)
I would check out Emacs but I’m so used to using Vim, it’s the first text editor I used with Linux.
Emacs actually sucks with the default settings, and is meant to be customized as the users see fit, and I really fail to relate to those who think that there is an idiomatic way to use Emacs.
Holy jeez... The Unix world hasn't moved on from editor flame wars? What are we, five?
Some people ... is not "The Unix world",
kid.
Strawmen? What are we, five?
Just use what you want, try it, embrace it, or change it if you don't like it. Don't listen to the toxic Linux community.
Imagine creating a keyboard layout specifically made for emacs 💀
I can't stand the vi keymap. And have no need to use vim. But I know enough to enter insert and get out if that, remove chars and how to exit vi.
So I don't need the default easy of Exit vi, rebooting the computer. 😉😎
And Emacs is the default keybindings in Bash.
And if you have problem, with Emacs, remap Ctr key, as it was meant to be from the beginning.
CUA are new convention, compared with Emacs.
This said, use what you like, I don't care.
@@exnihilonihilfit6316 no, have you?
I guess, because that was what you thought about.
If you weren't supposed to configure a program to work the way YOU wanted it to work, the program itself wouldn't have the option to do it...
Nothing is wrong with nothing if you zoom out enough.
man i hate that ctrl button,
You use qtile wrong. You're supposed to leave it at its default configuration and never do anything else.
Edit: Forgot what community this is for a moment. That was sarcasm and written when I heard (paraphrasing) "you're using emacs wrong".
My favourite way to use emacs is to not use it. I used to use it but it's now pointless for my purposes. Same with VIM. It's powerful and fast but overkill for me now. Plus, it sucks rebooting the computer just to quit VIM.
Edit 2: Forgot which community again. Yes. I am familiar how to write and quit VIM. It's very similar to man pages. Having to reboot the computer was a joke... Well... It wasn't a joke the first time I did it and couldn't get out. But, that was what? 20 years ago? Wait. How old am I? Yeah. I think it was 20 years ago. Also, it may have been VI. I can't remember what Mandrake came with by default. Was it Mandrake? It may have been Slackware or RedHat. I can't remember because it doesn't matter. Anyway, enjoy the comment.
You suck at writing, and jokes... what a pain to read!
Roo much into yourself...
Get out there.
*Meanwhile me, in a corner wondering what the hell y'all are comparing text editors for*
Can you type and delete words and possibly save the changes? Good enough for me lol
Wait emacs isn't modal? 💀💀💀 I guess I'm trapped to vim forever
It’s emacs, so yes, it’s evil 🤓
This sounds like the "you're not an arch user if you used archinstall" fallacy, but with a new coat of paint.
*changes vim keybinds to emacs keybinds*
what are you gonna do now? It' my wish ¯\_(ツ)_/¯
Emacs is a lot of things. But as an editor sucks big time. It's a disgrace for such an old software to have such a crappy editor. That's the main reason why Vim is way more popular, it's an amazing editor.
Mantab jiwa
Well duh, it's Evil mode >:D
It is evil yes, it should probably be banned in fact
First!
nano left the room
I prefer VIM keybindings but if I were to learn the default GNU Emacs keybindings I would use God mode.
This is Linux... zfreedom! What's evil?
when you learn emacs with vim keybindings you could just use vim
Just use nano
It's honestly funny how protective these people get with not only their favorite software but even their favorite configurations. Some really primitive thought processes that have no place in our day and age, imo.
I'm not an Emacs user, and don't want to be a gatekeeper, but using Evil mode is kind of cheating. Don't get me wrong, I'm all for vim, love vim keybindings but Emacs is meant to be used with its own keybindings. If you just keep using Evil mode you're still running vim inside Emacs and fooling yourself. Of course you can still do that from a technical standpoint but it's still cheating.