We should add an option to paste and switch the slashes around #19480

Open
opened 2026-01-31 06:44:40 +00:00 by claunia · 2 comments
Owner

Originally created by @zadjii-msft on GitHub (Mar 3, 2023).

This was in a mail thread earlier this week:

Say that I copy this path
onecore/foo/bar/baz.dll

I want it to end up like this:
onecore\foo\bar\baz.dll

Or vice versa. Is there a specific keyboard shortcut that would allow me to translate the path in the clipboard to the final format easily, without having to pop into an editor and an S&R?

At first I was like "I mean that's kinda silly"

But I've had to copy/paste paths out of git status back into del commands a few times since then and you know what? I think this is a good idea now.

Questions:

  • What do we name it?
  • Do we support \ -> /?
  • Presumably we don't want to do this just for paths, since onecore/foo/bar/baz.dll might not be a local path we can sanitize. In fact let's not confuse this with path sanitation at all
  • this is literally just "replaceSlashes": "\"
Originally created by @zadjii-msft on GitHub (Mar 3, 2023). This was in a mail thread earlier this week: > Say that I copy this path > `onecore/foo/bar/baz.dll` > > I want it to end up like this: > `onecore\foo\bar\baz.dll` > > Or vice versa. Is there a specific keyboard shortcut that would allow me to translate the path in the clipboard to the final format easily, without having to pop into an editor and an S&R? > At first I was like "I mean that's kinda silly" But I've had to copy/paste paths out of `git status` back into `del` commands a few times since then and you know what? I think this is a good idea now. Questions: * What do we name it? * Do we support `\` -> `/`? * Presumably we don't want to do this just for _paths_, since `onecore/foo/bar/baz.dll` might not be a local path we can sanitize. In fact let's not confuse this with path sanitation at all * this is literally just `"replaceSlashes": "\"`
claunia added the Area-SettingsIssue-TaskProduct-Terminal labels 2026-01-31 06:44:40 +00:00
Author
Owner

@malxau commented on GitHub (Mar 5, 2023):

I thought it was a bit of a pandora's box, because slashes are backwards for a reason:

  • Moving paths between Windows and WSL, which requires namespace munging, not just separators
  • Moving paths from a browser, which requires removing file:/// and converting % characters

Worse, the desired separator is determined by the program receiving the string, which is why the original request suggested a different key modifier - it can't be a global setting.

What I tried to do with my tools was accept as many types of path as possible to reduce the need to convert things, but that's obviously limited in scope. It does mean not having to think about paths from git status to del though.

@malxau commented on GitHub (Mar 5, 2023): I thought it was a bit of a pandora's box, because slashes are backwards for a reason: - Moving paths between Windows and WSL, which requires namespace munging, not just separators - Moving paths from a browser, which requires removing file:/// and converting % characters Worse, the desired separator is determined by the program receiving the string, which is why the original request suggested a different key modifier - it can't be a global setting. What I tried to do with my tools was accept as many types of path as possible to reduce the need to convert things, but that's obviously limited in scope. It does mean not having to think about paths from git status to del though.
Author
Owner

@ForbiddenEra commented on GitHub (Mar 18, 2023):

Perhaps this would be better implemented as some sort of PowerToys add-on -- clipboard REGEX with options / profiles based on application and/or a modifier to the shortcut (eg. ctl+shift+v will swap) or a different shortcut.

As for making it a global "replaceSlashes":"\" option, I kinda -1 this as while it's useful in a path-related situation, anyone who pastes code or scripts could have major issues if they forget that it's on or don't understand the feature.

Unless you were going to parse every copy/paste, try to identify whether it's a path or not and then potentially make changes but I also feel like this is potentially wasted resources; I'm not sure if I want my clipboard contents to be parsed and interpreted every copy or paste - especially since at least for myself, it's insanely rare where I'd need to do any slash swapping.

However, if I used a different hotkey or modifier expecting that, it might be useful and I'm sure others would find other potentially useful cases if it was simply a regex thing, applied on either copy or paste, depending on focused program or a separate/modified hotkey - this would be perfect as a new PowerToys plugin!

In fact, if I was much of a Windows developer, I'd already have started writing one.

@ForbiddenEra commented on GitHub (Mar 18, 2023): Perhaps this would be better implemented as some sort of PowerToys add-on -- clipboard REGEX with options / profiles based on application and/or a modifier to the shortcut (eg. ctl+shift+v will swap) or a different shortcut. As for making it a global `"replaceSlashes":"\"` option, I kinda -1 this as while it's useful in a path-related situation, anyone who pastes code or scripts could have major issues if they forget that it's on or don't understand the feature. Unless you were going to parse every copy/paste, try to identify whether it's a path or not and then potentially make changes but I also feel like this is potentially wasted resources; I'm not sure if I want my clipboard contents to be parsed and interpreted every copy or paste - especially since at least for myself, it's insanely rare where I'd need to do any slash swapping. However, if I used a different hotkey or modifier expecting that, it might be useful and I'm sure others would find other potentially useful cases if it was simply a regex thing, applied on either copy or paste, depending on focused program or a separate/modified hotkey - this would be perfect as a new PowerToys plugin! In fact, if I was much of a Windows developer, I'd already have started writing one.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#19480