Skip to content

Commit

Permalink
Add <C-n> and <C-p>. Closes #908.
Browse files Browse the repository at this point in the history
  • Loading branch information
johnfn committed Nov 29, 2016
1 parent 8f2405b commit a53a00b
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
12 changes: 11 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,16 @@
"command": "extension.vim_ctrl+o",
"when": "editorTextFocus && vim.useCtrlKeys && !inDebugRepl"
},
{
"key": "ctrl+n",
"command": "extension.vim_ctrl+n",
"when": "suggestWidgetVisible"
},
{
"key": "ctrl+p",
"command": "extension.vim_ctrl+p",
"when": "suggestWidgetVisible"
},
{
"key": "ctrl+x",
"command": "extension.vim_ctrl+x",
Expand Down Expand Up @@ -224,7 +234,7 @@
{
"key": "up",
"command": "extension.vim_up",
"when": "editorTextFocus && !inDebugRepl && !suggestWidgetVisible && !suggestWidgetMultipleSuggestions"
"when": "editorTextFocus && !inDebugRepl && suggestWidgetVisible && !suggestWidgetMultipleSuggestions"

This comment has been minimized.

Copy link
@xconverge

xconverge Nov 30, 2016

Member

@johnfn Why did this change? but not down

This comment has been minimized.

Copy link
@johnfn

johnfn Nov 30, 2016

Author Member

Oops, I have no idea how that happened.

This comment has been minimized.

Copy link
@xconverge

xconverge Nov 30, 2016

Member

Cat on the keyboard!

},
{
"key": "down",
Expand Down
25 changes: 25 additions & 0 deletions src/actions/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1598,6 +1598,31 @@ class CommandCtrlUInInsertMode extends BaseCommand {
}
}


@RegisterAction
class CommandCtrlN extends BaseCommand {
modes = [ModeName.Insert];
keys = ["<C-n>"];

public async exec(position: Position, vimState: VimState): Promise<VimState> {
await vscode.commands.executeCommand("selectNextSuggestion");

return vimState;
}
}

@RegisterAction
class CommandCtrlP extends BaseCommand {
modes = [ModeName.Insert];
keys = ["<C-p>"];

public async exec(position: Position, vimState: VimState): Promise<VimState> {
await vscode.commands.executeCommand("selectPrevSuggestion");

return vimState;
}
}

@RegisterAction
export class CommandSearchForwards extends BaseCommand {
modes = [ModeName.Normal];
Expand Down
1 change: 0 additions & 1 deletion src/mode/modeHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,6 @@ export class ModeHandler implements vscode.Disposable {
async handleKeyEvent(key: string): Promise<Boolean> {
this._vimState.cursorPositionJustBeforeAnythingHappened = this._vimState.allCursors.map(x => x.stop);


try {
let handled = false;

Expand Down

0 comments on commit a53a00b

Please sign in to comment.