You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
I see a key mapping 'cmd-alt-e': 'find-and-replace:replace-next' to replace, then find the next match. I don't see a key mapping to replace (ONLY - don't move the cursor to the next match). If this feature does not exist, I'd like to have this added, such as 'cmd-alt-E': 'find-and-replace:replace' or 'cmd-ctrl-alt-e': 'find-and-replace:replace', so that if I know I'm replacing the last real match of an ambiguous pattern, but there may be other false matches further down the file, I don't have to reposition the view back to where the last replacement was done to continue editing.
Motivation
Earlier today I had to clone a section of YAML code then replace a single digit extension in numerous areas, such as One0 -> One8, Two0 -> Two8, ...; One1 -> One9, Two1 -> Two9, ... Many matches which changed one digit, so I was just switching between find-next and replace-next, as - due to the ambiguity - I was walking through matches one by one, often having to skip a false match. I had multiple sections where I had to repeat this far apart, with many sections where I would not want to accidentally replace this single digit in-between. Too much hassle and variance to try and use RegEx.
The problem which prompted a search for a "replace without attempting to find the next match" feature and perhaps key binding, was the last match in a known set, when I know changing from (for example, where there's a total of 16 places where I have to change this digit, all different) Sixteen0 -> Sixteen8, I want to replace 0 with 8, but then not move to the next 0 found arbitrarily down in the file. I'm forced to either hit Replace, then page up some unknown/unpredictable number of pages to get back to where the last change was made and where I needed to make other changes, or I have to manually overtype the character instead of pressing the Replace button or cmd-alt-e key combination.
It comes up a decent amount of times for me, so I was annoyed enough to check and see if there was some simple alternate key combination, like just cmd-ctrl-alt-e or cmd-alt-E, that would replace but then leave the cursor unmoved, same behavior as if there were no additional matches found.
What would be ideal, is if I could still hit the Replace button, but by also holding down the ctrl key, that would replace but stay put.
If there's some way to do this, I couldn't find it via Google search or looking through the keybinding code here.
Describe alternatives you've considered
Hit Replace, then hit page-up to get back to the last replacement.
Manually replace by overtyping the last known replacement, instead of using Replace button.
Both work, but disrupt workflow. It seems like one should be able to do this easily. It's a feature in many other editors I've used over the years.
The text was updated successfully, but these errors were encountered:
Thank for the suggestion 👍 This isn't possible as far as I know - after a replace, you can either go to the next result or the previous result but there's no command to replace and then stick to your last replace.
As mentioned in the issue template, the team isn't prioritizing new functionality at the moment, especially in cases where there are workarounds (though I understand the workarounds aren't ideal in this case as you mentioned, especially if you do this kind of find and replace often). Because of this and because we're trying to keep only tasks that need to be worked on in the issue list, I'm going to close the issue. But since I do see how this functionality could be useful with the use case you described, I'll share this with the other maintainers for you to see what they think.
Summary
I see a key mapping 'cmd-alt-e': 'find-and-replace:replace-next' to replace, then find the next match. I don't see a key mapping to replace (ONLY - don't move the cursor to the next match). If this feature does not exist, I'd like to have this added, such as 'cmd-alt-E': 'find-and-replace:replace' or 'cmd-ctrl-alt-e': 'find-and-replace:replace', so that if I know I'm replacing the last real match of an ambiguous pattern, but there may be other false matches further down the file, I don't have to reposition the view back to where the last replacement was done to continue editing.
Motivation
Earlier today I had to clone a section of YAML code then replace a single digit extension in numerous areas, such as One0 -> One8, Two0 -> Two8, ...; One1 -> One9, Two1 -> Two9, ... Many matches which changed one digit, so I was just switching between find-next and replace-next, as - due to the ambiguity - I was walking through matches one by one, often having to skip a false match. I had multiple sections where I had to repeat this far apart, with many sections where I would not want to accidentally replace this single digit in-between. Too much hassle and variance to try and use RegEx.
The problem which prompted a search for a "replace without attempting to find the next match" feature and perhaps key binding, was the last match in a known set, when I know changing from (for example, where there's a total of 16 places where I have to change this digit, all different) Sixteen0 -> Sixteen8, I want to replace 0 with 8, but then not move to the next 0 found arbitrarily down in the file. I'm forced to either hit Replace, then page up some unknown/unpredictable number of pages to get back to where the last change was made and where I needed to make other changes, or I have to manually overtype the character instead of pressing the Replace button or cmd-alt-e key combination.
It comes up a decent amount of times for me, so I was annoyed enough to check and see if there was some simple alternate key combination, like just cmd-ctrl-alt-e or cmd-alt-E, that would replace but then leave the cursor unmoved, same behavior as if there were no additional matches found.
What would be ideal, is if I could still hit the Replace button, but by also holding down the ctrl key, that would replace but stay put.
If there's some way to do this, I couldn't find it via Google search or looking through the keybinding code here.
Describe alternatives you've considered
Both work, but disrupt workflow. It seems like one should be able to do this easily. It's a feature in many other editors I've used over the years.
The text was updated successfully, but these errors were encountered: