In Spacemacs, is there an easy way to make * (which calls the function spacemacs/enter-ahs-forward) work like it does in Vim?

That is, I want * to perform forward searching like in Vim, without opening up the "Symbol Highlight Transient State".

2 Answers 2


After some searching I have figured this out.

Evil actually already has the search-forward functionality just like vim. Here is where the mapping to * is defined:


However, it appears that spacemacs overrides this mapping:


Spacemacs is using use-package to load the auto-highlight-symbol package, and in the :config section it is overwriting the mapping for *.

So in order to overwrite this mapping, it is neccesary to call define-key after auto-highlight-symbol has already been loaded. The following code can be put in your .spacemacs file:

(defun dotspacemacs/user-config ()
  (with-eval-after-load 'auto-highlight-symbol
    (define-key evil-motion-state-map (kbd "*") 'evil-search-word-forward)))

The following can be used if you want to overwrite both forward search and backward search:

(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)))
  • 1
    That worked like a charm for me, with the only nagging that the searched term does not populate the search history. Therefore, when you do /a, position yourself over another word, say "bbb" and hit *, the next time you hit n you'll search for "a". I'll probably turn this into a question.
    – Jir
    Commented Sep 20, 2018 at 14:07

Evil-visualstar is a package that provides the feature, but I am not sure of the compatibility with spacemacs.

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.