Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to customize after installed? #14

Open
Scoodood opened this issue Apr 21, 2020 · 1 comment
Open

How to customize after installed? #14

Scoodood opened this issue Apr 21, 2020 · 1 comment

Comments

@Scoodood
Copy link

Just wondering how do I further customize the keymap after installed? For example I would like to change from

swapLineUp : Shift-Ctrl-Up
to
swapLineUp : Alt-Up

@ryantam626
Copy link
Owner

ryantam626 commented Apr 30, 2020

hi sorry for the late reply..
i didn't implement that feature, if you are comfortable with typescript you can fork this repo and customise it yourself.

here are some pointers,

  • this line changes the keymap to sublime for the active cell, you can add custom keymap to apply here

    (activeCell.editor as CodeMirrorEditor).setOption('keyMap', 'sublime');

  • to add custom keymap you probably need to follow https://codemirror.net/doc/manual.html#keymaps
    , you can access the codemirror instance by (activeCell.editor as CodeMirrorEditor).editor
    so something like

(activeCell.editor as CodeMirrorEditor).editor.setOption("extraKeys", {
  "Alt-Up": function(cm) {
    cm.execCommand("swapLineUp")
  }
});

might work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants