How do you use replace in Spyder?

后端 未结 5 1870
终归单人心
终归单人心 2021-02-05 00:59

Well, you start with cursor on your text, Ctrl+H and type replacement. But surprisingly i was not able to found any shorcut for actual replace or replace a

相关标签:
5条回答
  • 2021-02-05 01:35

    I have the same issue with Spyder, I don't know why this has not been implemented in the editor.

    The work around I currently have for multiple replace is to :

    1. Copy the replacement term to the clipboard

    2. Search(Find/Replace) for the term to replace

    3. Use F3 to select the next term

    4. Use paste Ctrl+V to replace it

    5. Back to step [3] to find the next term

    Hope this helps!

    EDIT:

    According to Spyder dev @carlos below. Since v3.2 This has now been implemented and you may just press and move to the next term.

    0 讨论(0)
  • 2021-02-05 01:37

    The shortcut for replace is Ctrl + R.

    0 讨论(0)
  • 2021-02-05 01:44

    (Spyder developer here) Since Spyder 3.2 you will be able to press Enter in the replace field to replace the current selection and automatically move to the next one.

    0 讨论(0)
  • 2021-02-05 01:56

    Why just not use Notepad++?

    In spyder editor, select the entire code (Ctrl+A), copy it (Ctrl+C) and paste it (Ctrl+V) into Notepad++. Then hit Ctrl+F, click on the "Replace" tab/menu (or you can use Tab to navigate) on the window that opens, write the string/value you want to find/replace, write the string/value you want to replace with, hit replace (or replace all: Alt+A; it will replace in the entire code). Do it as many times as you want/need - depending on how many unique values/strings you want to replace in the code. At any stage you can do Ctrl+Z to undo some actions or move the code from spyder editor to Notepad++ again (if you need to). Finally, select all, copy and paste it in the spyder editor and you're done.

    It would be nice if spyder had this functionality implemented since it'd speed up the process but until then you can use this workaround. That's what i do also.

    Video on how to do it (not mine): https://www.youtube.com/watch?v=I6-7GBY0ZHY

    0 讨论(0)
  • 2021-02-05 02:00

    Are you on MacOS? There is an issue on github suggesting that the CMD+H shortcut is assigned to "hide spyder". An update will bind CMD+R as a replacement. As this has just been merged, it will take a few days before a dmg is available for MacOS. In the meantime you can go to Preferences --> Keyboard shortcuts --> editor: replace text and change the shortcut binding.

    Reference:

    https://github.com/spyder-ide/spyder/issues/2914

    0 讨论(0)
提交回复
热议问题