mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
feature(key) vim: add ability to navigate to next and previous using w and b
This commit is contained in:
parent
750b7571f5
commit
291dc39c25
2 changed files with 55 additions and 2 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue