Open laynor opened 5 years ago
@fourier Thanks, I'm using dyalog-mode already, but couldn't get it to connect the dyalog session. This is probably not compatible with the unix version of Dyalog - it's using ⎕WC, which triggers value error on my side.
Sorry for the late reply.
At the moment this is the only way to achieve what you want. RIDE doesn't expose all underlying features of the monaco editor, so you can only define shortcuts for commands that have been defined (as you have done in your patch).
@laynor basic vim bindings is achievable with npm install monaco-vim
(https://github.com/brijeshb42/monaco-vim) and
diff --git a/index.html b/index.html
index fed8ab3..bba7ecc 100644
--- a/index.html
+++ b/index.html
@@ -871,7 +871,10 @@
<script>
let dir = typeof __dirname !== 'undefined' ? `${__dirname}/` : '';
amdRequire.config({
- baseUrl: dir + 'node_modules/monaco-editor/min'
+ baseUrl: dir,
+ paths: {
+ 'vs': 'node_modules/monaco-editor/min/vs',
+ 'monaco-vim': 'node_modules/monaco-vim/dist/monaco-vim',
+ }
});
self.module = undefined;
diff --git a/src/km.js b/src/km.js
index 285101d..b76c7f5 100644
--- a/src/km.js
+++ b/src/km.js
@@ -162,6 +162,11 @@
+ 'please use "Connect..." instead.', 'Cannot Start New Session');
}
},
+ VIM(me) {
+ amdRequire(['vs/editor/editor.main', 'monaco-vim'], function(a, MonacoVim) {
+ vimMode = MonacoVim.initVimMode(me, document.createElement('div'));
+ });
+ },
+ MIV(me) { vimMode.dispose(); },
DK(me) { me.trigger('editor', 'editor.action.deleteLines'); },
QCP(me) { me.trigger('editor', 'editor.action.quickCommand'); },
QIT() { D.quit(); },
But again is the question, is there a better way to do this? We can load extra code accordingly to https://github.com/Dyalog/ride/blob/master/sample-extensions/syntax-in-comments.js, but I'm not sure how we can add extra commands that way.
Describe the issue you are having
I'm currently using the below patch to be able to bind my PF keys to have more emacsy keybindings (would rather have vim, but that's another story).
In the prefs, I can use the added command in my PF keys to achieve the desired result. Is there a better way to do this?
Paste the contents of Help → About (Shift+F1)