Skip to content

Commit

Permalink
Merge pull request #224 from aioutecism/feature/mimic-vim-search-beha…
Browse files Browse the repository at this point in the history
…vior-config

Add `amVim.mimicVimSearchBehavior` configuration
  • Loading branch information
aioutecism authored Jul 8, 2018
2 parents e95995b + b2ec711 commit a45a5c3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ Set to `true` to start in Insert mode when opening files.

Set to `true` to will make line numbers relative when not in Insert mode.

#### `amVim.mimicVimSearchBehavior`

`Boolean`, Default: `true`

Set to `false` to keep VSCode's keybinding when searching.

#### `amVim.vimStyleNavigationInListView`

`Boolean`, Default: `true`
Expand Down
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@
"default": false,
"description": "Set to `true` to will make line numbers relative when not in Insert mode."
},
"amVim.mimicVimSearchBehavior": {
"type": "boolean",
"default": true,
"description": "Set to `false` to keep VSCode's keybinding when searching."
},
"amVim.vimStyleNavigationInListView": {
"type": "boolean",
"default": true,
Expand All @@ -80,7 +85,7 @@
{ "command": "amVim.ctrl+f", "key": "ctrl+f", "when": "editorTextFocus && amVim.configuration.shouldBindCtrlCommands && amVim.mode != 'INSERT'" },
{ "command": "amVim.ctrl+b", "key": "ctrl+b", "when": "editorTextFocus && amVim.configuration.shouldBindCtrlCommands && amVim.mode != 'INSERT'" },

{ "key": "enter", "command": "amVim.executeNativeFind", "when": "editorFocus && findInputFocussed && findWidgetVisible" },
{ "key": "enter", "command": "amVim.executeNativeFind", "when": "amVim.configuration.shouldMimicVimSearchBehavior && editorFocus && findInputFocussed && findWidgetVisible" },

{ "key": "j", "command": "list.focusDown", "when": "amVim.configuration.shouldUseVimStyleNavigationInListView && listFocus && !inputFocus" },
{ "key": "k", "command": "list.focusUp", "when": "amVim.configuration.shouldUseVimStyleNavigationInListView && listFocus && !inputFocus" },
Expand Down
12 changes: 10 additions & 2 deletions src/Configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,17 @@ export class Configuration {

private static updateKeybindingContexts(): void {
commands.executeCommand('setContext',
'amVim.configuration.shouldBindCtrlCommands', this.getExtensionSetting<boolean>('bindCtrlCommands', true));
'amVim.configuration.shouldBindCtrlCommands',
this.getExtensionSetting<boolean>('bindCtrlCommands', true)
);
commands.executeCommand('setContext',
'amVim.configuration.shouldMimicVimSearchBehavior',
this.getExtensionSetting<boolean>('mimicVimSearchBehavior', true)
);
commands.executeCommand('setContext',
'amVim.configuration.shouldUseVimStyleNavigationInListView', this.getExtensionSetting<boolean>('vimStyleNavigationInListView', true));
'amVim.configuration.shouldUseVimStyleNavigationInListView',
this.getExtensionSetting<boolean>('vimStyleNavigationInListView', true)
);
}

static getExtensionSetting<T>(section: string, defaultValue: T): T {
Expand Down

0 comments on commit a45a5c3

Please sign in to comment.