Skip to content

Commit

Permalink
fix #652 (#655)
Browse files Browse the repository at this point in the history
  • Loading branch information
xconverge authored and johnfn committed Aug 26, 2016
1 parent 18097c4 commit 9d543e6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/actions/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,16 @@ class CommandInsertInSearchMode extends BaseCommand {
vimState.currentMode = ModeName.Normal;
vimState.cursorPosition = searchState.getNextSearchMatchPosition(searchState.searchCursorStartPosition).pos;

// Repeat the previous search if no new string is entered
if (searchState.searchString === "") {
const prevSearch = vimState.searchStatePrevious!;
if (prevSearch) {
searchState.searchString = prevSearch.searchString;
}
}
// Store this search
vimState.searchStatePrevious = searchState;

return vimState;
} else if (key === "<escape>") {
vimState.currentMode = ModeName.Normal;
Expand Down
2 changes: 2 additions & 0 deletions src/mode/modeHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ export class VimState {

public searchState: SearchState | undefined = undefined;

public searchStatePrevious: SearchState | undefined = undefined;

public replaceState: ReplaceState | undefined = undefined;

/**
Expand Down

0 comments on commit 9d543e6

Please sign in to comment.