Let's suppose I am editing a code in a particular cell of a jupyter notebook in VSCode. Then I search for something and it takes me to another cell somewhere on the notebook. How can I navigate back to the original cell without tediously searching for it with a slider? Any appropriate keys to do that?
I'm looking for a way to put a jupyter notebook cell in VSCode in interactive mode so that it runs the cell when its contents change without having to run it explicitly.
If there's no existing solution, is it somehow possible to automate executing the cell periodically or does the VSCode jupyter lab integration offer some scripting hooks?
Alternatively, is there a possibility to explicitly execute a cell without loosing the cell focus and its current cursor position? CTRL+Enter directly doesn't work; the tabulator key needs to be pressed four times additionally to get back to the cell.
Is there a way to enable smooth scrolling in vscode notebooks?
I'd like to use the up/down arrows to scroll through the notebook and not have it shift focus from cell to cell.
In Jupyter notebooks (webserver), it can be done by inserting the following code in the first cell:
%%javascript
Jupyter.keyboard_manager.command_shortcuts.remove_shortcut('up');
Jupyter.keyboard_manager.command_shortcuts.remove_shortcut('down');
Unfortunately, the same command does not work in vscode.
How do I enable it?
I have a cell (cell 39), I wish to move up to the top of cell 40.
I know I could grab and drag to the place. However, I see that in official document, you could move it with the vertical bar on the left. However, I does not have one, and could not find the setting to make it display.
Demonstration in Visual Code.
Jupyter Notebook in chrome version has a similar botton for this function
Jupyter Notebook web version.
According to https://github.com/microsoft/vscode-jupyter/issues/6812 you can use alt(option)+arrow up/down to move the selected cell.
Or, use Command Palette with Notebook: Move
How do I enable vertical scrolling in a code block in a jupyter notebook?
I've done it accidentally before, but now I can't reproduce it. What I found was set autoscroll = true in the file itself using a text editor...
However, I did that... and it already has a setting, "scrolled": true. In the notebook, it has only horizontal scrolling, so I guess that is what the "scrolled" setting modified.
In order to enable vertical scrolling in an output cell of the notebook, you just need to click to the left of the cell content (in the margin, you will see the area becomes slighty shaded when you are over it).
If you double click, the content of output cell will be hidden.
If you would like to hide the content of an input cell, see also Scroll windows for code in iPython (Jupyter) Notebooks?.
As suggested by #Mandy, to turn on horizontal scrolling in Jupyter code window just go to Cell>Current/All Outputs>Toggle Scrolling
You can try Cell -> Current Outputs -> Toggle Scrolling in the Jupyter UI to enable the scrolling for the output of one cell.
Run this code at the end of yours:
from IPython.display import display, HTML
js = "<script>$('.output_scroll').removeClass('output_scroll')</script>"
display(HTML(js))