|
164 | 164 | { keys: 'A', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'eol' }, context: 'normal' }, |
165 | 165 | { keys: 'A', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'endOfSelectedArea' }, context: 'visual' }, |
166 | 166 | { keys: 'i', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'inplace' }, context: 'normal' }, |
| 167 | + { keys: 'gi', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'lastEdit' }, context: 'normal' }, |
167 | 168 | { keys: 'I', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'firstNonBlank'}, context: 'normal' }, |
| 169 | + { keys: 'gI', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'bol'}, context: 'normal' }, |
168 | 170 | { keys: 'I', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'startOfSelectedArea' }, context: 'visual' }, |
169 | 171 | { keys: 'o', type: 'action', action: 'newLineAndEnterInsertMode', isEdit: true, interlaceInsertRepeat: true, actionArgs: { after: true }, context: 'normal' }, |
170 | 172 | { keys: 'O', type: 'action', action: 'newLineAndEnterInsertMode', isEdit: true, interlaceInsertRepeat: true, actionArgs: { after: false }, context: 'normal' }, |
|
174 | 176 | { keys: '<C-q>', type: 'action', action: 'toggleVisualMode', actionArgs: { blockwise: true }}, |
175 | 177 | { keys: 'gv', type: 'action', action: 'reselectLastSelection' }, |
176 | 178 | { keys: 'J', type: 'action', action: 'joinLines', isEdit: true }, |
| 179 | + { keys: 'gJ', type: 'action', action: 'joinLines', actionArgs: { keepSpaces: true }, isEdit: true }, |
177 | 180 | { keys: 'p', type: 'action', action: 'paste', isEdit: true, actionArgs: { after: true, isEdit: true }}, |
178 | 181 | { keys: 'P', type: 'action', action: 'paste', isEdit: true, actionArgs: { after: false, isEdit: true }}, |
179 | 182 | { keys: 'r<character>', type: 'action', action: 'replace', isEdit: true }, |
|
2380 | 2383 | var height = cm.listSelections().length; |
2381 | 2384 | if (insertAt == 'eol') { |
2382 | 2385 | head = Pos(head.line, lineLength(cm, head.line)); |
| 2386 | + } else if (insertAt == 'bol') { |
| 2387 | + head = Pos(head.line, 0); |
2383 | 2388 | } else if (insertAt == 'charAfter') { |
2384 | 2389 | head = offsetCursor(head, 0, 1); |
2385 | 2390 | } else if (insertAt == 'firstNonBlank') { |
|
2418 | 2423 | if (vim.visualMode){ |
2419 | 2424 | return; |
2420 | 2425 | } |
| 2426 | + } else if (insertAt == 'lastEdit') { |
| 2427 | + head = getLastEditPos(cm) || head; |
2421 | 2428 | } |
2422 | 2429 | cm.setOption('disableInput', false); |
2423 | 2430 | if (actionArgs && actionArgs.replace) { |
|
2526 | 2533 | var tmp = Pos(curStart.line + 1, |
2527 | 2534 | lineLength(cm, curStart.line + 1)); |
2528 | 2535 | var text = cm.getRange(curStart, tmp); |
2529 | | - text = text.replace(/\n\s*/g, ' '); |
| 2536 | + text = actionArgs.keepSpaces |
| 2537 | + ? text.replace(/\n\r?/g, '') |
| 2538 | + : text.replace(/\n\s*/g, ' '); |
2530 | 2539 | cm.replaceRange(text, curStart, tmp); |
2531 | 2540 | } |
2532 | 2541 | var curFinalPos = Pos(curStart.line, finalCh); |
|
0 commit comments