2

In my attempt to have * and # work in Spacemacs as they do in Vim, I've followed the solution posted at this question.

Those keys now work, but there's one hurdle more to overcome: the searched term does not populate the search history.

As an example, suppose you:

  • do /aaa
  • position yourself over another word, say "bbb" and hit *
  • hit n

Spacemacs will search for "aaa" rather than "bbb". Is there a way to fix this behaviour?

Jir
  • 71
  • 8

1 Answers1

0

You can use evil-symbol-word-search to accomplish what you want by adding the following to you init.el after loading evil

(setq-default evil-symbol-word-search t)
Felipe Lema
  • 737
  • 3
  • 11
  • I added that line under `dotspacemacs/user-init ()` to no avail. Should it go somewhere else? – Jir Oct 11 '18 at 12:12
  • I'm not familiar with spacemacs, though I would also try customizing that variable through `M-x customize` – Felipe Lema Oct 11 '18 at 12:17
  • I tried that, too, but it looks as if the variable does not have any effect (though being set to `t`) – Jir Oct 11 '18 at 12:21
  • What are * and / mapped to? It says in the answer that you linked that this mapping is overriden in spacemacs: https://github.com/syl20bnr/spacemacs/blob/c7a103a772d808101d7635ec10f292ab9202d9ee/layers/%2Bspacemacs/spacemacs-editing-visual/packages.el#L173-L177 – Felipe Lema Oct 11 '18 at 13:21
  • They are bound to `evil-search-word-forward` and `backward`: `(defun dotspacemacs/user-config () (with-eval-after-load 'auto-highlight-symbol (define-key evil-motion-state-map (kbd "*") 'evil-search-word-forward) (define-key evil-motion-state-map (kbd "#") 'evil-search-word-backward)))` – Jir Oct 11 '18 at 13:38