Skip to content

Commit 5432702

Browse files
committed
[vim] Implement i_CTRL-W
1 parent 8be5651 commit 5432702

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

keymap/vim.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@
166166
{ keys: 'Y', type: 'operatorMotion', operator: 'yank', motion: 'moveToEol', motionArgs: { inclusive: true }, operatorMotionArgs: { visualLine: true }},
167167
{ keys: 'C', type: 'operatorMotion', operator: 'change', motion: 'moveToEol', motionArgs: { inclusive: true }, operatorMotionArgs: { visualLine: true }},
168168
{ keys: '~', type: 'operatorMotion', operator: 'swapcase', operatorArgs: { shouldMoveCursor: true }, motion: 'moveByCharacters', motionArgs: { forward: true }},
169+
{ keys: '<C-w>', type: 'operatorMotion', operator: 'delete', motion: 'moveByWords', motionArgs: { forward: false, wordEnd: false }, context: 'insert' },
169170
// Actions
170171
{ keys: '<C-i>', type: 'action', action: 'jumpListWalk', actionArgs: { forward: true }},
171172
{ keys: '<C-o>', type: 'action', action: 'jumpListWalk', actionArgs: { forward: false }},
@@ -235,10 +236,12 @@
235236
var name = '';
236237
if (e.ctrlKey) { name += 'C-'; }
237238
if (e.altKey) { name += 'A-'; }
238-
if (mac && e.metaKey || (!hasModifier || e.shiftKey) && key.length < 2) {
239+
if (mac && e.metaKey || (!hasModifier && e.shiftKey) && key.length < 2) {
239240
// Shift key bindings can only specified for special characters.
240241
return;
241-
} else if (e.shiftKey) { name += 'S-'; }
242+
} else if (e.shiftKey && !/^[A-Za-z]$/.test(key)) {
243+
name += 'S-';
244+
}
242245
if (key.length == 1) { key = key.toLowerCase(); }
243246
name += key;
244247
if (name.length > 1) { name = '<' + name + '>'; }

0 commit comments

Comments
 (0)