all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Search for a word in Emacs as is done in gvim
@ 2009-04-17 12:09 rakeshg
  2009-04-17 19:41 ` Tassilo Horn
       [not found] ` <mailman.5543.1239997324.31690.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 7+ messages in thread
From: rakeshg @ 2009-04-17 12:09 UTC (permalink / raw)
  To: Help-gnu-emacs


Hi,

In gvim we have a feature where:

By having the cursor on a particular word, and pressing "*" key , we can
search for the word in the files.

In emacs we have first copy the word and then do Ctl-S and then paste it.

Is there a way in emacs to search for a word like we do in gvim(VI)

-Rakesh
-- 
View this message in context: http://www.nabble.com/Search-for-a-word-in-Emacs-as-is-done-in-gvim-tp23096280p23096280.html
Sent from the Emacs - Help mailing list archive at Nabble.com.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Search for a word in Emacs as is done in gvim
       [not found] <mailman.5530.1239976484.31690.help-gnu-emacs@gnu.org>
@ 2009-04-17 14:16 ` Scott Frazer
  2009-04-17 14:17 ` harven
  1 sibling, 0 replies; 7+ messages in thread
From: Scott Frazer @ 2009-04-17 14:16 UTC (permalink / raw)
  To: help-gnu-emacs

rakeshg wrote:
> Hi,
> 
> In gvim we have a feature where:
> 
> By having the cursor on a particular word, and pressing "*" key , we can
> search for the word in the files.
> 
> In emacs we have first copy the word and then do Ctl-S and then paste it.
> 
> Is there a way in emacs to search for a word like we do in gvim(VI)
> 
> -Rakesh

The EmacsWiki shows lots of ways ... of course I'm biased towards mine:

http://www.emacswiki.org/emacs/SearchAtPoint#toc8


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Search for a word in Emacs as is done in gvim
       [not found] <mailman.5530.1239976484.31690.help-gnu-emacs@gnu.org>
  2009-04-17 14:16 ` Search for a word in Emacs as is done in gvim Scott Frazer
@ 2009-04-17 14:17 ` harven
  1 sibling, 0 replies; 7+ messages in thread
From: harven @ 2009-04-17 14:17 UTC (permalink / raw)
  To: help-gnu-emacs

rakeshg <rakeshbabugr@gmail.com> writes:

> Hi,
>
> In gvim we have a feature where:
>
> By having the cursor on a particular word, and pressing "*" key , we can
> search for the word in the files.
>
> In emacs we have first copy the word and then do Ctl-S and then paste it.
>
> Is there a way in emacs to search for a word like we do in gvim(VI)

With the point at the beginning of the word, type: C-s C-w C-s C-s ...
You can swallow several words if you want :        C-s C-w C-w C-w C-s C-s ...
or even everything until the end of line:          C-s C-y

see the following for a list of options after the first C-s
http://www.emacswiki.org/emacs/IncrementalSearch


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Search for a word in Emacs as is done in gvim
  2009-04-17 12:09 rakeshg
@ 2009-04-17 19:41 ` Tassilo Horn
  2009-04-17 20:57   ` rakeshg
       [not found] ` <mailman.5543.1239997324.31690.help-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 7+ messages in thread
From: Tassilo Horn @ 2009-04-17 19:41 UTC (permalink / raw)
  To: help-gnu-emacs

rakeshg <rakeshbabugr@gmail.com> writes:

> By having the cursor on a particular word, and pressing "*" key , we
> can search for the word in the files.
>
> In emacs we have first copy the word and then do Ctl-S and then paste
> it.

No, do `M-b C-s C-w' and be fine.  (M-b goes to the beginning of the
word, C-s starts isearch and C-w captures the word from point to end and
inserts it at the isearch prompt.

If you need that often, pack it in a macro or write a function to do
that.

Bye,
Tassilo
-- 
The  11th commandment is  "Thou shalt  not piss  off Chuck  Norris" This
commandment is rarely enforced, as it is impossible to accomplish.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Search for a word in Emacs as is done in gvim
  2009-04-17 19:41 ` Tassilo Horn
@ 2009-04-17 20:57   ` rakeshg
  0 siblings, 0 replies; 7+ messages in thread
