You are not logged in.

#1 2013-03-13 00:13:45

akh
Member
From: Copenhagen, Denmark
Registered: 2012-09-24
Posts: 25

Vim mode in Emacs (no editor war)

I've been using vim for some time now and I really appreciate the different modes and key bindings. I've experimented a little with emacs and I really like it as a development environment and its flexibility and extensibility, but so far I don't really like it as a text editor (I'm not interested in starting a discussion about vim vs. emacs / editor war).
Of course I might need to get more familiar with emacs to appreciate and get used to its text editing "paradigm". I've been thinking about using one of the vim modes for emacs (viper-moder, evil-mode...) to be able to use emacs as a development environment, and vim as the editor, but some people seem to believe that it's better to learn the emacs way of doing text editing.

Why would I not want to use a vim mode in emacs if I like the way of editing text in vim? What are the downsides compared to using emacs alone?

I basically want to keep vim as my text editor, but have the ability to use it with emacs when doing more than just simply editing text. Is this worth the trouble of using a vim emulator? Any other users doing this?

Thank you

Offline

#2 2013-03-13 00:45:13

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,422
Website

Re: Vim mode in Emacs (no editor war)

I'm curious what additional behavior / features you want that vim can't provide.  I only very briefly dabbled in emacs, and also ask only out of pure curiosity: I've been amazed at how much I can extend vim's behavior and I'm wondering if there is either 1) something useful I am missing, or 2) something useful that could be scripted into vim.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2013-03-13 02:54:50

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,728

Re: Vim mode in Emacs (no editor war)

I can use both vi and emacs.  The thing that attracts me to emacs is that it is stateless.  The thing that attracts me to vi is that it is ubiquitous. 
Putting a statefull interface on emacs just seems, I dunno, wrong.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#4 2013-03-13 03:03:33

lspci
Member
From: Virginia, USA
Registered: 2012-06-09
Posts: 242

Re: Vim mode in Emacs (no editor war)

Trilby wrote:

I'm curious what additional behavior / features you want that vim can't provide.  I only very briefly dabbled in emacs, and also ask only out of pure curiosity: I've been amazed at how much I can extend vim's behavior and I'm wondering if there is either 1) something useful I am missing, or 2) something useful that could be scripted into vim.

lol, I totally agree with that statement.  big_smile

As for what could be scripted into vim, a built-in compiler or at least a compiler-command resolver would be nice. tongue


NOTE: by compiler-command resolver, I mean that if you're working on a 'file.c' then when you run something magical like this:

:compile

it would send the following to the shell

gcc -Wall -O3 file.c -o file
akh wrote:

