Skip to content

Commit f49fc19

Browse files
committed
Workaround vim mode might overwrite copy keyMap on Windows
1 parent 4de7347 commit f49fc19

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

public/js/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
var defaultTextHeight = 20;
22
var viewportMargin = 20;
3+
var mac = CodeMirror.keyMap["default"] == CodeMirror.keyMap.macDefault;
34
var defaultExtraKeys = {
45
"F10": function (cm) {
56
cm.setOption("fullScreen", !cm.getOption("fullScreen"));
@@ -45,7 +46,11 @@ var defaultExtraKeys = {
4546
}
4647
},
4748
"Cmd-Left": "goLineLeftSmart",
48-
"Cmd-Right": "goLineRight"
49+
"Cmd-Right": "goLineRight",
50+
"Ctrl-C": function (cm) {
51+
if (!mac && cm.getOption('keyMap').substr(0, 3) === 'vim') document.execCommand("copy");
52+
else return CodeMirror.Pass;
53+
}
4954
};
5055

5156
var idleTime = 300000; //5 mins

0 commit comments

Comments
 (0)