diff --git a/HELP.md b/HELP.md index 4bc51871..4d001176 100644 --- a/HELP.md +++ b/HELP.md @@ -232,6 +232,8 @@ When the `--vim` option is provided, or the configuration parameter `vim` is set | `mf` | make file | `tt` | show terminal | `e` | edit file +| `cc` | copy +| `mm` | move Commands can be joined, for example: diff --git a/client/key/vim/index.js b/client/key/vim/index.js index 5f67f4e4..a39bd894 100644 --- a/client/key/vim/index.js +++ b/client/key/vim/index.js @@ -60,6 +60,14 @@ const getOperations = (event, deps) => { remove: () => { Operation.show('delete'); }, + operationCopy: () => { + event.preventDefault(); + Operation.show('copy'); + }, + operationMove: () => { + event.preventDefault(); + Operation.show('move'); + }, makeDirectory: () => { event.stopImmediatePropagation(); diff --git a/client/key/vim/vim.js b/client/key/vim/vim.js index 0d0404c3..63452faa 100644 --- a/client/key/vim/vim.js +++ b/client/key/vim/vim.js @@ -40,6 +40,8 @@ export default (key, operations = {}) => { makeDirectory = noop, terminal = noop, edit = noop, + operationCopy = noop, + operationMove = noop, } = operations; if (key === 'Enter') @@ -111,6 +113,16 @@ export default (key, operations = {}) => { return end(); } + if (value === 'cc') { + operationCopy(); + return end(); + } + + if (value === 'mm') { + operationMove(); + return end(); + } + if (value === 'mf') { makeFile(); return end(); diff --git a/client/key/vim/vim.spec.js b/client/key/vim/vim.spec.js index 88cdd89e..02fd52d4 100644 --- a/client/key/vim/vim.spec.js +++ b/client/key/vim/vim.spec.js @@ -43,6 +43,28 @@ test('vim: ^', (t) => { t.end(); }); +test('vim: cc', (t) => { + const operationCopy = stub(); + + vim('cc', { + operationCopy, + }); + + t.calledWithNoArgs(operationCopy); + t.end(); +}); + +test('vim: mm', (t) => { + const operationMove = stub(); + + vim('mm', { + operationMove, + }); + + t.calledWithNoArgs(operationMove); + t.end(); +}); + test('vim: w', (t) => { const moveNext = stub();