Skip to content

Is there a way find out what EditMode is set? #26

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

Closed
dfinke opened this issue Sep 14, 2013 · 2 comments
Closed

Is there a way find out what EditMode is set? #26

dfinke opened this issue Sep 14, 2013 · 2 comments

Comments

@dfinke
Copy link

dfinke commented Sep 14, 2013

I think I'd like a hot key to cycle through edit modes. Something like this.

Set-PSReadlineKeyHandler -BriefDescription 'swap modes' -Key 'ctrl+m' -Handler {

    $mode="windows"
    if (Get-PSReadlineOption.EditMode -eq "windows") {
        $mode="emacs"
    }

    Set-PSReadlineOption -EditMode $mode
 }
@lzybkr
Copy link
Contributor

lzybkr commented Sep 14, 2013

The module doesn't actually keep track of what mode you're in. When you change modes, the key binding table is cleared and initialized from a preset table for the respective modes.

If you switch modes, you lose any custom bindings you may have had.

Given this, I don't think it makes much sense to have a way of getting the current mode.

@lzybkr lzybkr closed this as completed Sep 14, 2013
@lzybkr lzybkr reopened this Oct 6, 2013
@lzybkr
Copy link
Contributor

lzybkr commented Oct 14, 2013

I added a new cmdlet Get-PSReadlineOption so this is now possible. Commit 964b513

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

No branches or pull requests

2 participants