I've experimented a little with emacs and I really like it as a development environment and its flexibility and extensibility, but so far I don't really like it as a text editor (I'm not interested in starting a discussion about vim vs. emacs / editor war).

I've also found that Emacs is really nice for certain development-esque tasks.  Like, I used to use Emacs, back when I first started using Arch, to edit openbox's config files and I have always fondly remembered it being super-cool at working with the xml.  Like it would even highlight mistakes and was always pristinely consistent with syntax highlighting and indenting from what I can remember.  (Honestly, I kind of miss using it to edit XML, lol, xD I've developed an emotional attachment to a text-editor. tongue)  I still occasionally use Emacs for when I'm having a hard time getting a certain lisp function or what-have-you to work (see lispbox) and then only when I'm tired of how awkward my setup of vim-slimv is--I've been needed to amend some aspects of it for quite a while, but I haven't been using it lately, so--naturally--I've haven't bothered to do so. 

And I agree with you 135% tongue on not liking much for text editing; I prefer a more modal environment.  wink

As for editor wars, I honestly don't understand where the glory of dying in battle for your favorite text-editor is... maybe behind the couch or wherever the potato chips are

in my opinion, they're a waste of time for the participants; as for the readers, I actually find it a bit amusing to read them, or of them.  Honestly, though, I don't understand why we can't all just enjoy having an editor that we adore and love no matter what that editor is. 

EDIT: Take a look at this forum post vim vs. emacs, I only glanced at it, but it seemed to be talking about ways to make emacs better for just plain text editing.

Last edited by lspci (2013-03-13 04:37:06)


Please don't be a help vampire. | Bitbucket

Give a little more for a little less today.  smile

Offline

#5 2013-03-13 03:22:22

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,422
Website

Re: Vim mode in Emacs (no editor war)

lspci, there is nothing magic needed for that "command resolver", just check out ":help command" to learn how to create user defined commands that can do exactly this.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#6 2013-03-13 03:28:45

lspci
Member
From: Virginia, USA
Registered: 2012-06-09
Posts: 242

Re: Vim mode in Emacs (no editor war)

Trilby wrote:

lspci, there is nothing magic needed for that "command resolver", just check out ":help command" to learn how to create user defined commands that can do exactly this.

Oh, I know that, Trilby.  tongue I was just using the term 'magic' to emphasize coolness, I think...

Oh... wait, *re-reads previous post*

Okay, I was talking about like actually having a command resolver compiled into vim, that is not being user-defined.


NOTE: I am well aware of user-defined commands, just in case I didn't uh... make that apparent.

Last edited by lspci (2013-03-13 03:36:05)


Please don't be a help vampire. | Bitbucket

Give a little more for a little less today.  smile

Offline

#7 2013-03-13 08:32:49

jakobcreutzfeldt
Member
Registered: 2011-05-12
Posts: 1,041

Re: Vim mode in Emacs (no editor war)

I made the Vim-to-Emacs switch in the last year. I started out by trying one of the Vi-like modes (can't remember which...Viper I think) but I eventually just scrapped that and dove in head first. The thing is that a) Emacs has a few metric shit-tons of features that you can learn and b) it nearly maxes out the possible keybindings. I found that the Vi mode, while it helped me in text editing, prevented me from really learning the rest of the system. Once I got rid of that crutch, I found that learning Emacs went much more smoothly.

Really, Vim and Emacs are fairly equivalent in their basic text editing capabilities, as far as motions, deletion/insertion, macros, etc. go. So, it's just a matter of learning the different keys in each editor. If you are super efficient in Vim, you can almost certainly (to the level of your motivation) reach equivalent efficiency in Emacs.

My advice would be to just try to learn pure Emacs. Print out the reference card (in /usr/share/emacs/$VERSION/etc) and keep it by your desk. Within a week you'll have the basic motion and editing commands internalized, which really is no worse than the week it took to be fully comfortable with the modes and motion of Vim.

Good luck!

Offline

#8 2013-03-13 13:33:11

akh
Member
From: Copenhagen, Denmark
Registered: 2012-09-24
Posts: 25

Re: Vim mode in Emacs (no editor war)

Trilby wrote:

I'm curious what additional behavior / features you want that vim can't provide.  I only very briefly dabbled in emacs, and also ask only out of pure curiosity: I've been amazed at how much I can extend vim's behavior and I'm wondering if there is either 1) something useful I am missing, or 2) something useful that could be scripted into vim.

One example is the ML compiler/interpreter interface that is available with emacs sml-mode: is is very easy to run the SML compiler or interactive interpreter environment in a seperate buffer and to communicate with this subprocess. For instance, it is easy to load the current file, the current buffer in ML process, or to send a selected region to the open SML buffer.

jakobcreutzfeldt wrote:

I made the Vim-to-Emacs switch in the last year. I started out by trying one of the Vi-like modes (can't remember which...Viper I think) but I eventually just scrapped that and dove in head first. The thing is that a) Emacs has a few metric shit-tons of features that you can learn and b) it nearly maxes out the possible keybindings. I found that the Vi mode, while it helped me in text editing, prevented me from really learning the rest of the system. Once I got rid of that crutch, I found that learning Emacs went much more smoothly.

Really, Vim and Emacs are fairly equivalent in their basic text editing capabilities, as far as motions, deletion/insertion, macros, etc. go. So, it's just a matter of learning the different keys in each editor. If you are super efficient in Vim, you can almost certainly (to the level of your motivation) reach equivalent efficiency in Emacs.

My advice would be to just try to learn pure Emacs. Print out the reference card (in /usr/share/emacs/$VERSION/etc) and keep it by your desk. Within a week you'll have the basic motion and editing commands internalized, which really is no worse than the week it took to be fully comfortable with the modes and motion of Vim.

Good luck!

Have you tried out the more recent Evil mode? Some people seem to think this is a lot more smoothly integrated with emacs than viper or vimpulse.
I have considered learning pure emacs from the ground up to be able to judge which text editing approach I like the most (emacs or vim/evil/viper etc.), but then again, I really like the modal approach and I don't really want to leave that. Have you discovered text editing in emacs to be as nice as they were in vim, or do other features just outweigth the lack of modal editing?

Offline

#9 2013-03-13 14:01:16

jakobcreutzfeldt
Member
Registered: 2011-05-12
Posts: 1,041

Re: Vim mode in Emacs (no editor war)

akh wrote:

Have you tried out the more recent Evil mode? Some people seem to think this is a lot more smoothly integrated with emacs than viper or vimpulse.
I have considered learning pure emacs from the ground up to be able to judge which text editing approach I like the most (emacs or vim/evil/viper etc.), but then again, I really like the modal approach and I don't really want to leave that. Have you discovered text editing in emacs to be as nice as they were in vim, or do other features just outweigth the lack of modal editing?

Nah, at this point I'm settled into the Emacs keybindings so I have no reason to try Evil mode. While I had grown quite proficient with the modal interface of  Vim, Emacs made me realize that I'm still more efficient with chording. For all other intents and purposes, they're the same to me, as far as editing capabilities are concerned.

Offline

#10 2013-03-13 17:12:56

x33a
Forum Fellow
Registered: 2009-08-15
Posts: 4,587

Re: Vim mode in Emacs (no editor war)

A few years back I had dived head first into emacs, used it for 2 weeks with original keybindings. In the end, I just couldn't get used to the chording, my hands were strained, and I felt it took more keystrokes than vim to do the same thing. I never looked into vim-like keybindings as I felt it was better to stick with vim itself.

Offline

#11 2013-09-27 04:07:23

darkfeline
Member
Registered: 2012-02-14
Posts: 94

Re: Vim mode in Emacs (no editor war)

First, let me apologize for reviving an old thread.  If there was a sage equivalent, I would've used it.  I found this when googling the topic and thought I'd throw in my four cents (twice as good as two cents!).

I'm a longtime vim user, but I've recognized that Emacs has a lot of features and extensibility that are not available or require dodgy hacks to get working in vim, so I recently made the switch to Emacs+evil.

Let me say this: don't bother with Emacs's text editing.  Vim is the objectively better text editor (I don't want to start a war; hear me out and if you don't agree, fine).  Everything that you need for basic text editing you can do in Vim in a small number of natural keystrokes, whereas even simple cursor movement requires joint-stressing chords in Emacs.  There isn't even a case to be made for Emacs's text editing.  However, Emacs has better everything else, thanks in part to being fundamentally a lisp interpreter.  Vimscript has room for improvement, and while Vim can use Python, etc. for scripting, it just isn't as natural as something like Emacs which is built on a scripting language from ground up.

Thus the natural solution is to use Emacs with vim emulation.  I've tried both vanilla Emacs in the past and the other vi emulators without much success, but evil works very well.  You can use Emacs+evil as you would vim without any problems, although there are a few more advanced features or less used features that haven't been implemented in evil, so you can use it as you would vim while learning about emacs's features and folding them into your work cycle.

Some people say that using Emacs's editing helps you better understand Emacs, but I don't buy that.  Firstly, Emacs's strength is in its large collection of functions/features and its extensibility, not its esoteric chords and keybindings.  Secondly, even if editing in vanilla Emacs helps you learn Emacs faster, it's not worth the inferior text editing and potential for RSI, in my opinion.  Save your fingers, save your time, save your sanity, even if it means it'll take you longer to grow into Emacs's more powerful features.

tl;dr Vim is the better text editor, Emacs is the better IDE/everything else.  Emacs+evil is definitely worth considering for users in both camps.

Offline

#12 2013-10-13 18:50:14

highway
Member
Registered: 2012-07-28
Posts: 81

Re: Vim mode in Emacs (no editor war)

for the life of me i can't figure out how to get around vi/vim . . . tried emacs a bit, it was kinda cool, took the tut, seemed simple enough . . . guess it just kinda "fit" me bettere

i like that it can run MIT Scheme for SICP in it as well

Offline

#13 2013-10-17 04:31:47

darkfeline
Member
Registered: 2012-02-14
Posts: 94

Re: Vim mode in Emacs (no editor war)

highway wrote:

for the life of me i can't figure out how to get around vi/vim . . . tried emacs a bit, it was kinda cool, took the tut, seemed simple enough . . . guess it just kinda "fit" me bettere

i like that it can run MIT Scheme for SICP in it as well

It is a matter of preference after all, but if you want to know, moving around vi(m) is more or less the same as emacs, the key bindings are just different (I won't say superior, though I want to).

+-----------+-----+------+-----+
|Motion     |     |Vi(m) |Emacs|
+-----------+-----+------+-----+
|Forward    |char |l     |C-f  |
+-----------+-----+------+-----+
|Back       |char |h     |C-b  |
+-----------+-----+------+-----+
|Forward    |word |w     |M-f  |
+-----------+-----+------+-----+
|Back       |word |b     |M-b  |
+-----------+-----+------+-----+
|Down       |line |j     |C-n  |
+-----------+-----+------+-----+
|Up         |line |k     |C-p  |
+-----------+-----+------+-----+
|Scroll down|page |CTRL-f|C-v  |
+-----------+-----+------+-----+
|Scroll up  |page |CTRL-b|M-v  |
+-----------+-----+------+-----+

Those are the most used motions.  The gist is, Emacs requires you to hold Control or Meta, while vi(m) doesn't.  (Although Emacs page scrolling is downright atrocious.  Release Control, press and hold Meta, press v if you scrolled one page too far?  Yuck.)  My joints and I prefer the former, but it does help a lot if you do go with Emacs's bindings, to remap Caps Lock to Control.

Offline

#14 2013-10-18 03:23:53

ANOKNUSA
Member
Registered: 2010-10-22
Posts: 2,141

Re: Vim mode in Emacs (no editor war)

As an avowed Vim fanatic, I still feel that much of the hype surrounding Vim's keybindings is overblown.  I like Vim for several reasons, but the bindings themselves---both good (movement and selection keys, command-mode) and bad ("escape" key and modifiers, line-jumping) are largely serendipitous. "Ergonomics" and "efficiency" are just beneficial, vestigial side-effects rather than long-term design choices, and changing the "esc" and "Ctl" key bindings is a must for anyone wanting to take up Vim as a default editor.

Offline

#15 2013-10-18 04:44:19

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: Vim mode in Emacs (no editor war)

ANOKNUSA wrote:

and changing the "esc" and "Ctl" key bindings is a must for anyone wanting to take up Vim as a default editor.

Pshhh. I just use Ctrtl + C instead, unless Esc specifically is needed. big_smile

Offline

#16 2013-10-18 12:12:37

srhb
Member
Registered: 2013-10-18
Posts: 1

Re: Vim mode in Emacs (no editor war)

darkfeline wrote:
highway wrote:

for the life of me i can't figure out how to get around vi/vim . . . tried emacs a bit, it was kinda cool, took the tut, seemed simple enough . . . guess it just kinda "fit" me bettere

i like that it can run MIT Scheme for SICP in it as well

It is a matter of preference after all, but if you want to know, moving around vi(m) is more or less the same as emacs, the key bindings are just different (I won't say superior, though I want to).

+-----------+-----+------+-----+
|Motion     |     |Vi(m) |Emacs|
+-----------+-----+------+-----+
|Forward    |char |l     |C-f  |
+-----------+-----+------+-----+
|Back       |char |h     |C-b  |
+-----------+-----+------+-----+
|Forward    |word |w     |M-f  |
+-----------+-----+------+-----+
|Back       |word |b     |M-b  |
+-----------+-----+------+-----+
|Down       |line |j     |C-n  |
+-----------+-----+------+-----+
|Up         |line |k     |C-p  |
+-----------+-----+------+-----+
|Scroll down|page |CTRL-f|C-v  |
+-----------+-----+------+-----+
|Scroll up  |page |CTRL-b|M-v  |
+-----------+-----+------+-----+

Those are the most used motions.  The gist is, Emacs requires you to hold Control or Meta, while vi(m) doesn't.  (Although Emacs page scrolling is downright atrocious.  Release Control, press and hold Meta, press v if you scrolled one page too far?  Yuck.)  My joints and I prefer the former, but it does help a lot if you do go with Emacs's bindings, to remap Caps Lock to Control.

I have to say, if those are the most used, then no, there's no real difference. when you start wanting to go to the end of the third word from here, that's where Vim bindings start to shine. I am happily using Emacs with evil-mode, though. I can't stand the slow chording, and I can't stand Vimscript. :-)

Offline

#17 2013-10-23 00:33:30

spupy
Member
Registered: 2009-08-12
Posts: 218

Re: Vim mode in Emacs (no editor war)

jakobcreutzfeldt wrote:

I made the Vim-to-Emacs switch in the last year. I started out by trying one of the Vi-like modes (can't remember which...Viper I think) but I eventually just scrapped that and dove in head first. The thing is that a) Emacs has a few metric shit-tons of features that you can learn and b) it nearly maxes out the possible keybindings. I found that the Vi mode, while it helped me in text editing, prevented me from really learning the rest of the system. Once I got rid of that crutch, I found that learning Emacs went much more smoothly.

Really, Vim and Emacs are fairly equivalent in their basic text editing capabilities, as far as motions, deletion/insertion, macros, etc. go. So, it's just a matter of learning the different keys in each editor. If you are super efficient in Vim, you can almost certainly (to the level of your motivation) reach equivalent efficiency in Emacs.

My advice would be to just try to learn pure Emacs. Print out the reference card (in /usr/share/emacs/$VERSION/etc) and keep it by your desk. Within a week you'll have the basic motion and editing commands internalized, which really is no worse than the week it took to be fully comfortable with the modes and motion of Vim.

Good luck!


The reason I haven't switched to Emacs is exactly because of the keybindings - I'm too scared for my pinky! The vim-mode plugins for Emacs look like the only solution for my case (apart from "not switching to Emacs").


There are two types of people in this world - those who can count to 10 by using their fingers, and those who can count to 1023.

Offline

Board footer

Powered by FluxBB