Skip to content

Commit a882d42

Browse files
authored
ctrl-c copies if you aren't on a mac (#34)
* only bind ctrl-c leave insert mode for mac * better
1 parent e19f2a9 commit a882d42

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jupyterlab_vim",
3-
"version": "0.5.0",
3+
"version": "0.6.0-dev",
44
"description": "Code cell vim bindings",
55
"author": "Jacques Kvam",
66
"main": "lib/index.js",

src/index.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ import {
2626

2727
import '../style/index.css';
2828

29+
/**
30+
* A boolean indicating whether the platform is Mac.
31+
*/
32+
const IS_MAC = !!navigator.platform.match(/Mac/i);
33+
2934
/**
3035
* Initialization data for the jupyterlab_vim extension.
3136
*/
@@ -57,7 +62,9 @@ class VimCell {
5762
let extraKeys = editor.getOption('extraKeys') || {};
5863

5964
extraKeys['Esc'] = CodeMirror.prototype.leaveInsertMode;
60-
extraKeys['Ctrl-C'] = CodeMirror.prototype.leaveInsertMode;
65+
if (!IS_MAC) {
66+
extraKeys['Ctrl-C'] = false;
67+
}
6168

6269
CodeMirror.prototype.save = () => {
6370
commands.execute('docmanager:save');

0 commit comments

Comments
 (0)