diff --git a/client/key/vim/vim.js b/client/key/vim/vim.js index e108c493..7a3d4017 100644 --- a/client/key/vim/vim.js +++ b/client/key/vim/vim.js @@ -47,7 +47,7 @@ module.exports = (key, operations) => { return end(); } - if (key === 'j') { + if (key === 'j' || key === 'w') { const { count, isDelete, @@ -63,7 +63,7 @@ module.exports = (key, operations) => { return end(); } - if (key === 'k') { + if (key === 'k' || key === 'b') { const { count, isDelete, diff --git a/client/key/vim/vim.spec.js b/client/key/vim/vim.spec.js index 5355807d..ecafb8a3 100644 --- a/client/key/vim/vim.spec.js +++ b/client/key/vim/vim.spec.js @@ -1,6 +1,8 @@ 'use strict'; const test = require('supertape'); +const stub = require('@cloudcmd/stub'); + const vim = require('./vim'); test('vim: no operations', (t) => { @@ -10,3 +12,54 @@ test('vim: no operations', (t) => { t.end(); }); +test('vim: ^', (t) => { + const movePrevious = stub(); + + vim('^', { + movePrevious, + }); + + const expected = { + count: Infinity, + isVisual: false, + isDelete: false, + }; + + t.ok(movePrevious.calledWith(expected), 'should call movePrevious'); + t.end(); +}); + +test('vim: w', (t) => { + const moveNext = stub(); + + vim('w', { + moveNext, + }); + + const expected = { + count: 1, + isVisual: false, + isDelete: false, + }; + + t.ok(moveNext.calledWith(expected), 'should call moveNext'); + t.end(); +}); + +test('vim: b', (t) => { + const movePrevious = stub(); + + vim('b', { + movePrevious, + }); + + const expected = { + count: 1, + isVisual: false, + isDelete: false, + }; + + t.ok(movePrevious.calledWith(expected), 'should call movePrevious'); + t.end(); +}); +