syl20bnr / spacemacs

A community-driven Emacs distribution - The best editor is neither Emacs nor Vim, it's Emacs *and* Vim!
http://spacemacs.org
GNU General Public License v3.0
23.69k stars 4.9k forks source link

Non-evil mode (for emacs users wanting to experience (almost) all that spacemacs offers) #868

Closed mattharrison closed 9 years ago

mattharrison commented 9 years ago

Spacemacs appeals to me on many levels. The integration and community are great.... For a VIM user there is a lot of appeal.

But I'm not particularly interested in evil/vim. (I have an ergonomic keyboard that allows me to use ctl on my thumb and am pretty proficient with emacs bindings. I actually tried spacemacs for a couple days, and I loved it but felt hampered by vi navigation)

There has been rumors on twitter that there could be a switch that would just start you up in emacs mode. I think this would go a long way toward attracting emacs users who are interested in the integration and modern feel that spacemacs provides.

syl20bnr commented 9 years ago

While I was hostile to this at first, I do see some value to support it now, for your use case, for pair programming etc... @trishume found the start of an non intrusive way to implement it which is awesome.

Basically it could be achievable with very few tweaks to make evil-emacs-state the default one (evil-emacs-state is plain emacs key-bindings), having the leader on a modifier key combination and remove the evil layers on top of buffers like dired, magit etc...

What is less trivial is to be able to dynamically switch between the 2 ways without restarting emacs but it would be a second step.

syl20bnr commented 9 years ago

Oh let's be clear, evil is a required dependency so it won't be disabled. But the good news (and often people does not know this) evil has an emacs state which is just plain emacs key bindings !

Evil is such a wonderful technology.

syl20bnr commented 9 years ago

If we achieve this I wonder how I can brand spacemacs......... :-]]]]]]

tuhdo commented 9 years ago

I agree with this proposal. It would give Emacs users (especially the new ones) a chance to experience many wonderful packages that they never know, with minimal effort and see what Emacs is capable of. And possibly some of them might switch to Evil :)

syl20bnr commented 9 years ago

This would be awesomely silly, Emacs becoming the guest of Evil behing the guest of Emacs.... feel dizzy.

syl20bnr commented 9 years ago

@tuhdo and with key bindings consistency ! My mind is blown, I really hope spacemacs will be able to handle this request.

trishume commented 9 years ago

It really shouldn't be that difficult. My biggest implementation debate is actually wether the layer should have a clever pun name or a clear name that describes it accurately, or some mix. I just have too many good ideas for puns, but it might make the functionality hard to find.

Layer Name Ideas

syl20bnr commented 9 years ago

ahah I've been thinking about this since this morning. I had essentially two:

I would love a pun with an holy semantic. God layer could be cool but there is the god-mode unfortunately and it will be tedious to explain that the God layer is not the god-mode.

syl20bnr commented 9 years ago

Maybe playing on the space/ground side is better suited to spacemacs. xxxemacs with something opposite to space.

syl20bnr commented 9 years ago

I like ground-control. :-)

syl20bnr commented 9 years ago

Church could be cool as well. If you want the emacs way then install the church ahah

tuhdo commented 9 years ago

I think the easiest way to do this is to rebind all the Evil key bindings to Emacs convention. I already experimented with this in my private layer. The setup-evil-emacs.el is still in progress while setup-evil.el is my ergomeacs key bindings that replace Vim ones and is more complete. This way, Emacs users can get both modal editing and, more importantly, text objects. We can simplify Evil Emacs layout because Emacs users don't need extra word movemenet such as word or WORD or end or begin. Just use the plain old forward-word and backward-word and they will be happier. A benefit of Emacs layout is that we don't have to remap i,j,k,l... in other Emacs programs like Dired or Magit and skip it entirely.

syl20bnr commented 9 years ago

I'm not for a remap of the evil states. We can just replace the default state of evil from normal to emacs state then pressing esc in emacs state goes to normal, pressing i in normal mode goes to emacs state.

tuhdo commented 9 years ago

That could work but what if an Emacs users want to use modal editing? Isn't remapping Evil better than introduce God-mode that does the same thing?

And when Emacs layer is activated, it should skip all the bindings in other modes that are used for adapting Vim convention.

syl20bnr commented 9 years ago

He presses esc and then he is in normal state. This is the perfect setup to learn Vim key bindings. It reduces to say: we replace insert state by emacs state and make it the default one (i.e. instead of being in normal state by default, the user is in emacs state).

For the other modes it is as easy as adding the modes to the list evil-emacs-state-modes.

trishume commented 9 years ago

I like the idea of just binding it so that when you press C-c (or some other combo) in any mode (or just emacs mode) it does the same thing as pressing SPC in normal mode and allows you to enter standard Spacemacs combos and can open guide-key.

This way emacs bindings users have the choice of either using the default bindings bound by the packages or the namespaced Spacemacs bindings, just prefixed by a chord instead of a modal single key.

@mattharrison I also use an ergonomic keyboard with a very convenient control key. I guess I just use vim bindings as a legacy and because I like the language-ness. Once I get faster at Velotype I'll switch to a non-modal system based on single-chord actions that aren't english words and are thus unambiguous without modes. Some day...

syl20bnr commented 9 years ago

The plan is:

And we should be done. The perfect setup combining emacs as a default instead of insert, normal state is still accessible but not default, all the consistent spacemacs keyindings on C-c with key sequences (works like god-mode out of the box). I find this setup pretty exciting !

kendall commented 9 years ago

Then it should be called major-tom.

On Wednesday, March 18, 2015, Sylvain Benner notifications@github.com wrote:

I like ground-control. :-)

— Reply to this email directly or view it on GitHub https://github.com/syl20bnr/spacemacs/issues/868#issuecomment-83120985.

syl20bnr commented 9 years ago

@kendall major-tom is in the evil flagship !

@mattharrison I pushed a first working version of the holy-mode. It is ready for you to try when you'll have some time, here is the procedure:

Enjoy and thank you for testing !

Note: Almost everything is implemented. The last thing to do is to remove the evilified buffers (magit, paradox and some others) which have a few key bindings remapped to fit the vim paradigm. I'll take care of them later.

mattharrison commented 9 years ago

Wow thanks (love the bikeshedding over the name here :) ).

I have it installed and will try and live in it for a bit and see what happens.

tuhdo commented 9 years ago

Good job! I'm testing and really enjoy it. It can really compete with Prelude.

syl20bnr commented 9 years ago

@tuhdo that's awesome if you like it !

@mattharrison @travisbhartwell @tuhdo I just pushed in develop a missing configuration for C-,

Tonight I'll take care of the remaining keys overwritten in ido, helm and the evilified buffers. And we should have a pretty solid emacs way in spacemacs.

tuhdo commented 9 years ago

Currently Emacs starts with Vim key bindings as default and it would make it hard for an Emacs user to change layout in .spacemacs. Probably when Spacemacs starts for the first time it should ask user to choose between Evil or Emacs key bindings and set appropriately.

syl20bnr commented 9 years ago

Indeed, if there is no .spacemacs we can ask the user for her prefered style then we could directly install the dotfile with the proper setting.

Le jeudi 19 mars 2015, Tu Do notifications@github.com a écrit :

Currently Emacs starts with Vim key bindings as default and it would make it hard for an Emacs user to change layout in .spacemacs. Probably when Spacemacs starts for the first time it should ask user to choose between Evil or Emacs key bindings and set appropriately.

— Reply to this email directly or view it on GitHub https://github.com/syl20bnr/spacemacs/issues/868#issuecomment-83606918.

-syl20bnr-

mattharrison commented 9 years ago

Seems to work pretty well. Ran into an issue in a sql buffer where I went into evil mode (not sure how). Also, navigating around in a ipython buffer appeared to trip up emacs and pegged the cpu of the emacs process. Had to force kill emacs (reporting here because I'm not sure of the stability of this code, and hence don't want to create new bugs for these issues)

CestDiego commented 9 years ago

I love this!! :D You guys are awesome.

EDmitry commented 9 years ago

I have a similar idea — how about making it possible to incorporate all the "tool" packages (like configuration layers) separately from spacemacs? I am an evil user and I already have a pretty customized emacs configuration but at the same time I like a lot of layering ideas from spacemacs that I would love to incorporate to simplify my configuration.

tuhdo commented 9 years ago

@EDmitry you use your own private layer and incorporate your customization to it. It's much easier than the other way around.