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. See Yanking.blog comments powered by Disqus