Skip to content

Commit

Permalink
Fixes #1360
Browse files Browse the repository at this point in the history
  • Loading branch information
Chillee committed May 3, 2017
1 parent c227ea7 commit cd0ca7e
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion src/actions/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6576,6 +6576,7 @@ class ActionOverrideCmdD extends BaseCommand {
runsOnceForEachCountPrefix = true;

public async exec(position: Position, vimState: VimState): Promise<VimState> {

await vscode.commands.executeCommand('editor.action.addSelectionToNextFindMatch');
vimState.allCursors = await allowVSCodeToPropagateCursorUpdatesAndReturnThem();

Expand All @@ -6591,9 +6592,32 @@ class ActionOverrideCmdD extends BaseCommand {
}
}

@RegisterAction
class ActionOverrideCmdDInsert extends BaseCommand {
modes = [ModeName.Insert];
keys = ["<D-d>"];
runsOnceForEveryCursor() { return false; }
runsOnceForEachCountPrefix = true;

public async exec(position: Position, vimState: VimState): Promise<VimState> {
// Since editor.action.addSelectionToNextFindMatch uses the selection to
// determine where to add a word, we need to do a hack and manually set the
// selections to the word boundaries before we make the api call.
vscode.window.activeTextEditor!.selections =
vscode.window.activeTextEditor!.selections.map(x => {
const curPos = Position.FromVSCodePosition(x.active);
return new vscode.Selection(curPos.getWordLeft(true),
curPos.getLeft().getCurrentWordEnd(true).getRight());
});
await vscode.commands.executeCommand('editor.action.addSelectionToNextFindMatch');
vimState.allCursors = await allowVSCodeToPropagateCursorUpdatesAndReturnThem();
return vimState;
}
}

@RegisterAction
class ActionOverrideCmdAltDown extends BaseCommand {
modes = [ModeName.Normal, ModeName.Visual];
modes = [ModeName.Normal, ModeName.Visual, ModeName.Insert];
keys = [
["<D-alt+down>"], // OSX
["<C-alt+down>"], // Windows
Expand Down

0 comments on commit cd0ca7e

Please sign in to comment.