lambdalisue / jupyter-vim-binding

Jupyter meets Vim. Vimmer will fall in love.
2.1k stars 136 forks source link

How can I map command + b to run cell, insert below in vim normal mode #150

Open wsh3776 opened 4 years ago

wsh3776 commented 4 years ago

The original shortcut is option + Enter, Can I change it to command + b

I have tried the following code, but it doesn't work, can you help me. Or can you give me more example of how to map in custom.js

// run cell, insert below

require([
  'nbextensions/vim_binding/vim_binding',
  'base/js/namespace',
], function(vim_binding, ns) {
  // Add post callback
  vim_binding.on_ready_callbacks.push(function(){
    var km = ns.keyboard_manager;
    // Allow Ctrl-2 to change the cell mode into Markdown in Vim normal mode
    km.edit_shortcuts.add_shortcut('<C-b>', 'vim-binding:run-cell-insert-blow', true);
    // Update Help
    km.edit_shortcuts.events.trigger('rebuild.QuickHelp');
  });
});