The following snippet will make Evil treat an Emacs symbol as a word.
(defalias #'forward-evil-word #'forward-evil-symbol)
;; make evil-search-word look for symbol rather than word boundaries
(setq-default evil-symbol-word-search t))
This has the advantage that it changes depending on the language:
is one ...
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 constituent in the syntax table, and you want to treat it as a word constituent.
If you're using emacs 24.4, you could try enabling superword-mode. I haven't ...
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 Emacs configuration that fixes this issue:
;; Imagine the following scenario. One wants to paste some previously copied
;; (from application other than Emacs) ...
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 an example of such a case, the package.el listing is another one.
Typically you want commands moving point in evil-motion-state-map and everything else in evil-...
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 existing Emacs Lisp code as possible for better interoperability and less wasted effort, you'll for instance find out that window movement was lifted from windmove....
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 #'(lambda () (modify-syntax-entry ?_ "w")))
(add-hook 'js2-mode-hook #'(lambda () (modify-syntax-entry ?_ "w")))
It also works in regular emacs. With ...
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 toggle in this list have 3 functions associated to them, if we take vi-tilde-fringe then the functions are:
spacemacs/toggle-vi-tilde-fringe (toggle the state on ...
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 state (F1 k), then what keymap they're bound to (just look through evil-maps.el with M-x find-library). Armed with this knowledge, accomplishing this is fairly ...
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 to a block, you can (setq cursor-type 'box).
However, evil provides a number of different cursors for the different states, which you can adjust to give you a ...
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-fine-undo 'fine)
With this setting, you get new undo units when moving the cursor in insert mode, but replace operations are undone in one step. As far as I can ...
I noticed the d key deleting a line on a single press as well. I am using Spacemacs firstname.lastname@example.org on the develop branch. I do not know if this is your case, but I had an incomplete search in progress.
Steps to reproduce:
In command mode, initiate a search by pressing the / key
With the mouse, click on any text in your buffer
Press the d key a single time ...
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
(kbd "<pause>") 'zone)
It is able to delay the execution of the binding (by using eval-after-load itself) and can also take more ...
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 derived modes, the hooks system is a much more natural fit for Evil IMO.
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.
(foo |(bar baz) quux blab) -> (foo (bar baz) quux blab)|
(foo (bar |baz) quux blab) -> (foo (bar baz) quux blab)| ;; 2
(foo bar |baz -&...
I've got it working now, thanks to your answers:
(defun my-jump-to-tag ()
(call-interactively (key-binding (kbd "M-.")))
(define-key evil-normal-state-map (kbd "C-]") 'my-jump-to-tag)
This will set evil-state to "...
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 after enabling Evil or alternatively after loading the respective file:
'(evil-ex-define-cmd "b[utterfly]" 'butterfly))
Doing this ...
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 linum-relative RET
From there, customize the "Linum Relative Current Symbol" variable (whose default value is 0). If you hit on the "More" link, below it, the ...
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-state-modes first to determine the initial state.
The correct way to change the initial state of a mode is by using evil-set-initial-state:
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 foo with bar:
M-% foo RET bar RET !
This makes use of the fact that query-replace will work on the active region instead of the whole buffer if there is one.
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.
;; @see https://bitbucket.org/lyro/evil/issue/511/let-certain-minor-modes-key-bindings
"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 evil-move-cursor-back nil).
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 specify C-k?
(define-key org-mode-map (kbd "C-k") nil)
Also, there may be other modes that bind a common key like C-k. Instead, you can use C-c k. The C-(letter) ...
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 spacemacs, just missing the keybinds.
To activate, just add
(define-key evil-normal-state-map (kbd "C-a") 'evil-numbers/inc-at-pt)
(define-key evil-visual-state-map (...
You can set evil-default-state to emacs. The docstring reads:
The default state.
This is the state a mode comes up in when it is not listed
in evil-emacs-state-modes, evil-insert-state-modes or
evil-motion-state-modes. The value may be one of normal,
insert, visual, replace, operator, motion and
Hence: (setq evil-...
Simply use the kill ring. In evil, your simplest option is to use evil-paste-pop, bound by default to C-p. Here's the docstring:
Replace the just-yanked stretch of killed text with a different stretch.
This command is allowed only immediatly after a yank,
evil-paste-before, evil-paste-after or evil-paste-pop.
This command uses the same paste ...