Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing window keys (<C-w><C-[hjklovq]>) #2600

Merged
merged 10 commits into from
May 5, 2018
44 changes: 22 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -206,35 +206,40 @@
"when": "editorTextFocus && vim.active && vim.use<C-]> && !inDebugRepl"
},
{
"key": "ctrl+w h",
"command": "extension.vim_navigateLeft",
"when": "vim.use<C-w> && vim.active && !editorTextFocus"
},
{
"key": "ctrl+w l",
"command": "extension.vim_navigateRight",
"when": "vim.use<C-w> && vim.active && !editorTextFocus"
"key": "ctrl+h",
"command": "extension.vim_navigateCtrlH",
"when": "editorTextFocus && vim.active && vim.use<C-h> && !inDebugRepl"
},
{
"key": "ctrl+w ctrl+w",
"command": "extension.vim_navigateGroups",
"when": "vim.use<C-w> && vim.active && !editorTextFocus"
"key": "ctrl+l",
"command": "extension.vim_navigateCtrlL",
"when": "editorTextFocus && vim.active && vim.use<C-l> && !inDebugRepl"
},
{
"key": "ctrl+w j",
"command": "extension.vim_navigateDown",
"when": "vim.use<C-w> && vim.active && !editorTextFocus"
"key": "ctrl+j",
"command": "extension.vim_navigateCtrlJ",
"when": "editorTextFocus && vim.active && vim.use<C-j> && !inDebugRepl"
},
{
"key": "ctrl+w k",
"command": "extension.vim_navigateUp",
"when": "vim.use<C-w> && vim.active && !editorTextFocus"
"key": "ctrl+k",
"command": "extension.vim_navigateCtrlK",
"when": "editorTextFocus && vim.active && vim.use<C-k> && !inDebugRepl"
},
{
"key": "ctrl+w",
"command": "extension.vim_ctrl+w",
"when": "editorTextFocus && vim.active && vim.use<C-w> && !inDebugRepl"
},
{
"key": "ctrl+q",
"command": "extension.vim_winCtrlQ",
"when": "editorTextFocus && vim.active && vim.use<C-q> && !inDebugRepl"
},
{
"key": "ctrl+v",
"command": "extension.vim_winCtrlV",
"when": "editorTextFocus && vim.active && vim.use<C-v> && !inDebugRepl"
},
{
"key": "ctrl+c",
"command": "extension.vim_ctrl+c",
Expand Down Expand Up @@ -330,11 +335,6 @@
"command": "list.collapse",
"when": "listFocus && !inputFocus"
},
{
"key": "g g",
Copy link
Member

@jpoon jpoon May 4, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need this one. g g will directly call a vscode command so we need this here. mind putting it back?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After removing this, gg seems to work.

I'm new to VSCode extension development and I'm not used to package.json and what should I write to contributes.commands. so please correct me if I'm wrong.
But unlike other VSCode extensions, I guess it's enough to lists only one key sequences here to send to VSCodeVim's state machine.
The state machine processes keys one by one, and fire the command if key sequence is matched.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fairly certain we need this. When the explorer window is selected, pressing gg will take you to the first item in the list.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oooops I'm sorry... entirely I didn't care the explorer window and the when condition`.
Will restore it later.

"command": "list.focusFirst",
"when": "listFocus && !inputFocus"
},
{
"key": "shift+G",
"command": "list.focusLast",
Expand Down
14 changes: 7 additions & 7 deletions src/actions/commands/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2638,7 +2638,7 @@ class CommandNavigateLastBOL extends BaseCommand {
@RegisterAction
class CommandQuit extends BaseCommand {
modes = [ModeName.Normal];
keys = ['<C-w>', 'q'];
keys = [['<C-w>', 'q'], ['<C-w>', '<C-q>'], ['<C-w>', 'c'], ['<C-w>', '<C-c>']];

public async exec(position: Position, vimState: VimState): Promise<VimState> {
new QuitCommand({}).execute();
Expand All @@ -2650,7 +2650,7 @@ class CommandQuit extends BaseCommand {
@RegisterAction
class CommandOnly extends BaseCommand {
modes = [ModeName.Normal];
keys = [['<C-w>', 'o'], ['<C-w>', 'C-o']];
keys = [['<C-w>', 'o'], ['<C-w>', '<C-o>']];

public async exec(position: Position, vimState: VimState): Promise<VimState> {
new OnlyCommand({}).execute();
Expand All @@ -2662,7 +2662,7 @@ class CommandOnly extends BaseCommand {
@RegisterAction
class MoveToRightPane extends BaseCommand {
modes = [ModeName.Normal, ModeName.Visual, ModeName.VisualLine];
keys = [['<C-w>', 'l'], ['<C-w>', '<right>'], ['<C-w l>']];
keys = [['<C-w>', 'l'], ['<C-w>', '<right>'], ['<C-w l>'], ['<C-w>', '<C-l>']];

public async exec(position: Position, vimState: VimState): Promise<VimState> {
vimState.postponedCodeViewChanges.push({
Expand All @@ -2677,7 +2677,7 @@ class MoveToRightPane extends BaseCommand {
@RegisterAction
class MoveToLowerPane extends BaseCommand {
modes = [ModeName.Normal, ModeName.Visual, ModeName.VisualLine];
keys = [['<C-w>', 'j'], ['<C-w>', '<down>'], ['<C-w j>']];
keys = [['<C-w>', 'j'], ['<C-w>', '<down>'], ['<C-w j>'], ['<C-w>', '<C-j>']];

public async exec(position: Position, vimState: VimState): Promise<VimState> {
vimState.postponedCodeViewChanges.push({
Expand All @@ -2692,7 +2692,7 @@ class MoveToLowerPane extends BaseCommand {
@RegisterAction
class MoveToUpperPane extends BaseCommand {
modes = [ModeName.Normal, ModeName.Visual, ModeName.VisualLine];
keys = [['<C-w>', 'k'], ['<C-w>', '<up>'], ['<C-w k>']];
keys = [['<C-w>', 'k'], ['<C-w>', '<up>'], ['<C-w k>'], ['<C-w>', '<C-k>']];

public async exec(position: Position, vimState: VimState): Promise<VimState> {
vimState.postponedCodeViewChanges.push({
Expand All @@ -2707,7 +2707,7 @@ class MoveToUpperPane extends BaseCommand {
@RegisterAction
class MoveToLeftPane extends BaseCommand {
modes = [ModeName.Normal, ModeName.Visual, ModeName.VisualLine];
keys = [['<C-w>', 'h'], ['<C-w>', '<left>'], ['<C-w h>']];
keys = [['<C-w>', 'h'], ['<C-w>', '<left>'], ['<C-w h>'], ['<C-w>', '<C-h>']];

public async exec(position: Position, vimState: VimState): Promise<VimState> {
vimState.postponedCodeViewChanges.push({
Expand Down Expand Up @@ -2742,7 +2742,7 @@ class BaseTabCommand extends BaseCommand {
@RegisterAction
class VerticalSplit extends BaseCommand {
modes = [ModeName.Normal, ModeName.Visual, ModeName.VisualLine];
keys = ['<C-w>', 'v'];
keys = [['<C-w>', 'v'], ['<C-w>', '<C-v>']];

public async exec(position: Position, vimState: VimState): Promise<VimState> {
vimState.postponedCodeViewChanges.push({
Expand Down