Skip to content
This repository was archived by the owner on Aug 22, 2023. It is now read-only.

Commit 3aefafb

Browse files
committed
Allow :quit to leave vim mode
1 parent 7f1a585 commit 3aefafb

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

lib/codemirror.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ define([
148148
"<Plug>(vim-binding-k)", "motion", "moveByLinesOrCell",
149149
{forward: false, linewise: true },
150150
{context: "normal"}
151-
);
151+
);
152152
CodeMirror.Vim.mapCommand(
153153
"<Plug>(vim-binding-j)", "motion", "moveByLinesOrCell",
154154
{forward: true, linewise: true },
@@ -158,7 +158,7 @@ define([
158158
"<Plug>(vim-binding-gk)", "motion", "moveByDisplayLinesOrCell",
159159
{forward: false },
160160
{context: "normal"}
161-
);
161+
);
162162
CodeMirror.Vim.mapCommand(
163163
"<Plug>(vim-binding-gj)", "motion", "moveByDisplayLinesOrCell",
164164
{forward: true },
@@ -179,6 +179,9 @@ define([
179179
{forward: true, toFirstChar: true, repeatOffset: -1 },
180180
{context: "normal"}
181181
);
182+
CodeMirror.Vim.defineEx("quit", "q", function(cm){
183+
cm.leaveNormalMode();
184+
});
182185

183186
exports.attach = function attach() {
184187
if (Original !== undefined) {
@@ -207,7 +210,7 @@ define([
207210
"k", "motion", "moveByLines",
208211
{forward: false, linewise: true },
209212
{context: "normal"}
210-
);
213+
);
211214
CodeMirror.Vim.mapCommand(
212215
"j", "motion", "moveByLines",
213216
{forward: true, linewise: true },
@@ -217,7 +220,7 @@ define([
217220
"gk", "motion", "moveByDisplayLines",
218221
{forward: false },
219222
{context: "normal"}
220-
);
223+
);
221224
CodeMirror.Vim.mapCommand(
222225
"gj", "motion", "moveByDisplayLines",
223226
{forward: true },

0 commit comments

Comments
 (0)