Jupyter Notebook is equipped with numerous extensions and shortcuts which assist a lot of programmers, developers in their everyday operations. Such operations could be like doing data analysis of every single document comprising of computational explanatory text or adding easy links for common libraries like Pandas or Matplotlib. Moreover, all those shortcuts sound useful when it comes to making members of the programming community more efficient and productive thereby saving their countless hours with utmost flexibility. Want to feel flexibly productive while walking on the path of becoming an aspiring Python developer with decent Jupyter Notebook Skills?
Of course, you can’t deny this and for that, it is essential to get well-versed with the concept used by every chunk of Python code and also, encourage yourself towards learning about the powerful sequence of Jupyter Notebook cells which when activated, can edit textual content as per your requirements anytime, anywhere. Without taking more time, let’s know about those easy-to-use Jupyter Notebook shortcuts and extensions that you may consider using to work well with the development environment of any version of Notebook.
10 Interesting Jupyter Notebook Shortcuts and Extensions:
1. Shortcuts for Edit Mode
The Edit Mode in Jupyter Notebook gets activated as soon as you click into your Jupyter cell. The prime motive of using this functional mode is to not only enter but also edit the textual content of a cell highlighted. Thinking about how to determine if I entered Jupyter’s edit mode? You will see a green-colored cell border while typing in a particular cell.
Otherwise, you can enter this mode by pressing the enter button on your keyboard followed by clicking on a cell. And later, you may try these below-mentioned shortcuts for Edit mode in Jupyter Notebook:
- Shift + Tab: For enabling tooltip feature so that it can provide explanations about the attached active elements.
- Ctrl + Z: A shortcut that allows us to cancel/reverse the previously executed Jupyter commands.
- Ctrl + Left: A shortcut that lets your cursor move one word leftwards.
- Ctrl + End: A shortcut that lets your cursor move to the endpoint of the Jupyter cell.
2. Shortcuts for Command Mode
The Command Mode in Jupyter Notebook uses well your keyboard shortcuts and translates them well into notebook-level actions. You may now ponder what these notebook-level actions are? So, these are nothing but the higher-level actions (like constructing a newer Jupyter Notebook Panel densely populated with widgets and toolbars) accommodated in the NotebookActions space.
But before you access the power of such notebook-level actions, you must ensure whether the border of the available cell is green along with a blue left margin. This will confirm the presence of Command Mode so that we may proceed ahead trying the listed-below shortcuts:
- Shift + V: a shortcut with which you may affirmingly paste Jupyter cells below.
- Alt + Enter: a shortcut that lets you run the current cell, then insert another one below if required.
- Shift + Enter: a shortcut that lets you run the current cell, then select another one if required.
- ESC: a shortcut to enter the command mode
- Ctrl + S: a shortcut for updating both the Jupyter notebook and checkpoint files comprising of variable length records.
3. Some Magic Shortcuts
Magic Shortcuts or Magic commands in Jupyter both are the same and can significantly upgrade the capabilities of your Jupyter Notebook. From opening the Jupyter scripts to exporting IPython history in an error-free manner, all this is performed well by these magically competitive shortcuts. Moreover, you can work well in an auto-saving way with many of the external files accessed anytime, anywhere within a Jupyter Notebook.
Before you get started with such magically brilliant shortcuts, take a look at them to select well a range of Jupyter cells when viewed vertically or horizontally: –
- % load file.py: a magic shortcut for letting you insert a highly extensible script into a Jupyter cell.
- % run file.ipynb: a magic shortcut that lets you run Jupyter Notebook on laptops, desktops.
- % pycat file.py: a magic shortcut that lets you open a Jupyter script in the pager which later displays text output when called.
conda install -c conda-forge jupyter_contrib_nbextensions
conda install -c conda-forge jupyter_nbextensions_configurator
We can also install using pip:
pip install jupyter_contrib_nbextensions
Contemplating what they may do to your Jupyter Notebook? From changing the font size of the visible code snippets to accessing the benefits of multi-language support in Jupyter Notebook, all this can be done in real-time by the hidden add-ons of nbextensions. A few of them which can play nicely with documents of your open-source Jupyter Notebook:
- Code Font Size: a useful nbextension that adds on-time various toolbar buttons for decreasing or increasing the code’s font size.
- Notify a useful nbextension for displaying the web notifications onto your screens at the top-right corner of your Jupyter Notebook.
- Printview: a useful nbextension for adding a toolbar button and calling Jupyter nbconvert. Later, Jupyter nbconvert lets you convert files of extensions like .py, .ipy into the ones known as .pdf, .htm, and many more.
- Snippets Menu: a useful nbextension for adding customizable menu items onto your Jupyter Notebooks. Afterward, those items can be used to push examples of code, boilerplate codes (repeatable sections of codes for your Jupyter Notebook which demand no or minimal supervision), and snippets too.
- nb Translate: a useful nbextension for converting/translating the language of selected Jupyter Notebook cells like from French to English. In addition, such a helpful translation in multiple languages ensures that every user can understand the format of communication the currently selected Jupyter cells are using.
5. toc extension
A toc extension lets you generate a navigable and collapsed table of contents just by clutching all the headlines from your currently visible Jupyter Notebook markdown cells. Marked as unofficial in the list of available Jupyter Notebook extensions, you still have a chance to resize or drag the contents present in the table of this multi-purpose, precise, and enumerative extension.
What else is now required to access different types of content present in a source file opened up in your Jupyter Notebooks with unique id links along with the display of available minor tweaks related to menus and cells running well inside your Jupyter Notebooks?
6. Command Palette
The Command Palette is a centralized command system that can be used plus shared throughout your Jupyter Notebook. Supposing how will you identify this command system? After you open your Notebook and use the command Command/Ctrl + Shift + C or Command + Shift + P, you can see a search bar along with a filter (whose appearance is like a tea strainer) used by Google.
As you move the mouse cursor for finding commands like contextual help, etc. the keyboard-driven way of Command Palette presents in front of your screens various useful features stored within its command system. But before you use those commands (by hitting the H key), just know more about these below tips which you should be keeping in mind:
- ^↑ Tab: This tip (for command palette) will cycle/take you through the last set of files already open.
- ^G: This tip (for command palette) will allow you to reach/navigate to a specific line in a file.
7. Text Editor Syntax Highlighting
The Text Editor Syntax Highlighting shortcut located after the View option enables highlighting of code in accordance with the syntax rules. Through this, you may expect a well-manned display of your Jupyter Notebooks’s scripting or markup languages in variable colors and fonts thereby making the code snippets easier to understand and read for programmers, and normal readers too. Let’s now know a bit about how to identify this shortcut:
- Use your cursor and move it to the option after Edit.
- Now, from the option above show log console, you may easily find Text Editor Syntax highlighting. As soon as you keep the cursor over there, you will find options like CQL, GSS, Django, Dart, etc.
- Choose any of those options and start making the code snippets.
8. The Kernel Menu
The Kernel Menu actively runs the code of your Jupyter Notebook cell without being inefficient while managing the hardware and software operations. To find it, you can proceed ahead with searching the View tab followed by Kernel. There, you will find multiple options starting from interrupt to change. And all of them are equally important when it comes to running the code efficiently and scalably. Let’s take an overview of those:
- Interrupt Kernel: a feature for altering well the normal code execution in your Jupyter Notebooks. [Use this keyboard shortcut- Esc + i i]
- Restart Kernel: a feature that can stop the kernel instantaneously so that it may start again well. [Use this keyboard shortcut Esc + 0 0]
- Shutdown Kernel: a feature that shuts the current kernel down so that a different kernel can be prepared. [Use mouse as a shortcut and click Kernel option, then, in the end, click the Shutdown Kernel option].
- Change Kernel: a feature that lets you switch various kernels so that you may select one of your choices. [You will find this in the Kernel option written at last].
9. Export Notebook
The Export Notebook is an option present at File Menu and you can identify it by Export Notebook as. Estimating the capability of this export Jupyter notebook option while choosing an export format? See, with this option, you may promisingly export your Notebook files like .ipynb to formats such as .asciidoc, .html, .pdf, .md, & .html. Does this not sound technically appealing and beneficial from a user’s point of view? Yeah, this option is more of a shortcut for various file formats and lets you select various types of cells present in your Notebook after you:
- Move your mouse course to File Menu.
- Then, after the Trust Notebook, you will find Export Notebook as. Here, you will point the cursor and then, select the format type with any of the exporting options available.
With all the above steps, you may now introduce yourself to many of the unknown exporting options safer to use from the security point-of-view and also, better for accessing the already-created appealing visuals either of .HTML or .rst.
10. Auto-Indent Lines
Indentation is very important from a programming point of view as this designates the logical blocks of code snippets running well in your Jupyter Notebooks. Imagine if this indentation lets you auto-indent lines of Jupyter codes!! Without any further doubt, you can do this by applying the strokes on your keyboard as
Ctrl + Alt + I
Hurrah!!! All the lines of your Jupyter snippets must have realigned themselves as required. But apply this only at times you are editing cells in your Jupyter Notebooks.
Share your thoughts in the comments
Please Login to comment...