Reputation: 8152
There's an option in Jupyter Notebooks where you can select some cells, and then hit F, which opens up a Find & Replace feature.
This shortcut doesn't work in Jupyter Lab. It's not in the Commands list and it's not in the Edit Menu (there is only Find -- and Find Next and Find Previous). Nor can I find a global (not specific to a cell selection) Find & Replace feature.
Does this feature exist? I've found old mentions of it on the internet -- has it been removed? I'm using Jupyter Lab version 1.2.3.
Upvotes: 79
Views: 59428
Reputation: 15439
The Find & Replace feature was not removed, but the way it is named in the menu (simply Find...
) and the UI which requires the user to click on a small arrow to access it may be confusing. Please see the GIF below which demonstrates how to use the search & replace feature:
If you need a slightly more powerful refactoring tool (i.e. distinguishing the variable scopes) you may want to check out my jupyterlab-lsp
project which now includes support for the rename action (see here for a demonstration GIF, but please install a newer version, not the tag linked).
Upvotes: 140
Reputation: 85
I am not sure if the original question was answered correctly. If I were to find and replace in only a selected cell, the top rated solution doesn't seem to work (in JupyterLab). The desired result is obtained by clicking on the ...
button in the F&R menu. Check the attached snippet.
Upvotes: 4
Reputation: 109
It can be easily done using keyboard in Jupyter as well.
Step 1: If you are inside any code block/cell, press Esc.
Step 2: Press F
Upvotes: 1