The extensible vi layer for Emacs
71–80 of 104 posts
Re: The extensible vi layer for Emacs
#72Earlier quoted context omitted.
So I fired up Emacs: emacs -q M-x viper-mode RET Chose expert level 1 for beginners so that it is closest to Vi behavior. (Recommended level is at least 3 but that does not make a difference for what I am about to explain.) C-x C-f foo.txt RET i hello world RET hello world RET hello world RET ESC Looking good so far. gg Does nothing!! Okay no problem. Let me try: :0 RET Good. I am back to the top line. V Instead of s…
Yes, gg and v/V appear to be vim-only commands. One vi counterpart to gg is 1G. Visual mode is a vim-only concept, I believe. The rest of them, I would bet are vim-only. Yes, I can see why, if you require all of these vim features, viper would not be good for you. "Viper mode is terrible though." was not a good way to express this. The title of the thread, and the name of the package (incorrectly) state that it is a…
Re: The extensible vi layer for Emacs
#73Earlier quoted context omitted.
So I fired up Emacs: emacs -q M-x viper-mode RET Chose expert level 1 for beginners so that it is closest to Vi behavior. (Recommended level is at least 3 but that does not make a difference for what I am about to explain.) C-x C-f foo.txt RET i hello world RET hello world RET hello world RET ESC Looking good so far. gg Does nothing!! Okay no problem. Let me try: :0 RET Good. I am back to the top line. V Instead of s…
Yes, gg and v/V appear to be vim-only commands. One vi counterpart to gg is 1G. Visual mode is a vim-only concept, I believe. The rest of them, I would bet are vim-only. Yes, I can see why, if you require all of these vim features, viper would not be good for you. "Viper mode is terrible though." was not a good way to express this. The title of the thread, and the name of the package (incorrectly) state that it is a…
Agreed and thanks for calling it out. Will be more careful next time.
Re: The extensible vi layer for Emacs
#74I used that settings for a few years, then tried to move entirely to vim, and now I'm very happy with vscode + vim. I like vim as a touch typer, I think it's a setting that minimize end motions. It's also very convenient in the terminal. On the other hand, I think it's not convenient as an IDE: too many shortcuts, clumsy integration with LSPs, especially when you need to work with different languages. For me it works…
> That being said, I wonder if I wouldn't be better off moving away from vim entirely That's a surprising sentence to read, as someone who's also used to vim (although I've moved from vim to emacs+evil and not the other way around). I have some gripes with my emacs+evil setup, just as I had some gripes with my vim (and then neovim) setup. But none of those gripes were related to the actual text editing, but rather ma…
Well, I feel modal editing is "comfortable", as in easy on the fingers. But overall, I'm also quite fluent with the mac os shortcuts. Maybe it's just a matter of learning the few things I don't know how to do without vim and I'd be equally happy. The added bonus would be to have a simplified set up that would work in every contexts where vim isn't available. That being said, it's not something I want to do actively as I'm happy with my set up, but just wondering if the benefit is real.
Re: The extensible vi layer for Emacs
#75There's also meow-mode[1], which isn't a vim emulator as such, but it is a different modal editing layer for Emacs which is a lot faster and has a lot of neat ideas. It doesn't interfere w/the stock keybinds at all though, which is much nicer imo (I use a 'hybrid' editing style generally) 1: https://github.com/meow-edit/meow
Re: The extensible vi layer for Emacs
#76Re: The extensible vi layer for Emacs
#77Re: The extensible vi layer for Emacs
#78I'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?
Re: The extensible vi layer for Emacs
#79Re: The extensible vi layer for Emacs
#80It'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…
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-%