From 36bacfe9152345868b263a517a7952ee230b98b5 Mon Sep 17 00:00:00 2001 From: coderiaser Date: Tue, 28 Apr 2026 23:23:52 +0300 Subject: [PATCH] feature: cloudcmd: client: key: vim: cc, mm --- HELP.md | 2 ++ client/key/vim/index.js | 8 ++++++++ client/key/vim/vim.js | 12 ++++++++++++ client/key/vim/vim.spec.js | 22 ++++++++++++++++++++++ 4 files changed, 44 insertions(+) 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();