|
From: | Daniel Colascione |
Subject: | Re: Let's make C-M-w in isearch yank symbol, not delete character |
Date: | Sun, 25 Feb 2018 13:43:43 -0800 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 |
On 02/25/2018 12:55 PM, Juri Linkov wrote:
Right now, C-w in search-mode yanks a word from the buffer and globs it onto the end of the search result. I usually want to search for symbols, not words, so I end up pressing C-w multiple times. C-M-w would be the natural keybinding for yanking a symbol instead of a word, but it's already taken by isearch-del-char. How about moving isearch-del-char somewhere else, like C-d, and making C-M-w yank a whole symbol?But isn't the prefix 'C-M-' usually reserved for keys that operate on whole expressions, not just symbols?
Good point. I don't have a strong objection to using forward-sexp instead of forward-symbol. It'll still DWIM in the cases I care about.
Fortunately, it's easy to add support for yanking an expression: in addition to the existing option 'edit' of 'search-exit-option' we can also provide a new option 'move' that will sync the current search string with the new position in the buffer after moving point using all standard motion commands, e.g. `C-f' will add the next char to the end of the search string, `C-M-f' will add the next expression, `M-f' will add the next word, `C-b' will delete text from the end of the search string, etc. Here is the implementation:
Thanks. I'm looking for ways we can tweak the existing default interaction model, but I think we should take a broader look at how isearch works in the first place. IMHO, find-and-replace should be more closely integrated into isearch, we should have a unified history for regular and regex search, and case-sensitivity, symbol-granularity, regex mode, etc. should all be independently toggleable peer flags.
[Prev in Thread] | Current Thread | [Next in Thread] |