Skip to content

Input window insert-mode keybinds intermittently don't fire #332

Closed

Description

@jemag

Context

I've been running into an issue where my keybinds like <M-m> (switch_mode) and <C-s> (submit_input_prompt) sometimes don't work when pressed in insert mode in the input window. Going back to normal mode and pressing the same key always works fine. The behavior is inconsistent — sometimes the key works in insert mode, sometimes it doesn't.

After digging into it, I think the issue is related to how wrap_with_completion_check works in keymap.lua. Right now, when input window keymaps are registered, setup_window_keymaps is called with defer_to_completion=true, which wraps every input window keymap with the completion visibility check. There is also a similar behavior in the input_window.lua in handle_submit() function.

This wrapping makes sense for keys that could genuinely conflict with completion navigation (like <CR>, <Tab>), but this is not my case and makes it a more painful experience. Basically, there isn't any situation where I would not want <M-m> or <C-s> to do the actions configured.

Feature request:

It would be nice to have a way to control this on a per-keybinding basis and perhaps also globally (i.e. bypass any completion or similar check and ensure keybind does the configured behavior)

Activity

  1. sudo-tee commented on Mar 18, 2026

    @sudo-tee
    Owner

    Would a config to set which mappings you want to sent to the completion work for you ?

  2. jemag commented on Mar 18, 2026

    @jemag
    Author

    sure. Just to be sure I understand, would that mean that the default behavior becomes: keybinds no longer check if completion menu is visible, they always work, unless specified in "a config to set which mappings you want to sent to the completion"

  3. sudo-tee commented on Mar 19, 2026

    @sudo-tee
    Owner

    I would do it in reverse actually, as it would be a breaking change. If the list is empty it will always do the call to defer_to_completion if you provide a list of keys it will use it.

    EDIT:
    Or even a flag in the keymap itself to defer to completion

    Image
  4. added 2 commits that reference this issue on Mar 19, 2026
    d754d00
    2b7e33b
  5. sudo-tee commented on Mar 19, 2026

    @sudo-tee
    Owner

    @jemag

    I created a PR for this, #334

    Let me know if it works for you

  6. jemag commented on Mar 19, 2026

    @jemag
    Author

    @sudo-tee seems to work well so far for non-submit keybinds, although the handle_submit() function I believe is unmodified and still checks for completion being visible, no matter what. In my case, it does not send the keybind currently.

  7. sudo-tee commented on Mar 20, 2026

    @sudo-tee
    Owner

    @jemag

    I removed the check in handle_submit. Let me know if it works for you.

  8. jemag commented on Mar 20, 2026

    @jemag
    Author

    working great so far with the new changes, thanks!

  9. sudo-tee commented on Mar 20, 2026

    @sudo-tee
    Owner

    Great I will merge this :)

  10. added a commit that references this issue on Mar 20, 2026
    5dd388d
  11. added a commit that references this issue on Jul 23, 2026
    6ad2cdb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions