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:
parent
ee8cb98e52
commit
81ba0e722e
4 changed files with 6001 additions and 1 deletions
5978
codemirror/vim.js
Normal file
5978
codemirror/vim.js
Normal file
File diff suppressed because it is too large
Load diff
|
@ -25,6 +25,7 @@
|
||||||
<script type="text/javascript" src="codemirror/search.js"></script>
|
<script type="text/javascript" src="codemirror/search.js"></script>
|
||||||
<script type="text/javascript" src="codemirror/annotatescrollbar.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/matchesonscrollbar.js"></script>
|
||||||
|
<script type="text/javascript" src="codemirror/vim.js"></script>
|
||||||
|
|
||||||
<script type="text/javascript" src="util/showdown.min.js"></script>
|
<script type="text/javascript" src="util/showdown.min.js"></script>
|
||||||
</head>
|
</head>
|
||||||
|
@ -130,6 +131,12 @@
|
||||||
<option value="vscode-dark">VSCode Dark</option>
|
<option value="vscode-dark">VSCode Dark</option>
|
||||||
</select>
|
</select>
|
||||||
<br/><br/>
|
<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>Convert Source Encoding:</div>
|
||||||
<div style="margin-top:5px"><a href="#" onclick="IDE.convert437ToUTF()">Code Page 437 to UTF</a></div>
|
<div style="margin-top:5px"><a href="#" onclick="IDE.convert437ToUTF()">Code Page 437 to UTF</a></div>
|
||||||
<div>
|
<div>
|
||||||
|
|
14
qbjs-ide.js
14
qbjs-ide.js
|
@ -14,6 +14,7 @@ var IDE = new function() {
|
||||||
var currPath = "/";
|
var currPath = "/";
|
||||||
var mainProg = null;
|
var mainProg = null;
|
||||||
var theme = "qbjs";
|
var theme = "qbjs";
|
||||||
|
var keyMap = "default";
|
||||||
var splitWidth = 600;
|
var splitWidth = 600;
|
||||||
var splitHeight = 327;
|
var splitHeight = 327;
|
||||||
var sliding = false;
|
var sliding = false;
|
||||||
|
@ -52,6 +53,7 @@ var IDE = new function() {
|
||||||
fsUrl: _el("fs-url"),
|
fsUrl: _el("fs-url"),
|
||||||
code: _el("code"),
|
code: _el("code"),
|
||||||
themePicker: _el("theme-picker"),
|
themePicker: _el("theme-picker"),
|
||||||
|
keyMapPicker: _el("key-bindings"),
|
||||||
help: _el("help"),
|
help: _el("help"),
|
||||||
helpSidebar: _el("help-sidebar"),
|
helpSidebar: _el("help-sidebar"),
|
||||||
helpPage: _el("help-page"),
|
helpPage: _el("help-page"),
|
||||||
|
@ -120,6 +122,10 @@ var IDE = new function() {
|
||||||
if (stheme && stheme != "") {
|
if (stheme && stheme != "") {
|
||||||
theme = stheme;
|
theme = stheme;
|
||||||
}
|
}
|
||||||
|
var skeyMap = localStorage.getItem("@@_keyMap");
|
||||||
|
if (skeyMap && skeyMap != "") {
|
||||||
|
keyMap = skeyMap;
|
||||||
|
}
|
||||||
_e.ideTheme.href = "codemirror/themes/" + theme + ".css";
|
_e.ideTheme.href = "codemirror/themes/" + theme + ".css";
|
||||||
GitHelp.navhome();
|
GitHelp.navhome();
|
||||||
}
|
}
|
||||||
|
@ -135,6 +141,7 @@ var IDE = new function() {
|
||||||
height: "auto",
|
height: "auto",
|
||||||
styleActiveLine: true,
|
styleActiveLine: true,
|
||||||
smartIndent: false,
|
smartIndent: false,
|
||||||
|
keyMap: keyMap,
|
||||||
specialChars: /[\u0009-\u000d\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/,
|
specialChars: /[\u0009-\u000d\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/,
|
||||||
extraKeys: {
|
extraKeys: {
|
||||||
"Tab": function(cm) {
|
"Tab": function(cm) {
|
||||||
|
@ -440,8 +447,14 @@ var IDE = new function() {
|
||||||
localStorage.setItem("@@_theme", theme);
|
localStorage.setItem("@@_theme", theme);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _changeKeyMap(keyMap) {
|
||||||
|
editor.setOption("keyMap", keyMap);
|
||||||
|
localStorage.setItem("@@_keyMap", keyMap);
|
||||||
|
};
|
||||||
|
|
||||||
function _showOptionDialog() {
|
function _showOptionDialog() {
|
||||||
_e.themePicker.value = theme;
|
_e.themePicker.value = theme;
|
||||||
|
_e.keyMapPicker.value = keyMap;
|
||||||
_showDialog(_e.optionsDialog);
|
_showDialog(_e.optionsDialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1231,4 +1244,5 @@ var IDE = new function() {
|
||||||
this.uploadFile = _uploadFile;
|
this.uploadFile = _uploadFile;
|
||||||
this.convert437ToUTF = _convert437ToUTF;
|
this.convert437ToUTF = _convert437ToUTF;
|
||||||
this.convertUTFTo437 = _convertUTFTo437;
|
this.convertUTFTo437 = _convertUTFTo437;
|
||||||
|
this.changeKeyMap = _changeKeyMap;
|
||||||
};
|
};
|
|
@ -14,7 +14,7 @@
|
||||||
// Names of the two caches used in this version of the service worker.
|
// 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
|
// Change to v2, etc. when you update any of the local resources, which will
|
||||||
// in turn trigger the install event again.
|
// in turn trigger the install event again.
|
||||||
const PRECACHE = 'precache-v19';
|
const PRECACHE = 'precache-v20';
|
||||||
const RUNTIME = 'runtime';
|
const RUNTIME = 'runtime';
|
||||||
const PREFIX = (self.location.origin.indexOf("github.io") == -1) ? "/" : "/qbjs/";
|
const PREFIX = (self.location.origin.indexOf("github.io") == -1) ? "/" : "/qbjs/";
|
||||||
|
|
||||||
|
@ -36,6 +36,7 @@ const PRECACHE_URLS = [
|
||||||
PREFIX + 'codemirror/qb-lang.js',
|
PREFIX + 'codemirror/qb-lang.js',
|
||||||
PREFIX + 'codemirror/search.js',
|
PREFIX + 'codemirror/search.js',
|
||||||
PREFIX + 'codemirror/searchcursor.js',
|
PREFIX + 'codemirror/searchcursor.js',
|
||||||
|
PREFIX + 'codemirror/vim.js',
|
||||||
PREFIX + 'export/auto.html',
|
PREFIX + 'export/auto.html',
|
||||||
PREFIX + 'export/fullscreen-hover.svg',
|
PREFIX + 'export/fullscreen-hover.svg',
|
||||||
PREFIX + 'export/fullscreen.svg',
|
PREFIX + 'export/fullscreen.svg',
|
||||||
|
|
Loading…
Reference in a new issue