(defun search-at-point ()
"Put symbol at current point into search string."
(interactive)
(setq viper-s-string (concat "\\<" (symbol-name (symbol-at-point)) "\\>"))
(setq viper-s-forward t)
;; TODO: Handle case where symbol-at-point returns nil.
(viper-search viper-s-string viper-s-forward 1))
(define-key viper-vi-global-user-map (kbd "*") 'search-at-point)
Weihua JIANG wrote:
> In normal mode of VIM, there is a very good functionality: when cursor
> under any position of a word, you can press key "*" to use the whole
> word under cursor (including both the chars before the cursor and after
> it) as search pattern.
>
> Now I switched to EMACS with VIPER mode. But VIPER lacks such
> functionality. Can any one tell me how to implement it in VIPER with
> some elisp code?
>
> Thanks
> Weihua Jiang
Hi Weihua,
This has been discussed on EmacsWiki, see
http://emacswiki.org/cgi-bin/wiki/SearchAtPoint for several solutions.