How do I change the autoindent to 2 space in IPython notebook

The official documentation has an example answering this specific question. This worked for me with IPython 4.

Summary: Paste the following into your browser’s javascript console

var cell = Jupyter.notebook.get_selected_cell();
var config = cell.config;
var patch = {
      CodeCell:{
        cm_config:{indentUnit:2}
      }
    }
config.update(patch)

The setting is persisted. You can roll back by exchanging : 2 for : null.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)