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).
https://www.gnu.org/software/emacs/manual/html_node/emacs/Ma...
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.
(defun replace-regexp-g ()
(interactive)
(save-excursion
(goto-char 0)
(call-interactively 'replace-regexp)))Be aware, however, of iedit-mode. Select a region of text and enable iedit-mode, and any change to the selected region will be propagated to every other instance of the region's text throughout the document.
Using iedit-mode in combination with rgrep (recursive grep) and wgrep (editable grep buffer that propagates changes to the underlying documents) is a decent way of doing project-wide refactorings.
And of course, neither iedit nor wgrep are part of the base emacs install. Using the package manager is essential.
If you are just replacing plain text (no regexps) then take a look at iedit. Then C-; will edit all occurrences of the word at cursor.
spacemacs also has extensive documentation, so you can learn key bindings easily and be productive with Emacs immediately without any extra configuration.
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.
I'm not sure which one is better either.