jupyter使用sublime快捷键

添加sublime的快捷键

~/.jupyter/custom下有custom.css custom.js fonts

修改custom.js中,添加如下代码:


require(["codemirror/keymap/sublime", "notebook/js/cell", "base/js/namespace"],
    function(sublime_keymap, cell, IPython) {
        cell.Cell.options_default.cm_config.keyMap = 'sublime';
        var cells = IPython.notebook.get_cells();
        for(var cl=0; cl< cells.length ; cl++){
            cells[cl].code_mirror.setOption('keyMap', 'sublime');
        }
    }
);

自定义sublime的快捷键

修改keymap路径~/anaconda3/lib/python3.6/site-packages/notebook/static/components/codemirror/keymap/sublime.js

如果找不到,相应的查找一下计算机中sublime.js的路径。

修改下面的kepmap,修改成自己习惯的按键方式:


keyMap.macSublime = {

// "Cmd-D": "selectNextOccurrence",
// "Shift-Cmd-D": "duplicateLine",
"Cmd-D": "duplicateLine",
// "Cmd-Ctrl-Up": "swapLineUp",
"Shift-Cmd-Up": "swapLineUp",
// "Cmd-Ctrl-Down": "swapLineDown",
"Shift-Cmd-Down": "swapLineDown",

}

pass

你可能感兴趣的:(jupyter使用sublime快捷键)