The extensible vi layer for Emacs.
Emacs Lisp Other
Clone or download
wasamasa Merge pull request #1050 from mssdvd/patch-1
Emacs's games work better in Emacs state
Latest commit 230b872 May 17, 2018
Permalink
Failed to load latest commit information.
.github Directly link to bug report link Dec 15, 2017
doc update repository information in docs and scripts directories Feb 9, 2017
lib Update bundled libraries to latest stable version Sep 19, 2017
scripts Require cl-lib instead of cl Feb 15, 2017
.dir-locals.el Add a dir-locals file Sep 4, 2017
.gitattributes Initial commit Mar 1, 2011
.gitignore Ignore Info compilation files Feb 9, 2012
.travis.yml Remove unneeded builds Dec 25, 2017
CHANGES.org Ensure `evil-save-state` resets the original buffer when finished (fix Aug 2, 2013
CONTRIBUTING.md Reword package loading notes May 10, 2017
COPYING Add GPL 3 license information to all source files Jul 30, 2012
Cask update version to 1.2.13 Oct 2, 2017
Makefile Tweak .depend file generation to support conditional require Dec 11, 2017
README.md also add melpa stable channel badge Nov 23, 2017
evil-command-window.el update version to 1.2.13 Oct 2, 2017
evil-commands.el :global should take into account evil-ex-search-case Mar 4, 2018
evil-common.el Better protect against modes that disable undo Apr 13, 2018
evil-core.el Use local-variable-p instead of assq Apr 8, 2018
evil-development.el Add evil-development.el to hold extras for evil developers Dec 14, 2017
evil-digraphs.el update version to 1.2.13 Oct 2, 2017
evil-ex.el evil-ex-global: parse COMMAND only once, not on each matching line Feb 21, 2018
evil-integration.el Evil window selection should trigger ElDoc. Apr 22, 2018
evil-jumps.el Fix evil-set-jump called with an argument Apr 28, 2018
evil-macros.el update version to 1.2.13 Oct 2, 2017
evil-maps.el Add mapping gx to open an url at point Feb 21, 2018
evil-pkg.el update version to 1.2.13 Oct 2, 2017
evil-repeat.el update version to 1.2.13 Oct 2, 2017
evil-search.el update version to 1.2.13 Oct 2, 2017
evil-states.el Ensure buffer is alive in `evil-visual-update-x-selection` Jan 22, 2018
evil-test-helpers.el Remove evil-temp-filename Jan 9, 2018
evil-tests.el :global should take into account evil-ex-search-case Mar 4, 2018
evil-types.el update version to 1.2.13 Oct 2, 2017
evil-vars.el Emacs's games work better in Emacs state May 13, 2018
evil.el Tweak .depend file generation to support conditional require Dec 11, 2017

README.md

An extensible vi layer for Emacs

Build Status MELPA MELPA Stable License: GPL v3

Evil is an extensible vi layer for Emacs. It emulates the main features of Vim, and provides facilities for writing custom extensions. Also see our page on EmacsWiki.

Download

Evil lives in a git repository. To download Evil, do

git clone https://github.com/emacs-evil/evil ~/.emacs.d/evil

Install

After the download step, add the following lines to ~/.emacs:

(add-to-list 'load-path "~/.emacs.d/evil")
(require 'evil)
(evil-mode 1)

Dependencies

  • Evil requires undo-tree.el in the load-path for linear undo and undo branches.

  • For the motions g; g, and for the last-change-register ., Evil requires the goto-chg.el package, which provides the functions goto-last-change and goto-last-change-reverse.

Documentation

A brief PDF manual is available.

Mailing list

Evil is discussed at the gmane.emacs.vim-emulation mailing list.

IRC

Visit us on irc.freenode.net #evil-mode.

Contribution

See CONTRIBUTING.md for guidelines for issues and pull requests.

FAQ

Problems with the Escape key in terminal mode

A common problem when using Evil in terminal mode is a certain delay after pressing the Escape key. Even more, when pressing the Escape key followed quickly by another key the command is recognized as M- instead of two separate command ESC followed by . In fact, it is perfectly valid to simulate M- by pressing ESC quickly (but see below).

The reason for this is that in terminal mode a key sequence involving the Meta-key (or Alt-key) always generates a so called "escape sequence", i.e., a sequence of two events sent to Emacs, the first being ESC the second the key pressed simultaneously. The problem is that pressing the Escape-key itself also generates the ESC event. Thus, if Emacs (and therefore Evil) receives an ESC event there is no way to tell whether the Escape key has been pressed (and no further event will arrive) or a M- combination has been pressed (and the event will arrive soon). In order to distinguish both situations Evil does the following. After receiving an ESC event Evil waits for a short time period (specified by the variable evil-esc-delay which defaults to 0.01 seconds) for another event. If no other event arrives Evil assumes that the plain Escape key has been pressed, otherwise it assumes a M- combination has been pressed and combines the ESC event with the second one. Because a M- sequence usually generates both events in very quick succession, 0.01 seconds are usually enough and the delay is hardly noticeable by the user.

But if you use a terminal multiplexer like tmux or screen the situation may be worse. Those multiplexers have exactly the same problem recognizing M- sequences and often introduce their own delay for the ESC key. There is no way for evil to influence this delay. In order to reduce it you must reconfigure your terminal multiplexer.

Note that this problem should not arise when using Evil in X mode. The reason is that in this case the Escape key itself generates a different command, namely 'escape (a symbol) and hence Evil can distinguish whether the Escape key or a M- combination has been pressed. But this also implies that pressing ESC followed by cannot be used to simulate M- in X mode!

Underscore "_" is not a word character

An underscore "_" is a word character in Vim. This means that word-motions like w skip over underlines in a sequence of letters as if it was a letter itself. In contrast, in Evil the underscore is often a non-word character like operators, e.g. +.

The reason is that Evil uses Emacs' definition of a word and this definition does often not include the underscore. In Emacs word characters are determined by the syntax-class of the buffer. The syntax-class usually depends on the major-mode of this buffer. This has the advantage that the definition of a "word" may be adapted to the particular type of document being edited. Evil uses Emacs' definition and does not simply use Vim's definition in order to be consistent with other Emacs functions. For example, word characters are exactly those characters that are matched by the regular expression character class [:word:].

If you want the underscore to be recognised as word character, you can modify its entry in the syntax-table:

(modify-syntax-entry ?_ "w")

This gives the underscore the word syntax-class. You can use a mode-hook to modify the syntax-table in all buffers of some mode, e.g.:

(add-hook 'c-mode-common-hook #'(lambda () (modify-syntax-entry ?_ "w")))

This gives the underscore the word syntax-class in all C-like buffers.