feature: cloudcmd: client: key: vim: cc, mm

This commit is contained in:
coderiaser 2026-04-28 23:23:52 +03:00
parent bcbef1a3b0
commit 36bacfe915
4 changed files with 44 additions and 0 deletions

View file

@ -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:

View file

@ -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();

View file

@ -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();

View file

@ -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();