Skip to content

Commit

Permalink
Merge pull request #249 from VSCodeVim/dot-key
Browse files Browse the repository at this point in the history
Dot key.
  • Loading branch information
johnfn committed Jun 8, 2016
2 parents dc5a2b2 + a4b2e6c commit 832ff29
Show file tree
Hide file tree
Showing 4 changed files with 144 additions and 87 deletions.
22 changes: 17 additions & 5 deletions src/actions/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ class CommandInsertInInsertMode extends BaseCommand {
keys = ["<character>"];

public async exec(position: Position, vimState: VimState): Promise<VimState> {
await TextEditor.insert(vimState.actionState.keysPressed[0]);
await TextEditor.insert(vimState.actionState.actionKeys[0]);

vimState.cursorStartPosition = Position.FromVSCodePosition(vscode.window.activeTextEditor.selection.start);
vimState.cursorPosition = Position.FromVSCodePosition(vscode.window.activeTextEditor.selection.start);
Expand Down Expand Up @@ -360,6 +360,18 @@ class CommandFind extends BaseCommand {
}
}

@RegisterAction
class CommandDot extends BaseCommand {
modes = [ModeName.Normal];
keys = ["."];

public async exec(position: Position, vimState: VimState): Promise<VimState> {
vimState.commandAction = VimCommandActions.Dot;

return vimState;
}
}

@RegisterAction
class CommandFold extends BaseCommand {
modes = [ModeName.Visual, ModeName.VisualLine];
Expand Down Expand Up @@ -698,7 +710,7 @@ class MoveFindForward extends BaseMovement {
keys = ["f", "<character>"];

public async execAction(position: Position, vimState: VimState): Promise<VimState> {
const toFind = vimState.actionState.keysPressed[1];
const toFind = vimState.actionState.actionKeys[1];

vimState.cursorPosition = position.findForwards(toFind);

Expand All @@ -712,7 +724,7 @@ class MoveFindBackward extends BaseMovement {
keys = ["F", "<character>"];

public async execAction(position: Position, vimState: VimState): Promise<VimState> {
const toFind = vimState.actionState.keysPressed[1];
const toFind = vimState.actionState.actionKeys[1];

vimState.cursorPosition = position.findBackwards(toFind);

Expand All @@ -727,7 +739,7 @@ class MoveTilForward extends BaseMovement {
keys = ["t", "<character>"];

public async execAction(position: Position, vimState: VimState): Promise<VimState> {
const toFind = vimState.actionState.keysPressed[1];
const toFind = vimState.actionState.actionKeys[1];

vimState.cursorPosition = position.tilForwards(toFind);

Expand All @@ -741,7 +753,7 @@ class MoveTilBackward extends BaseMovement {
keys = ["T", "<character>"];

public async execAction(position: Position, vimState: VimState): Promise<VimState> {
const toFind = vimState.actionState.keysPressed[1];
const toFind = vimState.actionState.actionKeys[1];

vimState.cursorPosition = position.tilBackwards(toFind);

Expand Down
Loading

0 comments on commit 832ff29

Please sign in to comment.