Ask Your Question

hotkey to swap backslashes with forward slashes?

asked 2022-09-05 16:33:48 -0600

frueter's avatar

Hi, I am bouncing between all major operating systems all the time and often need to copy/paste file paths into my code for testing. Windows' backslashes have always driven me up the all and I know I can just use raw strings to use them as-is in my python code. But I would much prefer to swap them for forward slashes instead. I can obviously seatch and replace but was wondering if this could be set up as a macro of sorts and tied to a hotkey?

Cheers, frank

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2022-09-06 08:06:34 -0600

You can write a script to do this -- take a look at remove_prompts_and_paste() in scripts/ in Wing's installation directory. That's close to what you want. You can make your own scripts file in scripts/ (or any *.py file name) in your Settings Directory (listed in WIng's About box), add your script there, and then do Edit > Reload All Scripts to make it available in Wing. Reload All Scripts is only needed if you added a script file; after that WIng auto reloads changed script files so you can edit, save, and immediately test. You can invoke that script from Edit > Command by Name or bind a key to it in the User Interface > Keyboard > Custom Key Bindings preference.

For more info on extending Wing with Python scripts, see

edit flag offensive delete link more


Perfect, thanks!

frueter's avatar frueter  ( 2022-09-07 02:51:12 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2022-09-05 16:33:48 -0600

Seen: 45 times

Last updated: Sep 07 '22