Closed mattharrison closed 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.
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.
If we achieve this I wonder how I can brand spacemacs......... :-]]]]]]
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 :)
This would be awesomely silly, Emacs becoming the guest of Evil behing the guest of Emacs.... feel dizzy.
@tuhdo and with key bindings consistency ! My mind is blown, I really hope spacemacs will be able to handle this request.
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.
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
.
Maybe playing on the space/ground side is better suited to spacemacs. xxxemacs with something opposite to space.
I like ground-control. :-)
Church could be cool as well. If you want the emacs way then install the church ahah
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.
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.
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.
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
.
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...
The plan is:
insert state
by emacs state
(defalias
of evil-emacs-state
to emacs-insert-state
)normal state
to emacs state
ESC
in emacs state
goes to normal state
C-c
)evil-normal-state-modes
and evil-motion-state-modes
and transfert all the modes regitered in those lists to evil-emacs-state-modes
(so all modes will use the emacs state
by default)evilify
macroAnd 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 !
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.
@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:
develop
branchM-x dotspacemacs/install
~/.spacemacs
and change 'vim
in this line to 'emacs
and restart spacemacsemacs state
which is plain emacs but C-c
(can be changed in the dotfile) corresponds to the leader, so every time you see SPC
in the spacemacs documentation you can replace it by C-c
. Also every time you see SPC m
in the documentation you can replace it by C-,
(can be changed in the dotfile). If you want to practice vim
the normal state
is still available when you press escape
in emacs state
(the cursor will change color to orange by default). To return to emacs state
press i
(insert).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.
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.
Good job! I'm testing and really enjoy it. It can really compete with Prelude.
@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.
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.
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-
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)
I love this!! :D You guys are awesome.
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.
@EDmitry you use your own private layer and incorporate your customization to it. It's much easier than the other way around.
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.