unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Search like VIM
@ 2007-01-23 15:46 CloudStrife
  2007-01-23 16:42 ` Robert Thorpe
  2007-01-23 16:44 ` Tassilo Horn
  0 siblings, 2 replies; 4+ messages in thread
From: CloudStrife @ 2007-01-23 15:46 UTC (permalink / raw)


I need to search a lot for variables in script and the way VIM handles
searching is much more comfortable than how emacs handles, i.e. aftr
"/<var-name> RET" all the occurances are highlighted and they remain
that way. Pressing "n" anytime will take you to next occurance.
In emacs once any key other that C-s or C-r is pressed the highlight
goes off and we nees "C-s C-s" to get it bak Is there a solution to
keep it highlighted always (atleast this if not the "n" also, which can
b replaced by "C-s C-s")
Thanks
Cloud

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

* Re: Search like VIM
  2007-01-23 15:46 Search like VIM CloudStrife
@ 2007-01-23 16:42 ` Robert Thorpe
  2007-01-23 16:44 ` Tassilo Horn
  1 sibling, 0 replies; 4+ messages in thread
From: Robert Thorpe @ 2007-01-23 16:42 UTC (permalink / raw)


CloudStrife wrote:
> I need to search a lot for variables in script and the way VIM handles
> searching is much more comfortable than how emacs handles, i.e. aftr
> "/<var-name> RET" all the occurances are highlighted and they remain
> that way. Pressing "n" anytime will take you to next occurance.
> In emacs once any key other that C-s or C-r is pressed the highlight
> goes off and we nees "C-s C-s" to get it bak Is there a solution to
> keep it highlighted always (atleast this if not the "n" also, which can
> b replaced by "C-s C-s")

You could use:

M-x highlight-regexp RET regexp

Or, for things like this where I want to keep a list of matches to a
search I use M-x occur.
This doesn't do the same thing though, since it puts all the matches in
a list in a separate buffer.
Often this is useful though.

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

* Re: Search like VIM
  2007-01-23 15:46 Search like VIM CloudStrife
  2007-01-23 16:42 ` Robert Thorpe
@ 2007-01-23 16:44 ` Tassilo Horn
  2007-01-23 18:44   ` Drew Adams
  1 sibling, 1 reply; 4+ messages in thread
From: Tassilo Horn @ 2007-01-23 16:44 UTC (permalink / raw)


Hi,

you want

,----[ 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'.
| 
| [...]
`----

and

,----[ C-h k C-r ]
| C-r runs the command isearch-backward
|   which is an interactive compiled Lisp function in `isearch.el'.
| It is bound to C-r, <menu-bar> <edit> <search> <i-search> <isearch-backward>.
| (isearch-backward &optional REGEXP-P NO-RECURSIVE-EDIT)
| 
| Do incremental search backward.
| With a prefix argument, do a regular expression search instead.
| See C-s for more information.
`----


This highlights all matches when searching. If you want the highlighting
permanently, try

,----[ C-h f highlight-regexp RET ]
| highlight-regexp is an alias for `hi-lock-face-buffer' in `hi-lock.el'.
| It is bound to <menu-bar> <edit> <hi-lock> <highlight-regexp>.
| (highlight-regexp REGEXP &optional FACE)
| 
| Set face of each match of REGEXP to FACE.
| 
| Interactively, prompt for REGEXP then FACE.  Buffer-local history
| list maintained for regexps, global history maintained for faces.
| Use M-n and M-p to retrieve next or previous history item.
| (See info node `Minibuffer History'.)
`----

Regards,
Tassilo
-- 
A morning without coffee is like something without something else.

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

* RE: Search like VIM
  2007-01-23 16:44 ` Tassilo Horn
@ 2007-01-23 18:44   ` Drew Adams
  0 siblings, 0 replies; 4+ messages in thread
From: Drew Adams @ 2007-01-23 18:44 UTC (permalink / raw)


> If you want the highlighting permanently, try
>
> highlight-regexp

In Emacs 22, there is no need to do that. Just customize variable
`lazy-highlight-cleanup' to nil.

Then, isearch highlighting will remain afterward, until you remove it using
command `lazy-highlight-cleanup' (same name).

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

end of thread, other threads:[~2007-01-23 18:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-23 15:46 Search like VIM CloudStrife
2007-01-23 16:42 ` Robert Thorpe
2007-01-23 16:44 ` Tassilo Horn
2007-01-23 18:44   ` Drew Adams

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).