Skip to content

Commit

Permalink
Keymapping bindings inconsistently cased VSCodeVim#3012 (VSCodeVim#3731)
Browse files Browse the repository at this point in the history
* Add keybinding regex for normalizing

* Replace changed inputs with capitalized equivalents
  • Loading branch information
ObliviousJamie authored and jpoon committed May 6, 2019
1 parent bb3a253 commit 2ddca28
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/actions/commands/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ class CommandEscReplaceMode extends BaseCommand {
@RegisterAction
class CommandInsertReplaceMode extends BaseCommand {
modes = [ModeName.Replace];
keys = ['<insert>'];
keys = ['<Insert>'];

public async exec(position: Position, vimState: VimState): Promise<VimState> {
await vimState.setCurrentMode(ModeName.Insert);
Expand Down Expand Up @@ -749,7 +749,7 @@ class CommandMoveHalfPageUp extends CommandEditorScroll {
@RegisterAction
export class CommandInsertAtCursor extends BaseCommand {
modes = [ModeName.Normal];
keys = [['i'], ['<insert>']];
keys = [['i'], ['<Insert>']];

public async exec(position: Position, vimState: VimState): Promise<VimState> {
await vimState.setCurrentMode(ModeName.Insert);
Expand Down Expand Up @@ -792,7 +792,7 @@ class CommandReplaceAtCursorFromNormalMode extends BaseCommand {
@RegisterAction
class CommandReplaceAtCursorFromInsertMode extends BaseCommand {
modes = [ModeName.Insert];
keys = ['<insert>'];
keys = ['<Insert>'];

public async exec(position: Position, vimState: VimState): Promise<VimState> {
let timesToRepeat = vimState.recordedState.count || 1;
Expand Down
4 changes: 2 additions & 2 deletions src/actions/motion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,7 @@ class MoveRepeatReversed extends BaseMovement {

@RegisterAction
class MoveLineEnd extends BaseMovement {
keys = [['$'], ['<end>'], ['<D-right>']];
keys = [['$'], ['<End>'], ['<D-right>']];
setsDesiredColumnToEOL = true;

public async execActionWithCount(
Expand All @@ -829,7 +829,7 @@ class MoveLineEnd extends BaseMovement {

@RegisterAction
class MoveLineBegin extends BaseMovement {
keys = [['0'], ['<home>'], ['<D-left>']];
keys = [['0'], ['<Home>'], ['<D-left>']];

public async execAction(position: Position, vimState: VimState): Promise<Position> {
return position.getLineBegin();
Expand Down
3 changes: 3 additions & 0 deletions src/configuration/notation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ export class Notation {
Esc: ['escape', 'esc'],
BS: ['backspace', 'bs'],
Del: ['delete', 'del'],
Home: ['home'],
End: ['end'],
Insert: ['insert'],
' ': ['<space>'],
'\n': ['<cr>', '<enter>'],
};
Expand Down
3 changes: 3 additions & 0 deletions test/configuration/notation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ suite('Notation', () => {
'c-z': '<C-z>',
'<CmD+a>': '<D-a>',
eScapE: '<Esc>',
hOme: '<Home>',
inSert: '<Insert>',
eNd: '<End>',
'<LeAder>': '//',
LEaDer: '//',
'<cR>': '\n',
Expand Down
2 changes: 1 addition & 1 deletion test/mode/modeInsert.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ suite('Mode Insert', () => {
teardown(cleanUpWorkspace);

test('can be activated', async () => {
let activationKeys = ['o', 'I', 'i', 'O', 'a', 'A', '<insert>'];
let activationKeys = ['o', 'I', 'i', 'O', 'a', 'A', '<Insert>'];

for (let key of activationKeys) {
await modeHandler.handleKeyEvent('<Esc>');
Expand Down
4 changes: 2 additions & 2 deletions test/mode/modeReplace.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ suite('Mode Replace', () => {
teardown(cleanUpWorkspace);

newTest({
title: 'Can activate with <insert> from Insert mode',
title: 'Can activate with <Insert> from Insert mode',
start: ['|'],
keysPressed: 'ia<insert>',
keysPressed: 'ia<Insert>',
end: ['a|'],
endMode: ModeName.Replace,
});
Expand Down
4 changes: 2 additions & 2 deletions test/mode/normalModeTests/motions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,9 @@ suite('Motions in Normal Mode', () => {
});

newTest({
title: 'Can handle <end> with a count',
title: 'Can handle <End> with a count',
start: ['te|xt text', 'text', 'text text text'],
keysPressed: '3<end>',
keysPressed: '3<End>',
end: ['text text', 'text', 'text text tex|t'],
});

Expand Down

0 comments on commit 2ddca28

Please sign in to comment.