Top Related Projects
An Emacs framework for the stubborn martian hacker
A community-driven Emacs distribution - The best editor is neither Emacs nor Vim, it's Emacs *and* Vim!
An Emacs configuration bundle with batteries included
Prelude is an enhanced Emacs 25.1+ distribution that should make your experience with Emacs both more pleasant and more powerful.
An Emacs framework for the stubborn martian hacker
Quick Overview
Evil is an extensible vi layer for Emacs. It emulates the main features of Vim, providing a modal editing experience within Emacs, while also allowing users to leverage Emacs' powerful extensibility and ecosystem.
Pros
- Brings Vim's efficient editing model to Emacs
- Highly customizable and extensible
- Integrates well with existing Emacs packages
- Large and active community for support and development
Cons
- Learning curve for Emacs users not familiar with Vim
- Potential conflicts with some Emacs keybindings
- May require additional configuration for optimal use
- Some Vim plugins or features may not be fully supported
Code Examples
- Basic Evil mode activation:
(require 'evil)
(evil-mode 1)
This code enables Evil mode globally in Emacs.
- Customizing Evil key bindings:
(evil-define-key 'normal 'global
(kbd "C-s") 'save-buffer
(kbd "C-f") 'find-file)
This example remaps Ctrl+S to save the buffer and Ctrl+F to find a file in normal mode.
- Creating a custom Evil operator:
(evil-define-operator evil-upcase (beg end type)
"Convert text to uppercase."
:move-point nil
:repeat nil
(upcase-region beg end))
(define-key evil-normal-state-map "gu" 'evil-upcase)
This code defines a new Evil operator that converts text to uppercase and binds it to "gu" in normal mode.
Getting Started
To get started with Evil, follow these steps:
-
Install Evil via MELPA or manually:
(require 'package) (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/")) (package-initialize) (package-install 'evil)
-
Add the following to your Emacs configuration file:
(require 'evil) (evil-mode 1)
-
Restart Emacs or evaluate the configuration.
-
Start using Vim keybindings in Emacs! Use
:q
to quit,i
to enter insert mode, andEsc
to return to normal mode.
Competitor Comparisons
An Emacs framework for the stubborn martian hacker
Pros of Doomemacs
- Comprehensive configuration framework with curated packages and optimizations
- Faster startup time and improved performance out of the box
- Modular design allowing easy customization and extension
Cons of Doomemacs
- Steeper learning curve for users new to Emacs or custom configurations
- Potential conflicts with existing Emacs setups or personal configurations
- Larger codebase and more complex structure compared to Evil
Code Comparison
Evil (Vim emulation layer):
(require 'evil)
(evil-mode 1)
(evil-set-initial-state 'mode 'state)
Doomemacs (Configuration example):
(doom! :input
:completion
:ui
:editor
(evil +everywhere)
:emacs
:term
:tools
:lang
:config
literate)
Evil focuses solely on providing Vim-like editing capabilities, while Doomemacs offers a complete Emacs distribution with Evil integration and many additional features. Evil is more lightweight and easier to integrate into existing Emacs setups, whereas Doomemacs provides a pre-configured environment with optimized performance and a curated selection of packages.
A community-driven Emacs distribution - The best editor is neither Emacs nor Vim, it's Emacs *and* Vim!
Pros of Spacemacs
- Comprehensive configuration: Spacemacs provides a pre-configured Emacs setup with many popular packages and sensible defaults
- Mnemonic keybindings: Uses a consistent, easy-to-remember keybinding system based on mnemonic prefixes
- Modular architecture: Allows for easy customization and extension through "layers"
Cons of Spacemacs
- Steep learning curve: The extensive features and customizations can be overwhelming for new users
- Slower startup time: Due to its large codebase and many included packages
- Potential conflicts: May clash with existing Emacs configurations or preferences
Code Comparison
Evil (minimal configuration):
(require 'evil)
(evil-mode 1)
Spacemacs (example layer configuration):
(setq-default dotspacemacs-configuration-layers
'(
(auto-completion :variables
auto-completion-return-key-behavior 'complete
auto-completion-tab-key-behavior 'cycle)
better-defaults
emacs-lisp
git
markdown
org
(shell :variables shell-default-height 30 shell-default-position 'bottom)
spell-checking
syntax-checking
version-control
))
Evil focuses solely on providing Vim emulation within Emacs, while Spacemacs offers a complete Emacs distribution with Evil mode integrated, along with many other features and optimizations.
An Emacs configuration bundle with batteries included
Pros of emacs.d
- Comprehensive Emacs configuration with a wide range of features and packages
- Regular updates and maintenance by an experienced Emacs user
- Includes configurations for multiple programming languages and development tools
Cons of emacs.d
- Steeper learning curve due to its extensive customizations
- May conflict with existing user configurations or preferences
- Potentially slower startup time due to the large number of packages
Code Comparison
emacs.d:
(require-package 'projectile)
(add-hook 'after-init-hook 'projectile-mode)
(setq-default projectile-mode-line-prefix " Proj")
(setq projectile-sort-order 'recently-active)
evil:
(require 'evil)
(evil-mode 1)
(evil-set-initial-state 'term-mode 'emacs)
(evil-set-initial-state 'calculator-mode 'emacs)
Summary
emacs.d is a comprehensive Emacs configuration that provides a wide range of features and packages for various programming languages and development tools. It offers regular updates and maintenance but may have a steeper learning curve and potential conflicts with existing configurations.
Evil, on the other hand, is focused on providing Vim-like editing capabilities within Emacs. It's more specialized and may be easier to integrate into existing Emacs setups without significant conflicts.
The choice between the two depends on whether you prefer a full-featured Emacs configuration (emacs.d) or want to add Vim-like editing to your existing Emacs setup (Evil).
Prelude is an enhanced Emacs 25.1+ distribution that should make your experience with Emacs both more pleasant and more powerful.
Pros of Prelude
- Comprehensive Emacs configuration framework, offering a complete out-of-the-box setup
- Includes a curated set of popular packages and sensible defaults for enhanced productivity
- Modular design allows for easy customization and extension
Cons of Prelude
- Steeper learning curve for users accustomed to traditional Emacs configurations
- May include unnecessary features or packages for some users' workflows
- Potential conflicts with existing user configurations or preferences
Code Comparison
Evil (Vim emulation):
(require 'evil)
(evil-mode 1)
(evil-set-initial-state 'term-mode 'emacs)
Prelude (Enhanced default configuration):
(require 'prelude-core)
(require 'prelude-editor)
(require 'prelude-global-keybindings)
Summary
Evil focuses on bringing Vim-like editing capabilities to Emacs, while Prelude provides a comprehensive Emacs configuration framework. Evil is ideal for Vim users transitioning to Emacs or those who prefer Vim keybindings. Prelude, on the other hand, offers a more opinionated and feature-rich setup for Emacs, catering to users who want a pre-configured environment with modern defaults and popular packages included.
An Emacs framework for the stubborn martian hacker
Pros of Doomemacs
- Comprehensive configuration framework with curated packages and optimizations
- Faster startup time and improved performance out of the box
- Modular design allowing easy customization and extension
Cons of Doomemacs
- Steeper learning curve for users new to Emacs or custom configurations
- Potential conflicts with existing Emacs setups or personal configurations
- Larger codebase and more complex structure compared to Evil
Code Comparison
Evil (Vim emulation layer):
(require 'evil)
(evil-mode 1)
(evil-set-initial-state 'mode 'state)
Doomemacs (Configuration example):
(doom! :input
:completion
:ui
:editor
(evil +everywhere)
:emacs
:term
:tools
:lang
:config
literate)
Evil focuses solely on providing Vim-like editing capabilities, while Doomemacs offers a complete Emacs distribution with Evil integration and many additional features. Evil is more lightweight and easier to integrate into existing Emacs setups, whereas Doomemacs provides a pre-configured environment with optimized performance and a curated selection of packages.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
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.
Installation
See the official documentation for installation instructions. We recommend using package.el.
As a quickstart, you can add the following code to your Emacs init file.
;; Set up package.el to work with MELPA
(require 'package)
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/"))
(package-initialize)
(package-refresh-contents)
;; Download Evil
(unless (package-installed-p 'evil)
(package-install 'evil))
;; Enable Evil
(require 'evil)
(evil-mode 1)
Dependencies
-
Evil requires Emacs 24.1 or later.
-
Evil requires any of the following for
C-r
: -
For the motions
g;
g,
and for the last-change-register.
, Evil requires the goto-chg.el package (available via MELPA and NonGNU ELPA), which provides the functionsgoto-last-change
andgoto-last-change-reverse
. -
For Emacs 24.1 and 24.2 Evil also requires cl-lib.
Documentation
The latest version of the documentation is readable online here. It is also available as PDF and as EPUB.
Mailing list
Evil is discussed at the gmane.emacs.vim-emulation mailing list.
IRC
Visit us on irc.libera.chat #evil-mode
.
Contribution
See CONTRIBUTING.md for guidelines for issues and pull requests.
Top Related Projects
An Emacs framework for the stubborn martian hacker
A community-driven Emacs distribution - The best editor is neither Emacs nor Vim, it's Emacs *and* Vim!
An Emacs configuration bundle with batteries included
Prelude is an enhanced Emacs 25.1+ distribution that should make your experience with Emacs both more pleasant and more powerful.
An Emacs framework for the stubborn martian hacker
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot