Skip to main content
8 votes
Accepted

Extending word search selection in swiper

Try M-j, which is bound to ivy-yank-word in the ivy minibuffer key map. It's worth reading through the the ivy manual, either in Emacs or online. The relevant key bindings are discussed here: http://...
glucas's user avatar
  • 20.7k
7 votes
Accepted

Search for either of two words using isearch

C-M-s to invoke isearch-forward-regexp then type aaa\|bbb, where aaa is your first word and bbb is your second. Alternatives, just C-s to invoke isearch, then press M-r to toggle to regex.
Xah Lee's user avatar
  • 1,766
7 votes
Accepted

Selecting (i.e., as the region) the current match in incremental search

Here's one approach: (defun isearch-exit-mark-match () "Exit isearch and mark the current match." (interactive) (isearch-exit) (push-mark isearch-other-end) (activate-mark)) (define-key ...
glucas's user avatar
  • 20.7k
7 votes
Accepted

edit search string and begin search from current location

During Isearch M-e is bound to isearch-edit-string. It pauses Isearch and puts the current search string in the minibuffer so you can edit it. Just use C-s again to resume searching from the current ...
Drew's user avatar
  • 78k
6 votes

char-fold-search match for German eszett (ß)?

By default, this is not possible (easiest way to see this is with C-h v char-fold-table RET and searching for ß — which you won't find). However, if you modify char-fold-table (the variable ...
aplaice's user avatar
  • 2,206
6 votes
Accepted

Wraparound search with `isearch-mode`

It works OK for me. Did you use C-s to repeat the search? C-s repeats Isearch, including to wrap around. You can replace the repeat-search binding: (define-key isearch-mode-map (kbd "<C-f3>") ...
Drew's user avatar
  • 78k
5 votes
Accepted

Move cursor left/right while entering isearch

You can run the command isearch-edit-string pressing M-e. See the documentation for details.
matteol's user avatar
  • 2,038
5 votes
Accepted

isearch but don't move the cursor until I ask to search

C-g, possibly repeating it, puts you back where you started and exits Isearch. Not wanting search to start until you've finished typing is not incremental search. It is plain, nonincremental search....
Drew's user avatar
  • 78k
5 votes

Get Emacs to jump to the start of a word after isearch

As Drew pointed out in his answer you can also end the search with another key such as M-b or M-f, which for words boundaries works good, but my solution is kind of more general: define a key to put ...
Anler's user avatar
  • 239
5 votes
Accepted

Non-greedy regex not working

The problem is not about using non-greedy matching. It is about which chars you're matching. Specifically, you want to match 《 followed by any number of non-《 chars, followed by IJ》. This is a ...
Drew's user avatar
  • 78k
4 votes
Accepted

How can I specify the background color for matching search results?

You are looking for the lazy-highlight face. You didn't mention what color your background is, so modify the below as needed: (set-face-attribute 'lazy-highlight nil :background "green") Similarly, ...
Scott Weldon's user avatar
  • 2,715
4 votes

use isearch to search the search-ring?

When you use the minibuffer, C-r is not bound to isearch-backward. You are not using Isearch at that time, and Isearch does not use the minibuffer, even though it might look like it does. Perhaps ...
Drew's user avatar
  • 78k
4 votes

Selecting (i.e., as the region) the current match in incremental search

Library Isearch+ lets you do that easily, and even toggle it on/off on the fly. Non-nil option isearchp-set-region-flag automatically sets the region (selection) around the last search target when ...
Drew's user avatar
  • 78k
4 votes
Accepted

What is the best way to search forward/backward for a token?

You used tag isearch so presumably you want to search interactively, not using Lisp. And you used tag words; you apparently want to search for a whole word. In that case, just use M-s w, which does ...
Drew's user avatar
  • 78k
4 votes

Move cursor left/right while entering isearch

@matteol answered your question. Here is some further info about this. During Isearch, keys you press that are defined in isearch-mode-map act according to their bindings there. Keys that are not ...
Drew's user avatar
  • 78k
4 votes
Accepted

Search forward for the FIRST space character and stop there

Set variable isearch-lax-whitespace to nil. C-h v isearch-lax-whitespace tells you: isearch-lax-whitespace is a variable defined in isearch.el. Its value is t Documentation: If non-...
Drew's user avatar
  • 78k
4 votes

Incremental Search after opening file

According to Preset search isearch-string from command line, you can search for PATTERN with Isearch programmatically using: (isearch-forward nil t) (isearch-yank-string "PATTERN") So open FILE and ...
xuchunyang's user avatar
  • 14.6k
4 votes
Accepted

Incremental Search after opening file

The eval solution will work, but this is a lot of stuff to type on the command-line if you use this search frequently. We can actually change the command-line parameters so that --search <string&...
cyberbisson's user avatar
4 votes
Accepted

improving isearch

For quick direction change and wrap around you can use the following: (defun isearch-repeat-forward+ () (interactive) (unless isearch-forward (goto-char isearch-other-end)) (isearch-repeat-...
clemera's user avatar
  • 3,486
4 votes
Accepted

Implementing my own incremental search

The minibuffer is a normal buffer, so you can use post-command-hook or after-change-functions (or both) to react to edits. You can use minibuffer-with-setup-hook to set them up: (minibuffer-with-...
Stefan's user avatar
  • 26.5k
4 votes
Accepted

How do I change the highlight color for selected texts on isearch?

See these faces: isearch Face for highlighting Isearch matches. isearch-fail Face for highlighting failed part in Isearch echo-area message. lazy-highlight Face for lazy highlighting of ...
muffinmad's user avatar
  • 2,320
4 votes
Accepted

Isearch + Dired fast navigation

Change \r to 'return: (add-hook 'isearch-mode-end-hook (lambda () (when (and (eq major-mode 'dired-mode) (not isearch-mode-end-hook-quit) (eq last-input-event '...
Drew's user avatar
  • 78k
3 votes
Accepted

isearch, but not past the nth line of the buffer

Narrow the buffer to whatever portion you want to search: C-x n n. See the Emacs manual, node Narrowing. See also @Tobias's comment about using Emacs with very large files. (Perhaps he will post that ...
Drew's user avatar
  • 78k
3 votes
Accepted

Search only within an Org Sparse Tree

Dunno anything about Org or org-sparse-tree. But if it makes only some text visible by making the rest of the text invisible, then Isearch should automatically do the right thing: search only the ...
Drew's user avatar
  • 78k
3 votes
Accepted

Regex search: Why C-M-s does not seem to work like other keystrokes?

This was apparently due to Ubuntu (with Unity): C-M-s was in my case a default key-binding for minimizing windows. Hence a conflict, I guess. Redefining it to something else solved the problem.
Giuseppe's user avatar
  • 455
3 votes
Accepted

Exact match for isearch

You are apparently looking for word search with case-sensitivity. For case-sensitive search, set case-fold-search to nil. You can also just toggle case-sensitivity temporarily, during Isearch, using ...
Drew's user avatar
  • 78k
3 votes
Accepted

How to make DEL in isearch always delete character?

The key C-M-w does what you are asking for. It is bound in isearch-mode-map to isearch-del-char, while DEL is bound to isearch-delete-char. If you really want DEL to be bound to isearch-del-char then ...
Drew's user avatar
  • 78k
3 votes

Incremental Search across Projectile project

I recommend projectile-ag for this. Works very well and is somewhat faster than isearch
tanenbring's user avatar
3 votes
Accepted

Limiting Emacs incremental search to a function definition

As @xuchunyang said in a comment to your question, you can first narrow the buffer to the function definition. Or you can use library Isearch+, which lets you search just the active region, without ...
Drew's user avatar
  • 78k
3 votes

Ringing Bell in Macro with Search

The alternative mentioned in the emacs wiki link that Kevin Holmes gave works for me in emacs 25.2.1: while recording the macro, type Ctrl+s to start isearch, then type RET to switch to normal search (...
Jonathan Schuster's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible