3 ms·
It's not evil but there is also a built in emulation for vi called viper. I've never used it to emulate vi but I have used it to emulate ex, which is a part of
by Blackthorn 4y ago
It's not evil but there is also a built in emulation for vi called viper.
I've never used it to emulate vi but I have used it to emulate ex, which is a part of vi. I don't know if anyone else feels this way but when I started with emacs a long time ago I thought that ex commands were much more productive for things like searching and replacing. For anyone who knows vi, that is for example :%s/regex/replacement/
So I just bound the ex prompt to C-c :
Maybe emacs does better for search/replace these days. What do others think?
- susam 4y agoFor search and replace, the ex substitute command (:%s/pattern/string/[flags]) does feel more convenient and flows out smoothly from the fingers while typing such a command. For search and replace operations, it is indeed very productive. However the incremental search (C-s) of Emacs goes much further than that. It is packed with features. While it has too many features to enumerate in one comment, I'll just pick one thing about it that I have found useful and quite enjoyable. It is the set of various toggles Emacs incremental-search comes with. Some of those toggles turn out to be very useful in special circumstances. Say, I have a source code file that is doing some regex-based work. Both the regex "f.." and the strings it matches like "foo", "fox", etc. occur in the file. Now say, I want to search for the regular expression pattern "f.." (not the strings it matches). I can of course do that simply with: C-s f.. After searching for that regular expression, I decide that I now want to search for strings that match the regex pattern "f..". Now I can simply change the string search to regex-based search with this toggle: M-r As another example, let us say, I start searching for the string "web_server" with this key sequence: C-s web_server RET But then I realize that the current code has the words "web" and "server" written together in all kinds of notation like "web->server", "web::server", "web-server", etc. and now I want to match all of them. In Vim, I would have to cancel the current search and write a new search expression, perhaps something like /web.\{1,2}server or maybe /web[-_:>]\+server depending on what we need. In Emacs, I can do it with this toggle: M-s w And now it would match "web->server", "web::server", "web-server", etc. I know you specifically mentioned search-and-replace, not just search. The conveniences I illustrated above are available equally well in search-and-replace too because converting a currently ongoing search to search-and-replace in Emacs is yet another toggle: M-%