41

In Jupyter notebook, cntrl+ m L toggles code line numbers in current cell but how to bring the code line numbers in JupyterLab?

Referred a similar issue opened in github

  • https://stackoverflow.com/questions/10979667/showing-line-numbers-in-ipython-jupyter-notebooks – Sadman Sobhan Mar 29 '18 at 04:14
  • @SadmanSobhan That is for notebooks and i already mentioned how to bring the line numbers in the question description. In the documentation for jupyter lab from here http://jupyterlab.readthedocs.io/en/stable/user/interface.html?highlight=Shortcuts, i couldn't find the shortcut keys for line numbers. – Saranraj Nambusubramaniyan Mar 30 '18 at 11:34

6 Answers6

57

https://github.com/jupyterlab/jupyterlab/issues/2395 - Shift+L toggles line number visibility.

Milan
  • 1,743
  • 2
  • 13
  • 36
ohailolcat
  • 891
  • 8
  • 13
52

you can turn this on by default by going into Settings --> Advanced Settings Editor:

enter image description here

As you can see from the screenshot, you can edit other features as well and easily set them back to default by deleting your 'User Overrides'

Go to Settings > Advanced configuration and add:

{
    "codeCellConfig": {
        "lineNumbers": true
    }
}
mando
  • 135
  • 1
  • 8
cyneo
  • 876
  • 7
  • 9
35

You can go to View -> Show Line Numbers:

enter image description here

which will display line numbers in the notebook:

enter image description here

Franck Dernoncourt
  • 77,520
  • 72
  • 342
  • 501
3

Late reply, but it'll still help others!

For Windows users, just hit Shift + L

Dharman
  • 30,962
  • 25
  • 85
  • 135
1

In your Jupyter Lab, click the chain, View -> Line numbers. This solution is from this GitHub issue.

Jiaxiang
  • 865
  • 12
  • 23
0

I'm new at this so don't flame me. But Frank said from View -> Show Line Numbers. I did this from main JupyterLab window. I'm using version 3.5.0.

Eric Kreipe
  • 51
  • 1
  • 2
  • Please, put it as a comment to Franck and cut it to minimum words (it's hard to navigate it back otherwise). Also, please make it clear if it worked for you. – Julia Meshcheryakova Dec 10 '22 at 21:15