whitphx / vscode-emacs-mcx

Awesome Emacs Keymap - VSCode emacs keybinding with multi cursor support
https://marketplace.visualstudio.com/items?itemName=tuttieee.emacs-mcx
Other
369 stars 63 forks source link

Selective search and replace #925

Open hotsphink opened 3 years ago

hotsphink commented 3 years ago

This is really a complaint I have with vscode, but I'm filing an issue here in case it's fixable in an extension (I don't know what's possible.)

I very frequently want to selectively search and replace: do a search and replace, then choose for each match whether or not to do the replacement. In emacs, I can do S-M-5 and use 'y' and 'n' to make the choice for each match (or use '!' to replace the rest, also useful). In vscode, I can use the enter key in place of 'y', but the equivalent of 'n' followed by 'y' is (1) click the down arrow in the Find widget, (2) click on the replacement text to switch focus there, and then (3) press the enter key to accept that match.

Alternatively, I can do C-s to get to the next match I want to change, but then the focus is wrong so if I want to do the replacement I must first hit Tab to shift focus to the replacement text, then I can hit enter.

I'm laying out the problem because I don't know what the best solution would be. One possibility would be to make C-s when the focus is on the replacement text go to the next match but leave the focus on the replacement text. Then I would use Enter for 'y', and C-s Enter for 'n', which is plenty good enough. (I would need to hit Esc to dismiss the Find widget if I wanted to search for something else, but that's fine.)

Optimally, when the Find widget is active but neither the search text nor replacement text fields are focused, there would be key mappings equivalent to 'y', 'n', and '!'.

whitphx commented 2 years ago

As you already mentioned, this is VSCode's native design and I'm not sure if it is possible too.

I keep this issue opened and will investigate the solution later, but cannot promise the outcomes.

Thank you for raising the question anyway.