1
1
Fork 0
mirror of https://github.com/boxgaming/qbjs.git synced 2025-01-15 12:21:17 +00:00

added support for vim key bindings

This commit is contained in:
boxgaming 2025-01-08 14:21:24 -06:00
parent ee8cb98e52
commit 81ba0e722e
4 changed files with 6001 additions and 1 deletions

5978
codemirror/vim.js Normal file

File diff suppressed because it is too large Load diff

View file

@ -25,6 +25,7 @@
<script type="text/javascript" src="codemirror/search.js"></script>
<script type="text/javascript" src="codemirror/annotatescrollbar.js"></script>
<script type="text/javascript" src="codemirror/matchesonscrollbar.js"></script>
<script type="text/javascript" src="codemirror/vim.js"></script>
<script type="text/javascript" src="util/showdown.min.js"></script>
</head>
@ -130,6 +131,12 @@
<option value="vscode-dark">VSCode Dark</option>
</select>
<br/><br/>
<div>Key Bindings:</div>
<select id="key-bindings" onchange="IDE.changeKeyMap(this.value)">
<option value="default">Default</option>
<option value="vim">VIM</option>
</select>
<br/><br/>
<div>Convert Source Encoding:</div>
<div style="margin-top:5px"><a href="#" onclick="IDE.convert437ToUTF()">Code Page 437 to UTF</a></div>
<div>

View file

@ -14,6 +14,7 @@ var IDE = new function() {
var currPath = "/";
var mainProg = null;
var theme = "qbjs";
var keyMap = "default";
var splitWidth = 600;
var splitHeight = 327;
var sliding = false;
@ -52,6 +53,7 @@ var IDE = new function() {
fsUrl: _el("fs-url"),
code: _el("code"),
themePicker: _el("theme-picker"),
keyMapPicker: _el("key-bindings"),
help: _el("help"),
helpSidebar: _el("help-sidebar"),
helpPage: _el("help-page"),
@ -120,6 +122,10 @@ var IDE = new function() {
if (stheme && stheme != "") {
theme = stheme;
}
var skeyMap = localStorage.getItem("@@_keyMap");
if (skeyMap && skeyMap != "") {
keyMap = skeyMap;
}
_e.ideTheme.href = "codemirror/themes/" + theme + ".css";
GitHelp.navhome();
}
@ -135,6 +141,7 @@ var IDE = new function() {
height: "auto",
styleActiveLine: true,
smartIndent: false,
keyMap: keyMap,
specialChars: /[\u0009-\u000d\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/,
extraKeys: {
"Tab": function(cm) {
@ -440,8 +447,14 @@ var IDE = new function() {
localStorage.setItem("@@_theme", theme);
}
function _changeKeyMap(keyMap) {
editor.setOption("keyMap", keyMap);
localStorage.setItem("@@_keyMap", keyMap);
};
function _showOptionDialog() {
_e.themePicker.value = theme;
_e.keyMapPicker.value = keyMap;
_showDialog(_e.optionsDialog);
}
@ -1231,4 +1244,5 @@ var IDE = new function() {
this.uploadFile = _uploadFile;
this.convert437ToUTF = _convert437ToUTF;
this.convertUTFTo437 = _convertUTFTo437;
this.changeKeyMap = _changeKeyMap;
};

View file

@ -14,7 +14,7 @@
// Names of the two caches used in this version of the service worker.
// Change to v2, etc. when you update any of the local resources, which will
// in turn trigger the install event again.
const PRECACHE = 'precache-v19';
const PRECACHE = 'precache-v20';
const RUNTIME = 'runtime';
const PREFIX = (self.location.origin.indexOf("github.io") == -1) ? "/" : "/qbjs/";
@ -36,6 +36,7 @@ const PRECACHE_URLS = [
PREFIX + 'codemirror/qb-lang.js',
PREFIX + 'codemirror/search.js',
PREFIX + 'codemirror/searchcursor.js',
PREFIX + 'codemirror/vim.js',
PREFIX + 'export/auto.html',
PREFIX + 'export/fullscreen-hover.svg',
PREFIX + 'export/fullscreen.svg',