From: rakeshg @ 2009-04-17 20:57 UTC (permalink / raw)
  To: Help-gnu-emacs


Thanks guys
-- 
View this message in context: http://www.nabble.com/Search-for-a-word-in-Emacs-as-is-done-in-gvim-tp23096280p23105602.html
Sent from the Emacs - Help mailing list archive at Nabble.com.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Search for a word in Emacs as is done in gvim
       [not found] ` <mailman.5543.1239997324.31690.help-gnu-emacs@gnu.org>
@ 2009-05-03  1:07   ` David Combs
  2009-05-03  8:10     ` Tassilo Horn
  0 siblings, 1 reply; 7+ messages in thread
From: David Combs @ 2009-05-03  1:07 UTC (permalink / raw)
  To: help-gnu-emacs

In article <mailman.5543.1239997324.31690.help-gnu-emacs@gnu.org>,
Tassilo Horn  <tassilo@member.fsf.org> wrote:
>rakeshg <rakeshbabugr@gmail.com> writes:
>
>> By having the cursor on a particular word, and pressing "*" key , we
>> can search for the word in the files.
>>
>> In emacs we have first copy the word and then do Ctl-S and then paste
>> it.
>
>No, do `M-b C-s C-w' and be fine.  (M-b goes to the beginning of the
>word, C-s starts isearch and C-w captures the word from point to end and
>inserts it at the isearch prompt.


WOW!  IT WORKS!  That C-w deposits the word into the search string!

Now, just WHERE  is that documented?

| C-w runs the command kill-region
|   which is an interactive compiled Lisp function in `simple.el'.
| It is bound to <S-delete>, C-w.
| (kill-region beg end &optional yank-handler)
| 
| Kill ("cut") text between point and mark.
| This deletes the text from the buffer and saves it in the kill ring.
| The command C-y can retrieve it from there.
| (If you want to kill and then yank immediately, use M-w.)
| 
| If you want to append the killed region to the last killed text,
| use C-M-w before C-w.
| 
| If the buffer is read-only, Emacs will beep and refrain from deleting
| the text, but put the text in the kill ring anyway.  This means that
| you can use the killing commands to copy text from a read-only buffer.
| 
| This is the primitive for programs to kill text (as opposed to deleting it).
| Supply two arguments, character positions indicating the stretch of text
|  to be killed.
| Any command that calls this function is a "kill command".
| If the previous command was also a kill command,
| the text killed this time appends to the text killed last time
| to make one entry in the kill ring.
| 
| In Lisp code, optional third arg yank-handler, if non-nil,
| specifies the yank-handler text property to be set on the killed
| text.  See `insert-for-yank'.

[back]


Thanks (for the nifty trick!)


David

PS: If that doc needs fixing, I'll leave it to you to see
that it happens -- and THANK YOU for that too.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Search for a word in Emacs as is done in gvim
  2009-05-03  1:07   ` David Combs
@ 2009-05-03  8:10     ` Tassilo Horn
  0 siblings, 0 replies; 7+ messages in thread
From: Tassilo Horn @ 2009-05-03  8:10 UTC (permalink / raw)
  To: help-gnu-emacs

dkcombs@panix.com (David Combs) writes:

Hi David,

>>No, do `M-b C-s C-w' and be fine.  (M-b goes to the beginning of the
>>word, C-s starts isearch and C-w captures the word from point to end
>>and inserts it at the isearch prompt.
>
>
> WOW!  IT WORKS!  That C-w deposits the word into the search string!
>
> Now, just WHERE  is that documented?

It's a speciality of isearch, so it's documented there.

,----[ C-h k C-s ]
| C-s runs the command isearch-forward, which is an interactive compiled
| Lisp function in `isearch.el'.
| 
| It is bound to C-s, <menu-bar> <edit> <search> <i-search>
| <isearch-forward>.
| 
| (isearch-forward &optional regexp-p no-recursive-edit)
| 
| Do incremental search forward.
| With a prefix argument, do an incremental regular expression search
| instead.
| 
| As you type characters, they add to the search string and are found.
| The following non-printing keys are bound in `isearch-mode-map'.
| 
| Type DEL to cancel last input item from end of search string.
| Type RET to exit, leaving point at location found.
| Type LFD (C-j) to match end of line.
| Type C-s to search again forward, C-r to search again backward.
| Type C-w to yank next word or character in buffer
|   onto the end of the search string, and search for it.
| Type C-M-w to delete character from end of search string.
| Type C-M-y to yank char from buffer onto end of search string and
| search for it.
| Type C-y to yank rest of line onto end of search string and search for
| it.
| Type M-y to yank the last string of killed text.
| Type C-q to quote control character to search for it.
| C-g while searching or when search has failed cancels input back to
| what has been found successfully.
| C-g when search is successful aborts and moves point to starting
| point.
| 
| If you try to exit with the search string still empty, it invokes
| nonincremental search.
| 
| Type M-c to toggle search case-sensitivity.
| Type M-r to toggle regular-expression mode.
| Type M-s w to toggle word mode.
| Type M-e to edit the search string in the minibuffer.
| 
| Also supported is a search ring of the previous 16 search strings.
| Type M-n to search for the next item in the search ring.
| Type M-p to search for the previous item in the search ring.
| Type M-TAB to complete the search string using the search ring.
| 
| Type M-% to run `query-replace' with string to replace from last
| search string.
| Type C-M-% to run `query-replace-regexp' with the last search string.
| Type M-s o to run `occur' that shows the last search string.
| Type M-s h r to run `highlight-regexp' that highlights the last search
| string.
| 
| Type C-h b to display all Isearch key bindings.
| Type C-h k to display documentation of Isearch key.
| Type C-h m to display documentation of Isearch mode.
| 
| If an input method is turned on in the current buffer, that input
| method is also active while you are typing characters to search.  To
| toggle the input method, type C-\.  It also toggles the input method
| in the current buffer.
| 
| To use a different input method for searching, type C-^,
| and specify an input method you want to use.
| 
| The above keys, bound in `isearch-mode-map', are often controlled by
| options; do C-h A on search-.* to find them.  Other control and meta
| characters terminate the search and are then executed normally
| (depending on `search-exit-option').  Likewise for function keys and
| mouse button events.
| 
| If this function is called non-interactively, it does not return to
| the calling function until the search is done.
`----

And it's in the manual, too.

,----[ (info "(emacs)Isearch Yank") ]
| Within incremental search, you can use `C-w' and `C-y' to grab text
| from the buffer into the search string.  This makes it convenient to
| search for another occurrence of text at point.
| 
|    `C-w' copies the character or word after point and adds it to the
| search string, advancing point over it.  (The decision, whether to
| copy a character or a word, is heuristic.)
| 
|    `C-y' is similar to `C-w' but copies all the rest of the current
| line into the search string.  If point is already at the end of a
| line, it grabs the entire next line.  If the search is currently
| case-insensitive, both `C-y' and `C-w' convert the text they copy to
| lower case, so that the search remains case-insensitive.
| 
|    `C-M-w' and `C-M-y' modify the search string by only one character
| at a time: `C-M-w' deletes the last character from the search string
| and `C-M-y' copies the character after point to the end of the search
| string.  An alternative method to add the character after point into
| the search string is to enter the minibuffer by `M-e' and to type
| `C-f' at the end of the search string in the minibuffer.
| 
|    The character `M-y' copies text from the kill ring into the search
| string.  It uses the same text that `C-y' would yank.  `Mouse-2' in
| the echo area does the same.  *Note Yanking::.
`----

Bye,
Tassilo
-- 
            Wenn Windows die Lösung ist, kann ich dann bitte
                       das Problem zurück haben?





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-05-03  8:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.5530.1239976484.31690.help-gnu-emacs@gnu.org>
2009-04-17 14:16 ` Search for a word in Emacs as is done in gvim Scott Frazer
2009-04-17 14:17 ` harven
2009-04-17 12:09 rakeshg
2009-04-17 19:41 ` Tassilo Horn
2009-04-17 20:57   ` rakeshg
     [not found] ` <mailman.5543.1239997324.31690.help-gnu-emacs@gnu.org>
2009-05-03  1:07   ` David Combs
2009-05-03  8:10     ` Tassilo Horn

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.