Hot answers tagged

42 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 ...
user avatar
  • 999
37 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 ...
user avatar
  • 31.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 ...
user avatar
20 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 ...
user avatar
  • 21k
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 ...
user avatar
  • 21k
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 #'(...
user avatar
  • 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 ...
user avatar
  • 2,075
15 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 ...
user avatar
  • 31.1k
14 votes

How can I get undo behavior in Evil similar to Vim's?

Since @shosti pointed out that Evil considers deviation from Vim behavior as bugs, I filed a bug and one of the authors of Evil added a new possible value for evil-want-fine-undo: (setq evil-want-...
user avatar
  • 2,440
14 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 ...
user avatar
  • 21k
14 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. ...
user avatar
  • 141
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 ...
user avatar
  • 21k
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-...
user avatar
  • 21k
13 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.
user avatar
  • 1,414
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 ...
user avatar
  • 21k
12 votes

Have Ctrl-a increase a number just like in vim

The package evil-numbers does exactly what you need.
user avatar
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 |...
user avatar
  • 31.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 ...
user avatar
  • 24.3k
11 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.
user avatar
  • 1,415
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)
user avatar
  • 892
10 votes
Accepted

Evil: map keybindings the vim way?

I've got it working now, thanks to your answers: (defun my-jump-to-tag () (interactive) (evil-emacs-state) (call-interactively (key-binding (kbd "M-."))) (evil-change-to-previous-state (other-...
user avatar
  • 356
10 votes

Is there an equivalent to sed-style substitution commands from vim?

Here is one way of doing it that uses built-in functionality only: With point in the line that contains first occurrence of begin, press C-SPC. Move to next occurrence of end: C-s end RET Replace ...
user avatar
  • 14.2k
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 ...
user avatar
  • 21k
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)))
user avatar
  • 7,179
9 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. ;;...
user avatar
  • 4,611
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, ...
user avatar
  • 31.1k
9 votes
Accepted

Cursor moves one position left after exiting insert mode?

"Moving one space left after leaving insert" is the default behavior in Vim, which evil (on top of which spacemacs is built) emulates by default. If you don't like that behavior, you can set (setq ...
user avatar
  • 31.1k
9 votes
Accepted

Remove key-mapping from org-mode

Org-mode is built-in to Emacs 24.5.1, so there's no need to eval-after-load. with-eval-after-load is also preferred over eval-after-load. Instead of trying to remap org-kill-line, why not just ...
user avatar
9 votes
Accepted

Evil mode and regular expressions

evil uses the Emacs regexp facilities under the hood. Unfortunately, Emacs does not appear to have a separate syntax class for digits, and does not recognize the \d regexp class. So, to match your ...
user avatar
  • 31.1k
9 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. ...
user avatar
  • 31.1k

Only top scored, non community-wiki answers of a minimum length are eligible