help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to add VIM * functionality in EMACS VIPER mode?


From: Weihua JIANG
Subject: Re: How to add VIM * functionality in EMACS VIPER mode?
Date: Sun, 6 Nov 2005 10:01:17 +0800

Lennart,
 
Thank you very much! Now I have the * functionality in VIPER mode. Below is my code:

 (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)


Thanks,
Weihua, Jiang

 
2005/11/6, Lennart Borgman <lennart.borgman.073@student.lu.se>:
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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]