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 support for za Vim binding #4160

Merged
merged 3 commits into from
Oct 15, 2019
Merged

Add support for za Vim binding #4160

merged 3 commits into from
Oct 15, 2019

Conversation

aquova
Copy link
Contributor

@aquova aquova commented Oct 11, 2019

What this PR does / why we need it:
Adds support for the Vim 'za' keybinding, which toggles a fold.

Which issue(s) this PR fixes
#1453

Special notes for your reviewer:
This simply binds the new VSCode editor.toggleFold option to the 'za' combination. I was unable to find a way to implement specifying a number modifier, as you need to know whether or not to travel up or down.

@xconverge
Copy link
Member

xconverge commented Oct 11, 2019

@RegisterAction
class CommandToggleFold extends CommandFold {
  keys = ['z', 'a'];
  commandName = 'editor.toggleFold';
  public async exec(position: Position, vimState: VimState): Promise<VimState> {
    await vscode.commands.executeCommand(this.commandName);
    vimState.cursors = await getCursorsAfterSync();
    await vimState.setCurrentMode(ModeName.Normal);
    return vimState;
  }
}

This seems to work better for me? are you using the foldFix configuration option?

@xconverge
Copy link
Member

Without the getCursors sync and foldFix when I toggle it closed it reopens right away unless you are perfectly on the start of the fold (ie. not within the folded region"

@aquova
Copy link
Contributor Author

aquova commented Oct 11, 2019

Yes, it seems you're right. When foldFix is disabled, I'm seeing it reopen unless you're directly on the start of the fold.

aquova and others added 2 commits October 14, 2019 21:21

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@xconverge
Copy link
Member

Looks good and when I tested it it seems to work fine-ish, except for the whole foldFix concept but thats another ticket!

@xconverge xconverge merged commit e6b6f99 into VSCodeVim:master Oct 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants