Atom/Sublime like Multiple selections in Jupyter

后端 未结 2 2023
盖世英雄少女心
盖世英雄少女心 2021-02-07 05:33

How can I select matching keywords in a Jupyter notebook via a keyboard shortcut? For example, in the Atom/Sublime editor I can hit cmd + D on a mac (or Ctrl

2条回答
  •  佛祖请我去吃肉
    2021-02-07 06:25

    The above solution worked for me, but I found that it had the undesirable effect of entering a "tab" character when I hit enter. Here is the associated GitHub issue: https://github.com/jupyter/notebook/issues/4769#issuecomment-511935127

    Per that post, I found that this solution gives the right ctrl + d behavior, and keeps tabs-as-spaces.

    require(["codemirror/keymap/sublime", "notebook/js/cell", "base/js/namespace"],
        function(sublime_keymap, cell, IPython) {
            // setTimeout(function(){ // uncomment line to fake race-condition
            cell.Cell.options_default.cm_config.keyMap = 'sublime';
            var cells = IPython.notebook.get_cells();
            for(var c=0; c< cells.length ; c++){
                cells[c].code_mirror.setOption('keyMap', 'sublime');
            }
            // }, 1000)// uncomment  line to fake race condition 
        } 
    );
    

提交回复
热议问题