JupyterLabで行番号をデフォルト表示したい

【動機】

Jupyter Notebookの進化版であるJupyterLabで行番号をデフォルトで表示したい

【やり方】

  1. ⌘と,を同時押し、もしくは「Settings」→「Advanced Settings Editor」を開いて設定画面を開く

  2. Notebookを選択し、右側に

{
    "codeCellConfig": {
      "lineNumbers": true
    }
}

もしくは

{
    // Notebook
    // @jupyterlab/notebook-extension:tracker
    // Notebook settings.
    // **************************************

    // Code Cell Configuration
    // The configuration for all code cells.
    "codeCellConfig": {
      "insertSpaces": true,
      "lineHeight": null,
      "wordWrapColumn": 80,
      "fontSize": null,
      "lineNumbers": true,
      "tabSize": 4,
      "fontFamily": null,
      "autoClosingBrackets": true,
      "readOnly": false,
      "matchBrackets": true,
      "lineWrap": "off"
    },

    // Markdown Cell Configuration
    // The configuration for all markdown cells.
    "markdownCellConfig": {
      "insertSpaces": true,
      "lineHeight": null,
      "wordWrapColumn": 80,
      "fontSize": null,
      "lineNumbers": false,
      "tabSize": 4,
      "fontFamily": null,
      "autoClosingBrackets": false,
      "readOnly": false,
      "matchBrackets": false,
      "lineWrap": "on"
    },

    // Raw Cell Configuration
    // The configuration for all raw cells.
    "rawCellConfig": {
      "insertSpaces": true,
      "lineHeight": null,
      "wordWrapColumn": 80,
      "fontSize": null,
      "lineNumbers": false,
      "tabSize": 4,
      "fontFamily": null,
      "autoClosingBrackets": false,
      "readOnly": false,
      "matchBrackets": false,
      "lineWrap": "on"
    }
}

これを貼り付ける。

f:id:bnbnp:20190213221357p:plain

3. 右上のボタン、もしくは⌘+sで上書き保存してJupyterLabを再起動。