44
votes
How to treat underscore as part of the word?
The following snippet will make Evil treat an Emacs symbol as a word.
(with-eval-after-load 'evil
(defalias #'forward-evil-word #'forward-evil-symbol)
;; make evil-search-word look for symbol ...
- 1,039
40
votes
Accepted
How to treat underscore as part of the word?
The simplest workaround: use ciW to select a whitespace-delimited word.
The bigger issue has to do with the value of the _ character in the syntax table. The issue is that _ is, by default, a symbol ...
Dan♦
- 32.1k
30
votes
Accepted
evil-mode visual selection copies text to clipboard automatically
There is no bug here. Since I was also annoyed with this behavior, I just read Evil code to find out why this is happening. So, here is a straight copy/paste of the well-commented one-liner from my ...
- 1,105
22
votes
Accepted
Differences between evil-normal-state-map and evil-motion-state-map
Motion state is an Evil-specific thing, intended for modes where you don't edit text, but still want Vim-style movement available, with all other keys of that mode passing through. Help buffers are ...
- 21.5k
18
votes
Accepted
Instructions on how to work with Evil Mode
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 ...
- 21.5k
17
votes
Accepted
Evil cursor change by state
The variable cursor-type controls how the appearance of the cursor, defaulting to t, which uses the cursor specified for the frame (see the docstring for options). If you'd like the cursor to default ...
Dan♦
- 32.1k
16
votes
How to treat underscore as part of the word?
The spacemacs FAQ offers the following language-specific solution:
;; For python
(add-hook 'python-mode-hook #'(lambda () (modify-syntax-entry ?_ "w")))
;; For ruby
(add-hook 'ruby-mode-hook #'(...
- 269
16
votes
Accepted
How do I turn off Spacemacs’s tildes on empty lines?
Toggle
You can toggle it off with (spacemacs/toggle-vi-tilde-fringe-off), you can get the list of all toggles in helm-spacemacs accessible via SPC f e h or SPC h SPC in more recent versions. Every ...
- 2,085
15
votes
Accepted
How to remap : to ; in Evil Mode
First of all, in Emacs one thinks in keymaps and commands, not so much keys in their (original) context. Your first step would be figuring out how the commands are named in Evil's normal and visual ...
- 21.5k
15
votes
Strange behaviour on evil-delete
I noticed the d key deleting a line on a single press as well. I am using Spacemacs v0.300.0@26.1 on the develop branch. I do not know if this is your case, but I had an incomplete search in progress.
...
- 151
15
votes
Accepted
DOOM Emacs: Error running hook "global-git-commit-mode" because: (void-variable transient-base-map)
It seems that some magit dependencies break with Emacs 28, as the function defvar-keymap is only added in Emacs 29. The solution is to pin an older version of the packages, as Doom currently does not ...
- 176
14
votes
Accepted
How to unhighlight after searching in evil mode?
You can achieve the same as entering :noh with the command evil-ex-nohighlight.
But since you are using spacemacs, it can be even simpler: hit SPC s c to clear highlights.
- 1,482
13
votes
Accepted
How do I set up key bindings for modes in a specific Evil state?
Evil has the evil-define-key macro for defining commands for certain states in a specific keymap only:
(evil-define-key 'insert emacs-lisp-mode-map (kbd "C-c C-c") 'butterfly
...
- 21.5k
13
votes
Accepted
How can I disable evil in help-mode?
The reason this fails is because help-mode is in evil-motion-state-modes by default, adding it to evil-emacs-state-modes will therefore not have the desired effect as Evil looks it up in evil-motion-...
- 21.5k
12
votes
Accepted
Default Magit commit state in Evil
Here's a workaround:
(add-hook 'with-editor-mode-hook 'evil-insert-state)
I'm not sure why the initial state system was chosen as it either means you have a huge whitelist of states or do lookup of ...
- 21.5k
12
votes
How to quit evil mode?
You should also be able to C-z to enter normal emacs mode, and then another C-z to go back to evil.
- 1,475
12
votes
Have Ctrl-a increase a number just like in vim
The package evil-numbers does exactly what you need.
12
votes
Accepted
Fold all methods in a Python class with Evil
It's not documented well enough, and possibly poorly named, but the hideshow function hs-hide-level will collapse all the blocks within the current block. That is, if your cursor is on the class ... ...
- 2,731
11
votes
Accepted
Disable evil-mode when git-timemachine mode is activated
This answer is directly from the EVIL developer Frank Fischer,
I tested on Emacs24.4 with latest evil1.0.9+. Most evil key bindings still works, but we let git-timemachine's hotkeys take priority.
;;...
- 4,761
11
votes
Accepted
How do I jump out of enclosing parentheses?
In smartparens-mode, the function sp-up-sexp will move you out of a set of parentheses (bind to your key of choice):
Move forward out of one level of parentheses.
...
Examples:
(foo |...
Dan♦
- 32.1k
11
votes
Accepted
hybrid line number mode in emacs?
You can make the current line number show instead of "0" by customizing the linum-relative-current-symbol variable.
You can change that variable by one of multiple ways.
M-x customize-group RET ...
- 24.9k
11
votes
Accepted
Evil mode - How to go into Insert mode after Org-capture with %? cursor placement
Credits to awalker4 from reddit!
(add-hook 'org-capture-mode-hook 'evil-insert-state)
- 942
10
votes
Accepted
How can I add a new colon-command to Evil?
The official way of doing this is demonstrated in evil-maps.el.
Therefore, creating a new ex command is very simple:
(evil-ex-define-cmd "b[utterfly]" 'butterfly)
You'll want to either use this ...
- 21.5k
10
votes
Accepted
Difference between `evil-search-forward` and `evil-ex-search-forward`
evil has two search implementations, one is its own, the other one is a wrapper around emacs isearch. evil-search-forward wraps isearch-forward, evil-ex-search-forward invokes the internal search.
...
10
votes
In Evil mode, how can I prevent adding to the kill ring when I yank text, visual mode over other text, then paste over?
The suggestion in @gongqj's answer changes the behavior of paste so that cut text (via d) no longer gets pasted. This does not seem like what you want given your comment:
Ideally pasted over text ...
- 201
10
votes
Accepted
How to check the current state in evil mode?
The state can be accessed via evil-state, eg:
(cond
((eq evil-state 'visual) (do-something))
((eq evil-state 'normal) (do-other-thing))
((eq evil-state 'insert) (do-another-thing)))
- 7,999
10
votes
Accepted
How to do case sensitive searches using evil's evil-search?
What to do
You can customize the variable evil-ex-search-case to tell it
what you want evil to do when searching. Here's the docstring:
evil-ex-search-case is a variable defined in evil-vars.el.
...
Dan♦
- 32.1k
10
votes
Is there a table of Evil keys for Dired?
Here are a few things you can try to see available keys:
? -- actually this is partly wrong because
SPC ? dired
F1 m (describe-mode)
SPC h SPC dired -- this lets you jump to the code for the layer ...
- 3,132
10
votes
Have Ctrl-a increase a number just like in vim
I've stumbled upon the same issue of preference and as suggested before, evil-numbers is the package for that. But while trying to set it up, it was surprising that evil-numbers is already in ...
- 101
9
votes
Accepted
How to set evil-mode to use evil-emacs-state-mode in new buffers?
You can set evil-default-state to emacs. The docstring reads:
Documentation:
The default state.
This is the state a mode comes up in when it is not listed
in evil-emacs-state-modes, ...
Dan♦
- 32.1k
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
evil × 524key-bindings × 131
spacemacs × 84
org-mode × 42
doom × 17
vim-emulation × 16
keymap × 15
motion × 15
indentation × 13
copy-paste × 12
hooks × 10
search × 10
init-file × 8
magit × 8
dired × 8
text-editing × 8
cursor × 8
scrolling × 7
advice × 7
code-folding × 7
regular-expressions × 6
replace × 6
yank × 6
buffers × 5
window × 5