lambdalisue/jupyter-vim-binding

Customization help

Open

#63 opened on 2016年3月25日

GitHub で見る
 (7 comments) (0 reactions) (0 assignees)JavaScript (2,062 stars) (139 forks)batch import
bugenhancementhelp wantedquestion

説明

Summary

Request for some additional explanation regarding customization

Environment

  • Operating system : (e.g. Ubuntu 14.04 64bit)
  • Web browser : (e.g. Firefox 45)
  • Version or revision of Jupyter Notebook : (e.g. 4.2.2)
  • Revision of jupyter-vim-binding : (e.g. 3e4030d)

Difficulties

I am not familiar with JavaScript, its libraries and the technology surrounding it. Advice on how to organize customization code would be very helpful. Thanks in advance.

Order of loading

If I understand correctly, customization Code should be run after the vim-bindig extension has been loaded. But it's not clear to me how to achieve a certain order. From what I can see, custom.js is executed first, then extensions are loaded.

I tried following this guide http://akuederle.com/customize-ipython-keymap to create an extension for additional key bindings and force it to load after vim-binding. The following code in my custom.js produces the desired order most of the time.

require(['base/js/utils'],
function(utils) {
    utils.load_extensions('vim_binding/vim_binding');
    setTimeout(function() {
        console.log("additional");
        utils.load_extensions('additional_shortcuts');
}, 3000);
});

What's the correct way to do it?

Customizing the design by putting code into ~/.jupyter/custom/custom.css has no effect. I assume it's because those settings are overridden once the vim-binding is loaded.

CodeMirror Vim Mode

I would also like to ask for help with customizing the CodeMirror's Vim Mode. My additional_shortcuts.js contains

require(['nbextensions/vim_binding/vim_binding'], function() {
    CodeMirror.Vim.defineOperator("comment_op",
                                  function(cm) { cm.toggleComment(); });
    CodeMirror.Vim.mapCommand("gc", "operator", "comment_op", {});
});

which works fine to toggle comments on a selection or a text object. Is there a way to add a mapping gcc that would toggle comments on current line, or is the common prefix gc a problem? I tried with map and defineAction but they we not called.

How to provide a Ctrl-c insert mode mapping to return to normal mode? This does not work.

CodeMirror.Vim.map("<C-c>", "<Esc>", "insert");

コントリビューターガイド

Customization help · lambdalisue/jupyter-vim-binding#63 | Good First Issue