3
votes

I want to get the search at point functionality ("*" and "#") in emacs.

So I want to use "*" and "#" from the emacs evil-mode, as this is one of the suggestions. However, I don't want anything else from the evil-mode, just those two functions!

This is my .emacs file:

(package-initialize)
(evil-mode 1)        ;; enable evil-mode
(global-set-key (kbd "C-*") 'evil-search-symbol-forward)
(global-set-key (kbd "C-#") 'evil-search-symbol-backward)

Now the keybindings work, but I loaded the whole evil-mode, so it messes up my standard emacs keybindings like "C-y" for yank.

If I don't load the evil-mode in the .emacs file, I get the error:

Symbol's function definition is void: evil-search-symbol-forward
2

2 Answers

3
votes

@event_jr's answer mentions highlight-symbols, which is probably a much more lightweight way to do what you want.

However, if you really want to use the evil version, you can (require 'evil) in your .emacs file without turning it on (ie, leave off the (evil-mode 1) statement).

Meanwhile, the functions you want are actually named evil-search-word-forward and evil-search-word-backward, not the ...-symbol-... version you saw on the wiki page (which is probably outdated).

1
votes

You should use highlight-symbols for symbol jumping and highlighting.