5 ms·
"Mind Exploded" basically does what vi/vim natively does in an inferior way... (2x key strokes!)
by covi 12y ago
"Mind Exploded" basically does what vi/vim natively does in an inferior way... (2x key strokes!)
- hk__2 12y agoVim is a modal editor, which means one keystroke doesn’t have the same meaning in one mode and in another. Emacs, on the other hand, doesn’t have all these modes, which is why you have to use modifier keys like ctrl/shift/alt to tell it what to do. That’s two paradigms, I’m not sure one is better than the other (note: I’m a Vim user).
- aerique 12y agoI switched from Vim to Emacs 15+ years ago because I did not like modal editing. Now I am using evil-mode in Emacs :-| I'm not sure which one is better either.
- pyre 12y agoI'm currently in the middle of attempting to gain proficiency in Emacs. I have to admit that it's difficult being someone that's spent 10+ years using Vim. I'm used to being able to just hit HJKL as a nervous habit, which doesn't go over so well in Emacs. I feel like there are many things in Vim that seem superior at first glance. For example, if I want to do a regexp search/replace in Vim, I can do this from Normal Mode (which will replace throughout the whole file): :%s/regxp/replacement/g<enter> Emacs (by default) has `replace-regexp`: M-x replace-regexp<enter>regexp<enter>replacement<enter> My only problem? This only replaces from the cursor to the end of the file/buffer, so to replace over the whole file I would need to do: M-< M-x replace-regexp<enter>regexp<enter>replacement<enter> It just seems that much more complicated, and now I've lost my place, so I'm at the top of the buffer rather than wherever I was in the file. On the other hand, I find Emacs Lisp to be much easier to deal with then VimScript/VimL even as someone that has written my own Vim plugins, and created plugins to patch issues with files in the standard Vim dist (too lazy to submit a patch and wait for the next Vim release).
- baddox 12y agoThis obviously isn't a solution to your valid complaint, but you can use C-u C-SPC to navigate to your previous cursor position. It can band-aid your issue, but it's also quite useful in general. https://www.gnu.org/software/emacs/manual/html_node/emacs/Mark-Ring.html https://www.gnu.org/software/emacs/manual/html_node/emacs/Ma...
- inclemnet 12y agoAre you aware of evil-mode? One of the many things it implements is the :%s/stuff/otherstuff/g syntax.
- pyre 12y agoI'm aware of evil-mode. I'm attempting to try 'the Emacs way' first. I'm not attempting to just throw myself in. When I need to be proficient I'll fallback to Vim, but I want to gain access to things like org-mode, for instance.
- klibertp 12y ago"The Emacs way" is very much "learn some elisp and write whatever you want". I switched from Vim to Emacs and in the beginning there were some things I really missed. One that I remember was "*", which in Vim/my config highlights current word in whole buffer and let's you n/N between matches. In Emacs, doing the same with M-left C-s C-w felt just wrong. Fixing this was a matter of 2-3 lines of very straightforward elisp. I since started relying more on Occur mode and IEdit mode for this, but the experience of lacking a feature and adding it absolutely painlessly remained with me. Writing simple elisp and simple editing-related features is a joy under Emacs. It's much easier than in Vim, for a number of different reasons. This makes me think that "the Emacs way" is about scripting and programming it to do whatever you need it to do.
- Wilfred 12y agoYou may also be interested in https://github.com/nschum/highlight-symbol.el https://github.com/nschum/highlight-symbol.el which provides highlighting of the current symbol, and provides highlight-symbol-{next,prev} commands to move between occurrences of a symbol.
- pmoriarty 12y agoEmacs does have modes (even if we set aside vi/vim emulation modes like evil, which is discussed elsewhere in this thread). When you use certain major or minor modes in emacs, you get to use a whole new set of keystrokes, by which you're effectively doing modal editing. One well-known example is magit.[1] When you activate magit, you can type all sorts of new one- or two-key commands. This is comparable to modes in vim. [1] - http://www.emacswiki.org/emacs/Magit http://www.emacswiki.org/emacs/Magit
- hk__2 12y agoThanks. As a Vim-only user I don’t know all these Emacs things (but am willing to learn).
- sjm 12y agoExactly right! All input in Emacs is just a key-bind. In a buffer focused on text-editing, letter keys (e.g. "a") are actually bound to a function called self-insert-command which inserts the last character typed. Modes like magit just re-bind keys to different functions (e.g. "s" gets bound to magit-stage-item).
- rdtsc 12y agoNo because keystrokes happen at the same time. They are cords. Is typing 'A' 2x the keystrokes that typing 'a'. Sure but it doesn't matter, it happens at the same time -- 'Shift+a'. So it is actaully Vim that takes 2x the time to do anything because you have multiple modes to track and switch from. If you look at how stenographers type, they don't use modes, they use cords. They also minimize moving the hands away from the homerow (or equivalent of), and by "minimize" I think that movement might be 0 actually.
- mostly_harmless 12y agoBut programming is not equivalent to stenography. Stenography works on a stream of input speech converting it into text, whereas programming is separated into the 2 modes of browsing&thinking and actually editing. But I think it comes down to preference of whether you want the universality of commands, or conceptual separation of modes.
- clarry 12y agoCounterpoint: many of the world's fastest typists avoid using modifier keys (and prefer caps lock over shift for typing uppercase letters), because using them requires careful timing: press the modifier after any other keys, press the key you need modified, lift the modifier. If you press the modifier too early or raise it too late, you screw up. In normal typing with no modifiers, it doesn't really matter when you lift the finger. You can afford to go much faster.