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?

1 Answer 1

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)
5
  • I added that line under dotspacemacs/user-init () to no avail. Should it go somewhere else?
    – Jir
    Commented Oct 11, 2018 at 12:12
  • I'm not familiar with spacemacs, though I would also try customizing that variable through M-x customize Commented Oct 11, 2018 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
    Commented Oct 11, 2018 at 12:21
  • What are <kbd>*</kbd> and <kbd>/</kbd> mapped to? It says in the answer that you linked that this mapping is overriden in spacemacs: github.com/syl20bnr/spacemacs/blob/… Commented Oct 11, 2018 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
    Commented Oct 11, 2018 at 13:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.