Enable word wrap in JupyterLab code editor
Asked Answered
G

4

18

I would like to enable word wrap for the code cells in jupyterlab, but do not manage to find how.

Already tried:

  • File --> Settings --> Text Editor --> User Overrides:{"lineWrap": true}, which toggles the greyed-out "word wrap" in the "Editor" menu, but does not solve my problem
  • This code also did not work (neither did simply "Cell": {...} ):
"CodeCell": {
    "cm_config": {
      "lineWrapping": true
    }
  }
Gunar answered 11/1, 2018 at 8:4 Comment(0)
B
13

Try the following,

{
   "codeCellConfig": {
      "lineWrap": "wordWrapColumn",
      "wordWrapColumn": 80
   }
}

For reference, see this pull request from the JupyterLap project on GitHub.

Box answered 2/10, 2018 at 11:29 Comment(4)
I guess this was implemented since January. Just "lineWrap": "on" did the trick for me, but generally your answer is correct. Thank you for the reminder.Gunar
Any chance that you know how to enable text wrapping on google colaboratory jupyter notebook? I have updated to the latest notebook: (5.7.8) but no text wrap option on text output is available on colaboratory.Garratt
Sorry, but I can't help you there.Box
This thread helped me to figure out where to put the settings.Countermove
B
8

Here is how I solved it :

Settings -> Advanced Settings Editor -> Notebook to user preferences add

{"codeCellConfig": {
        
        "lineWrap": "on",
        
    },}
Blameless answered 7/10, 2021 at 20:57 Comment(0)
E
3

Working as of 1 May 2022 for JupyterLab v3.2.1

I feel that the answer above is not clear enough, and hope to provide a quick solution for those who visit this page in the future.

How to enable word wrap in JupyterLab

  1. Click on Settings > Advanced Settings Editor > Select Notebook (at the sidebar)
  2. On the User Preferences tab, enter the following to enable word wrap
{
    "codeCellConfig":{
         "lineWrap": "on"
    }
}

Before

enter image description here

After

enter image description here

Eta answered 1/5, 2022 at 4:47 Comment(0)
M
0

you can copy and past this code:

, "codeCellConfig":{ "lineWrap": "on"
}

in this path in your PC :

Users\pcname.jupyter\lab\user-settings@jupyterlab\notebook-extension\tracker.jupyterlab-settings

also you should restart your Jupyter

just this :)

Mayberry answered 2/6 at 20:33 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Mycetozoan

© 2022 - 2024 — McMap. All rights reserved.