15

I am considering in giving Evil Mode a chance. I have searched extensively to find how do you use it and everyone is just sharing their customizations.

What I can't understand is when you install and activate Evil Mode does automatically use the keys of Vim or you have to customize them to your needs? To put it another way when I activate it should I change anything or everything will work?

One more thing. In Emacs when you install packages you should use specific keys for some tasks. For example in AUCTeX you use C-c C-c to compile so in Evil Mode what keys do you use for the packages? You have to customize them for every package?

6
  • 1
    Please actually try it before asking. The wiki and the homepage both give simple instructions on how to install and enable evil. Using it immediately answers your first set of questions, while the manual provides more information about customizing key bindings.
    – Dan
    May 6, 2015 at 13:32
  • 1
    @Dan I don't have any issue with installation and activation as I have said. I have already installed Evil Mode and is working. My concerns are regarding the usage of it and the mapping of the keys in new packages. The manual provides information in case you want to change some key bindings it doesn't mention anything regarding my questions. The manual and the wiki were the first sources I read and the wiki was the source I followed to set up my installation.
    – Adam
    May 6, 2015 at 14:27
  • 1
    Can the one that downvoted tell me why he did that? The question is specific and not vague and furthermore I have done great research before posting so I know that what I am asking can't be found just by googling for it. Also I explain with detail what I am asking. I can't possibly see what is wrong with that question.
    – Adam
    May 6, 2015 at 14:54
  • 1
    I downvoted for the reasons listed above. Enabling evil and working with it for a few moments is enough to show that it uses the Vim bindings by default. Moreover, it's difficult to imagine someone going to the trouble of writing a Vim emulation layer but not providing the default Vim keybindings.
    – Dan
    May 6, 2015 at 14:58
  • 1
    @Dan that is what I am saying I am trying to work with it for a long time. I couldn't possible know if there are all the necessary key bindings or just the basic ones. Also in every post and especially in posts in StackOverflow people are consistently asking about Evil Mode practices and how to map keys which I found very odd and made me think that it may need customization. I am not a good Vim user so I can't know if there are special cases that I should customize. Having tried extensively this mode myself I don't know what else I could try and especially what is wrong with my question...
    – Adam
    May 6, 2015 at 15:07

1 Answer 1

18

Evil is basically a global minor mode that enables a few extra keymaps on top of Emacs and comes with the respective editing commands you'd use in them. It is intentionally built to reuse as much existing Emacs Lisp code as possible for better interoperability and less wasted effort, you'll for instance find out that window movement was lifted from windmove.el.

Upon activating evil-mode it is enabled for all buffers and an initial state (Vim calls them modes, but modes already mean something different in Emacs, so Evil calls them states) is picked. That state is just a keymap, so commands bound in that keymap will just work, any other keys will be passed through to the next keymap in charge. The Evil devs did poke a few holes on purpose in these, like for C-g, C-x and C-c (keybinds using the meta key will just work since Vim doesn't use it at all).

This essentially means that using gg in normal state will do the right thing. It also means that using C-c C-c will call the respective Emacs command. In case you find an useful command to be obscured, you can switch into Emacs state with C-z (and switch back into the previous one by hitting it again), then later customize Evil to use a different initial state for the mode in question or change its keymaps directly. If Emacs state is picked for a buffer where you'd prefer having at least Vim-style movement, you can use motion state and have them. The amount of customization remains as small as you'd like it to be.

Have a look at my config to get an idea how more elaborate configuration could look like.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.