This holy module brings the vim experience to Emacs.
+everywhere Enables evilified keybinds everywhere possible. Uses the
evil-collection plugin as a foundation.+evil-want-o/O-to-continue-comments to nil).* and # will search for the current selection instead of
the word-at-point.:g[lobal] ex command has been modified to highlight matches.:p,
:p:h or :t) than vanilla evil-mode offers.:P, which expands to the
project root (throws an error if not in a project).This module has no external prerequisites.
The following vim plugins have been ported to evil:
| Vim Plugin | Emacs Plugin | Keybind(s) |
|---|---|---|
| vim-commentary | evil-nerd-commenter | omap gc
|
| vim-easymotion | evil-easymotion | omap gs
|
| vim-lion | evil-lion | omap gl / gL
|
| vim-seek or vim-sneak | evil-snipe | mmap s / S, omap z / Z & x / X
|
| vim-surround | evil-embrace and evil-surround | vmap S, omap ys
|
| vim-unimpaired | (provided by Doom) | see the list |
This module has also ported vim-unimpaired keybinds to Emacs.
In other modules:
NERDTree equivalent.This module provides a couple extra text objects, along with the built-in ones. For posterity, here are the built-in ones:
w W wordss sentencesp paragraphsb parenthesized blocksb ( ) { } [ ] < > braces, parentheses and bracketst tagso symbolsAnd these are text objects added by this module:
a C-style function arguments (provided by evil-args)B any block delimited by braces, parentheses or brackets (provided by
evil-textobj-anyblock)c Commentsf For functions (but relies on the major mode to have sane definitions for
beginning-of-defun-function and end-of-defun-function)g The entire bufferi j k by indentation (k includes one line above; j includes one line
above and below) (provided by evil-indent-plus)q For quotes (any kind)u For URLsx XML attributes (provided by exato)| Ex Command | Description |
|---|---|
:@ |
Apply macro on selected lines |
:al[ign][!] REGEXP |
Align text to the first match of REGEXP. If BANG, align all matches on each line |
:cp[!] NEWPATH |
Copy the current file to NEWPATH |
:dash QUERY |
Look up QUERY (or the symbol at point) in dash docsets |
:dehtml [INPUT] |
HTML decode selected text / inserts result if INPUT is given |
:enhtml [INPUT] |
HTML encode selected text / inserts result if INPUT is given |
:iedit REGEXP |
Invoke iedit on all matches for REGEXP |
:k[ill]all[!] |
Kill all buffers (if BANG, affect buffer across workspaces) |
:k[ill]b |
Kill all buried buffers |
:k[ill]m[!] REGEXP |
Kill buffers whose name matches REGEXP (if BANG, affect buffers across workspaces) |
:k[ill]o |
Kill all other buffers besides the selected one |
:k[ill] |
Kill the current buffer |
:lo[okup] QUERY |
Look up QUERY on an online search engine |
:mc REGEXP |
Invoke multiple cursors on all matches for REGEXP |
:mv[!] NEWPATH |
Move the current file to NEWPATH |
:na[rrow] |
Narrow the buffer to the selection |
:pad |
Open a scratch pad for running code quickly |
:ral[ign][!] REGEXP |
Right-Align text that matches REGEXP. If BANG, align all matches on each line |
:repl |
Open a REPL and/or copy the current selection to it |
:retab |
Convert indentation to the default within the selection |
:rev[erse] |
Reverse the selected lines |
:rm[!] [PATH] |
Delete the current buffer’s file and buffer |
:tcd[!] |
Send cd X to tmux. X = the project root if BANG, X = default-directory otherwise |
You must do two things to remove Evil:
:editor evil from ~/.doom.d/init.el,doom sync to clean up lingering dependencies and regenerate your
autoloads files.doom-leader-alt-key and
doom-localleader-alt-key. These are bound to C-c and C-c l by default.Ignore
doom-leader-keyanddoom-localleader-key, they don’t apply to non-evil sessions.
Evil-specific configuration and keybindings (defined with map!) will be
ignored without :editor evil present (and omitted when byte-compiling).
Keep in mind that, at the time of this writing, Doom was designed by a vimmer, for vimmers. Little consideration has been put into designing a keybind scheme for vanilla Emacs users (though it’s being worked on!).
That means that much of Doom’s functionality will be orphaned in an evil-less setup. You’ll have to set your own keybinds.
I suggest studying config/default/+emacs-bindings.el to see what keybinds are available for non-evil users. Otherwise, you may find inspiration on the example Doom configurations page.
Doom replaces the s and S keys with the evil-snipe package (a port of
vim-seek/vim-sneak for 2-character versions of f/F/t/T).
To disable evil-snipe on s/S, you can either:
evil-snipe-mode by adding (remove-hook 'doom-first-input-hook
#'evil-snipe-mode) to $DOOMDIR/config.el,evil-snipe completely with (package! evil-snipe :disable t)
added to $DOOMDIR/packages.el, but this will also disable incremental
highlighting for the f/F/t/T motions keys.cl and cc, respectively; they do the same thing.Doom changes the behavior of the Y key in normal mode to yank-to-EOL
(equivalent to y$). This was to make it consistent with the C and D
capital operators, and because it was redundant with yy, which is easier to
type than y$.
If you prefer the old behavior, it can be reversed with:
;; add to ~/.doom.d/config.el
(setq! evil-want-Y-yank-to-eol nil)
Vim (and evil) move the cursor one character back when exiting insert mode. If you prefer that it didn’t, set:
;; add to ~/.doom.d/config.el
(setq evil-move-cursor-back nil)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。