-
Notifications
You must be signed in to change notification settings - Fork 293
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 use my own keyboard shortcuts when coding with notebook? #1447
Comments
Sorry but most of the custom editor settings do not apply yet to the Jupyter notebook editors. They aren't being hosted inside of VS code, but inside of a separate process that uses an editor that looks a lot like VS code's. We need to port all of the functionality for VS code over to this new editor before it will work there as well. Can you list out all of your editor customization settings? This way we can prioritize ones that people are using. |
@rchiodo Hi, same for me... My key bindings alow me to almost never touch my mouse nor the arrow keys (basically, I avoid everything which makes me move my hands ...). My keybindings.json file: https://pastebin.com/s8RkafPp |
|
Sorry but most of the VS code shortcuts are not supported. We hope to either reimplement all keyboard shortcuts (where possible) or possibly VS code will take ownership of rendering notebooks themselves (wherein a notebook would be just like any other document). |
That's unfortunate. I think VSCode + notebook + shortcuts would be a supreme tool for fast data-science-y projects dev speed. |
Related: microsoft/vscode#82495 (adding here because I found that issue first and had to do more detailed searching to get to this one) |
Would love to just be able to Cmd+A to Select All in a cell. Also Cmd+Shift+Arrow to select everything before or after cursor. Those ones are huge for me personally. |
It works in edit mode for me. |
I have all my Jupyter notebook keybindings in the following file // CodeMirror API - https://codemirror.net/doc/manual.html#api
require(["codemirror/keymap/sublime", "notebook/js/cell", "base/js/namespace", "codemirror/lib/codemirror"],
function(sublime_keymap, cell, IPython, CodeMirror) {
cell.Cell.options_default.cm_config.keyMap = 'sublime';
cell.Cell.options_default.cm_config.extraKeys["Cmd-Enter"] = function(cm) {}
cell.Cell.options_default.cm_config.extraKeys["Cmd-7"] = function (cm) {
// Delete the part of the line before the cursor.
CodeMirror.commands.toggleComment(cm);
};
cell.Cell.options_default.cm_config.extraKeys["Cmd-F7"] = function (cm) {
// Delete the part of the line before the cursor.
CodeMirror.commands.delLineLeft(cm);
};
cell.Cell.options_default.cm_config.extraKeys["Cmd-F8"] = function (cm) {
// Delete the whole line under the cursor, including newline at the end.
CodeMirror.commands.deleteLine(cm);
};
cell.Cell.options_default.cm_config.extraKeys["Cmd-F9"] = function (cm) {
// Delete the part of the line after the cursor. If that consists only
// of whitespace, the newline at the end of the line is also deleted.
CodeMirror.commands.killLine(cm);
};
var cells = IPython.notebook.get_cells();
for(var cl=0; cl< cells.length ; cl++){
cells[cl].code_mirror.setOption('keyMap', 'sublime');
cells[cl].code_mirror.setOption("extraKeys", {
"Cmd-Enter": function(cm) {},
"Cmd-7": function(cm) {
// Delete the part of the line before the cursor.
CodeMirror.commands.toggleComment(cm);
},
"Cmd-F7": function(cm) {
// Delete the part of the line before the cursor.
CodeMirror.commands.delLineLeft(cm);
},
"Cmd-F8": function(cm) {
// Delete the whole line under the cursor, including newline at the end.
CodeMirror.commands.deleteLine(cm);
},
"Cmd-F9": function(cm) {
// Delete the part of the line after the cursor. If that consists only
// of whitespace, the newline at the end of the line is also deleted.
CodeMirror.commands.killLine(cm);
},
});
}
}
); This separate process, is a Jupyter server in the end. Does VSCode also invoke CodeMirror? If so, something like that what I'm doing here might be possible. |
Any progress on this? Without custom keybindings inherited from vscode makes this project not much meaningful since people could do almost everything in a browser. |
Closing in favor of #4376 |
I set some user shortcuts in the VSCode,but when I coding with notebook I found the shortcuts did not work. How to user my own keyboard shortcuts when coding with notebook ?
And, I set '"editor.mouseWheelZoom": true' in 'setting.json',it also doesn't work. How should I do?
The text was updated successfully, but these errors were encountered: