CM6 duplicateLine + toggleComment options?

Hello!

I am looking at migrating from CM5 to CM6. I used to have the sublime.js keymap, but I haven’t found a CM6 equivalent (although I suspect defaultKeymap does most of what I need). One key shortcut I really want to keep is duplicateLine. How would I go to add it?

As for toggleComment, I would really like it to not have any padding. Back in CM5, it was possible to specify { padding: '' }. Is this still doable in CM6?

Thanks!

The copyLineUp/Down commands might be what you’re looking for.

Comment padding is not currently configurable.

Thanks for the quick response! copyLineDown is exactly what I need. How would I go to add Ctrl+D to the extensions?

EDIT:

This works for me!

EditorState.create({
                doc: doc,
                extensions: [
                    python(),
                    tabSize.of(EditorState.tabSize.of(2)),
                    keymap.of([{key: 'Ctrl-d', run: copyLineDown}, indentWithTab, defaultKeymap]),
                    basicSetup,
                ],
            });

(Disclaimer: the current configuration appears to enable highlightSelectionMatches with Ctrl-d)

Thanks @marijn :slight_smile: