move commentSelection command to other editing commands
This commit is contained in:
parent
6e8ff5b9ef
commit
2c86f2f4b9
|
@ -38,10 +38,6 @@
|
||||||
|
|
||||||
Object.assign(CodeMirror.defaults, defaults, prefs.get('editor.options'));
|
Object.assign(CodeMirror.defaults, defaults, prefs.get('editor.options'));
|
||||||
|
|
||||||
CodeMirror.commands.blockComment = cm => {
|
|
||||||
cm.blockComment(cm.getCursor('from'), cm.getCursor('to'), {fullLines: false});
|
|
||||||
};
|
|
||||||
|
|
||||||
// 'basic' keymap only has basic keys by design, so we skip it
|
// 'basic' keymap only has basic keys by design, so we skip it
|
||||||
|
|
||||||
const extraKeysCommands = {};
|
const extraKeysCommands = {};
|
||||||
|
@ -64,7 +60,7 @@
|
||||||
// 'vim' and 'emacs' define their own autocomplete hotkeys
|
// 'vim' and 'emacs' define their own autocomplete hotkeys
|
||||||
}
|
}
|
||||||
if (!extraKeysCommands.blockComment) {
|
if (!extraKeysCommands.blockComment) {
|
||||||
CodeMirror.keyMap.sublime['Shift-Ctrl-/'] = 'blockComment';
|
CodeMirror.keyMap.sublime['Shift-Ctrl-/'] = 'commentSelection';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (navigator.appVersion.includes('Windows')) {
|
if (navigator.appVersion.includes('Windows')) {
|
||||||
|
|
|
@ -17,10 +17,15 @@ onDOMscriptReady('/codemirror.js').then(() => {
|
||||||
toggleEditorFocus,
|
toggleEditorFocus,
|
||||||
jumpToLine,
|
jumpToLine,
|
||||||
nextEditor, prevEditor,
|
nextEditor, prevEditor,
|
||||||
|
commentSelection,
|
||||||
};
|
};
|
||||||
// reroute handling to nearest editor when keypress resolves to one of these commands
|
// reroute handling to nearest editor when keypress resolves to one of these commands
|
||||||
const REROUTED = new Set([
|
const REROUTED = new Set([
|
||||||
...Object.keys(COMMANDS),
|
'save',
|
||||||
|
'toggleStyle',
|
||||||
|
'jumpToLine',
|
||||||
|
'nextEditor', 'prevEditor',
|
||||||
|
'toggleEditorFocus',
|
||||||
'find', 'findNext', 'findPrev', 'replace', 'replaceAll',
|
'find', 'findNext', 'findPrev', 'replace', 'replaceAll',
|
||||||
'colorpicker',
|
'colorpicker',
|
||||||
]);
|
]);
|
||||||
|
@ -199,6 +204,10 @@ onDOMscriptReady('/codemirror.js').then(() => {
|
||||||
}, {value: cur.line + 1});
|
}, {value: cur.line + 1});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function commentSelection(cm) {
|
||||||
|
cm.blockComment(cm.getCursor('from'), cm.getCursor('to'), {fullLines: false});
|
||||||
|
}
|
||||||
|
|
||||||
function toggleEditorFocus(cm) {
|
function toggleEditorFocus(cm) {
|
||||||
if (!cm) return;
|
if (!cm) return;
|
||||||
if (cm.hasFocus()) {
|
if (cm.hasFocus()) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user