mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-17 16:38:18 +00:00
feature: cloudcmd: client: key: vim: cc, mm
This commit is contained in:
parent
bcbef1a3b0
commit
36bacfe915
4 changed files with 44 additions and 0 deletions
2
HELP.md
2
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:
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue