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

Configuring the default mode to a non-normal mode results in unexpected input behavior #3751

Open
WingsZeng opened this issue Nov 9, 2024 · 3 comments

Comments

@WingsZeng
Copy link

WingsZeng commented Nov 9, 2024

Issue description

Configuring the default mode to a non-normal mode, such as 'prompt' in my work environment, leads to unexpected behavior. At startup, I am able to input some letters, which is clearly unexpected. The configured keybinds still work. However, once I switch to normal mode, I am unable to input anything.

I also tried configuring the default mode to 'entersearch' and attempted to input text. The letters appear in the shell instead of the search area.

Minimal reproduction

default_mode "entersearch"

Other Related Information

zellij version 0.41.1

@imsnif
Copy link
Member

imsnif commented Nov 11, 2024

Hey, what are you trying to achieve?

@WingsZeng
Copy link
Author

Hey, what are you trying to achieve?

I previously configured the default mode to "prompt" instead of the usual "normal" mode. Just like in Vim, where you need to press a key to enter "insert" mode, I need to press a key to switch from "prompt" mode to "normal" mode.

It works well in Zellij version 0.40, but after upgrading to version 0.41.1, I'm unable to enter input normally after switching to "normal" mode.

I want to be able to input normally when switching to "normal" mode while the default mode is set to "prompt."

Here is a part of my configuration:

keybinds clear-defaults=true {
    normal {
        bind "Esc" { SwitchToMode "Prompt"; }
    }
    locked {
        bind "Shift Esc" { SwitchToMode "Prompt"; }
    }
    search {
        bind "Esc" { ScrollToBottom; SwitchToMode "Prompt"; }
        bind "j" "Down" { ScrollDown; }
        bind "k" "Up" { ScrollUp; }
        bind "PageDown" { PageScrollDown; }
        bind "PageUp" { PageScrollUp; }
        bind "n" { Search "down"; }
        bind "N" { Search "up"; }
        bind "c" { SearchToggleOption "CaseSensitivity"; }
        bind "w" { SearchToggleOption "Wrap"; }
        bind "o" { SearchToggleOption "WholeWord"; }
    }
    prompt {
        bind "Ctrl d" { CloseFocus; }
        bind "Ctrl v" { SwitchToMode "Locked"; }
        bind "i" { SwitchToMode "Normal"; }
        bind "e" { EditScrollback; SwitchToMode "Locked"; }
        bind "_" { NewPane "Down"; }
        bind "|" { NewPane "Right"; }
        bind "f" { ToggleFocusFullscreen; }
        bind "Space" { TogglePaneEmbedOrFloating; }
        bind "/" { SwitchToMode "EnterSearch"; SearchInput 0; }
        bind "j" "Down" { ScrollDown; }
        bind "k" "Up" { ScrollUp; }
        bind "PageDown" { PageScrollDown; }
        bind "PageUp" { PageScrollUp; }
        bind "Esc" "Enter" "G" { ScrollToBottom; }
        bind "J" { GoToPreviousTab; }
        bind "K" { GoToNextTab; }
        bind "Ctrl h" { MovePane "Left"; }
        bind "Ctrl j" { MovePane "Down"; }
        bind "Ctrl k" { MovePane "Up"; }
        bind "Ctrl l" { MovePane "Right"; }
    }
    entersearch {
        bind "Esc" { SwitchToMode "Prompt"; }
        bind "Enter" { SwitchToMode "Search"; }
    }
    shared {
        bind "Alt =" "Alt +" { Resize "Increase"; }
        bind "Alt -" { Resize "Decrease"; }
        bind "Alt 1" { GoToTab 1; }
        bind "Alt 2" { GoToTab 2; }
        bind "Alt 3" { GoToTab 3; }
        bind "Alt 4" { GoToTab 4; }
        bind "Alt 5" { GoToTab 5; }
        bind "Alt 6" { GoToTab 6; }
        bind "Alt 7" { GoToTab 7; }
        bind "Alt 8" { GoToTab 8; }
        bind "Alt 9" { GoToTab 9; }
        bind "Ctrl t" { NewTab; }
    }
    shared_except "locked" {
        bind "Alt h" { MoveFocus "Left"; }
        bind "Alt l" { MoveFocus "Right"; }
        bind "Alt j" { MoveFocus "Down"; }
        bind "Alt k" { MoveFocus "Up"; }
        bind "Ctrl w" { CloseTab; }
        bind "Alt z" { TogglePaneFrames; }
    }
}

default_mode "prompt"

@imsnif
Copy link
Member

imsnif commented Nov 12, 2024

I think this was not really supposed to work in the first place... Maybe the new non-colliding keybindings preset will work for you? More info here: https://zellij.dev/tutorials/colliding-keybindings/

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