[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Is there an easier way to jump to the same word?
From: |
Chris F.A. Johnson |
Subject: |
Re: Is there an easier way to jump to the same word? |
Date: |
Thu, 11 Apr 2013 04:22:12 -0400 |
User-agent: |
slrn/0.9.8.1 (Linux) |
On 2013-04-11, Chris F.A. Johnson wrote:
> On 2013-04-11, Steven Degutis wrote:
>> --047d7b67031bbb272504da0c7ba5
>> Content-Type: text/plain; charset=ISO-8859-1
>>
>> Often times I find that I want to jump to another occurrence of the
>> word-under-point, almost always variables or functions. I end up going to
>> the beginning of the word with M-b, doing isearch-forward with C-s, adding
>> all the words until the full word is the search term with C-w a bunch of
>> times, and finally C-s to jump around to other instances of it.
>>
>> Is there a better way to do this?
>
> This is what I use:
>
> (defun current-word-search ()
> "search forward for word under cursor"
> (interactive)
> (word-search-forward (current-word)))
And to search backwards:
(defun current-word-reverse-search ()
"search backwards for word under cursor"
(interactive)
(word-search-backward (current-word)))
And, of course, they are bound to keys:
(global-set-key (kbd "s-s") 'current-word-search)
(global-set-key (kbd "s-r") 'current-word-reverse-search)
--
Chris F.A. Johnson <http://cfajohnson.com>
Author: =======================
Pro Bash Programming: Scripting the GNU/Linux Shell (2009, Apress)
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)