Skip to content

Commit 36bacfe

Browse files
committed
feature: cloudcmd: client: key: vim: cc, mm
1 parent bcbef1a commit 36bacfe

4 files changed

Lines changed: 44 additions & 0 deletions

File tree

HELP.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,8 @@ When the `--vim` option is provided, or the configuration parameter `vim` is set
232232
| `mf` | make file
233233
| `tt` | show terminal
234234
| `e` | edit file
235+
| `cc` | copy
236+
| `mm` | move
235237

236238
Commands can be joined, for example:
237239

client/key/vim/index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@ const getOperations = (event, deps) => {
6060
remove: () => {
6161
Operation.show('delete');
6262
},
63+
operationCopy: () => {
64+
event.preventDefault();
65+
Operation.show('copy');
66+
},
67+
operationMove: () => {
68+
event.preventDefault();
69+
Operation.show('move');
70+
},
6371

6472
makeDirectory: () => {
6573
event.stopImmediatePropagation();

client/key/vim/vim.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ export default (key, operations = {}) => {
4040
makeDirectory = noop,
4141
terminal = noop,
4242
edit = noop,
43+
operationCopy = noop,
44+
operationMove = noop,
4345
} = operations;
4446

4547
if (key === 'Enter')
@@ -111,6 +113,16 @@ export default (key, operations = {}) => {
111113
return end();
112114
}
113115

116+
if (value === 'cc') {
117+
operationCopy();
118+
return end();
119+
}
120+
121+
if (value === 'mm') {
122+
operationMove();
123+
return end();
124+
}
125+
114126
if (value === 'mf') {
115127
makeFile();
116128
return end();

client/key/vim/vim.spec.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,28 @@ test('vim: ^', (t) => {
4343
t.end();
4444
});
4545

46+
test('vim: cc', (t) => {
47+
const operationCopy = stub();
48+
49+
vim('cc', {
50+
operationCopy,
51+
});
52+
53+
t.calledWithNoArgs(operationCopy);
54+
t.end();
55+
});
56+
57+
test('vim: mm', (t) => {
58+
const operationMove = stub();
59+
60+
vim('mm', {
61+
operationMove,
62+
});
63+
64+
t.calledWithNoArgs(operationMove);
65+
t.end();
66+
});
67+
4668
test('vim: w', (t) => {
4769
const moveNext = stub();
4870

0 commit comments

Comments
 (0)