Simple productivity improvements while working in a jupyter environment.
So while writing a code we usually would love to do the same task with minimum time and maximum effectiveness so here we can change a simple habit of touching the mouse for usual clicks and replace that with the keyboard shortcuts.
I am going to list some handy shortcuts that can make your process of writing code fast, that being said let's get to the main content.
Basically, we need to understand two different states of jupyer environment.
Command mode: in simple words command mode is something where the cell is not active, you can't write or edit something when you're in this mode.
Edit mode: Simply edit mode just let you edit your cell or write your code.
you can switch between these two modes by ESC (for Command mode) ENTER (for edit mode)
on this foundation all of the shortcuts works, whenever you're in the edit mode no shortcut will work, you have to be in command mode to use the shortcuts.
Frequently used shortcuts
a = insert cell above
b = insert cell below
dd = delete cell (you need to press 'd' two times)
z = to undo your previous action.
c = copy the particular cell
v = paste the copied cell
Code execution shortcut
these all are enough to make you productive enough until your subconscious gets used to these keys there will be a bit of struggle.
let's understand another simple yet time-saving keyboard shortcut, to run the code some people usually use CTRL + ENTER or SHIFT + ENTER but there is a difference between those two.
when we use:
CTRL + ENTER: execution of code gets completed, and you stay at the same cell.
SHIFT + ENTER: execution of code gets completed, and you move to the next cell.
this little understanding can save seconds daily eventually hours in long run.
Some other shortcuts
when you are in the command mode and want to convert a cell into code or markdown simply press:
y = turn markdown into code
m = turn code into markdown
i = interrupt the kernel (when code is stuck in some processes)
Alright, now you know a bunch of shortcuts that can be the foundations to write a code in most effective and fast manner, this is it for now.
I hope you had fun reading this article, and you found everything easy to understand. If you need further information on any topic, let me know in the response.
Thanks for reading small introductory stuff on jupyter environment, if you are interested in more stuff you will be added to the mailing list once you subscribe to the newsletters...
Did you find this article valuable?
Support Shreyas Kulkarni by becoming a sponsor. Any amount is appreciated!