Skip to content

Add optional support for vim and emac bindings - #1838

Merged
SBoudrias merged 11 commits into
SBoudrias:mainfrom
internettrans:vim-emac-bindings
Oct 13, 2025
Merged

SBoudrias merged 11 commits into
SBoudrias:mainfrom
internettrans:vim-emac-bindings

Conversation

@internettrans

Copy link
Copy Markdown
Contributor

#1822 removed the vim and emacs keybindings - this adds an option to @inquirer/select to support them again.

@codecov

codecov Bot commented Sep 20, 2025 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@9b226bd). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1838   +/-   ##
=======================================
  Coverage        ?   95.77%           
=======================================
  Files           ?       45           
  Lines           ?     2792           
  Branches        ?      741           
=======================================
  Hits            ?     2674           
  Misses          ?      109           
  Partials        ?        9           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@SBoudrias

Copy link
Copy Markdown
Owner

Hey 👋🏻 Thanks for the PR.

Do you feel strongly about having those in Inquirer? It does still conflict with the search functionality in the select prompt.

Personally I'm leaning towards not re-adding the feature at all.

@internettrans

Copy link
Copy Markdown
Contributor Author

I am a vim user who tries for home row navigation wherever possible, so I'll probably stay on old version of @inquirer/prompts or use my fork of it, if needed. I was confused and disappointed when a fresh install of a library that uses inquirer broke that behavior for me, due to the dependencies within inquirer being listed with ^ syntax so that the change in behavior happens even without updating the @inquirer/prompts version in package.json.

I don't use the search functionality with the select prompt, and ended up downgrading, pinning, and bundling @inquirer/prompts and its dependencies to be able to continue using the vim bindings. See single-spa/heeler#16 and single-spa/heeler#17

@SBoudrias

Copy link
Copy Markdown
Owner

I'm open to bringing it back, but this PR will need some extra work:

  1. We should turn off searches if bindings are on
  2. We'll need to cover the checkbox prompt as well

@internettrans

Copy link
Copy Markdown
Contributor Author

Updated with your feedback

@heavenshell

Copy link
Copy Markdown

Hi,
I'm using @lerna-lite/version in my project( @lerna-lite/version use @inquirer/select )
Recently, after updating from @lerna-lite/version v4.6.2 to v4.9.0,
I was very confused about unable to use the j / k navigation keys that had worked previously.

I'm very happy to use j / k again, but if it conflicts with other features,
how about making Ctrl-N and Ctrl-P usable again in Emacs keybindings?

@LitoMore

LitoMore commented Oct 6, 2025 •

Copy link
Copy Markdown
Collaborator

Since the Emacs keymap does not break the search feature, how about splitting this option into two? For example:

keybindings: ['emacs', 'vim']
keybindings: ['emacs']
keybindings: ['vim']

@craiganderson-iotv

craiganderson-iotv commented Oct 6, 2025 •

Copy link
Copy Markdown

I'm super keen for this, and in the meantime the workaround to get j/k back again is to add the following overrides to your package.json:

"overrides": {
  "@inquirer/core": "10.1.0",
  "@inquirer/prompts": {
    "@inquirer/core": "10.1.0"
  }
}

And also pin the following versions:

"@inquirer/input": "4.2.1",
"@inquirer/prompts": "7.8.3"

@SBoudrias

Copy link
Copy Markdown
Owner

@LitoMore has a good interface proposal, let's refactor to adopt this syntax #1838 (comment)

Comment thread packages/checkbox/src/index.ts Outdated
@SBoudrias

Copy link
Copy Markdown
Owner

Went ahead fixing conflicts and changing the interface as per @LitoMore's suggestion.

@LitoMore

Copy link
Copy Markdown
Collaborator

We can consider making the ['emacs'] as the default.

@SBoudrias

Copy link
Copy Markdown
Owner

Yeah I considered that, but I think it's a future conflict waiting to happen. So I prefer to intentionally disable by default.

@SBoudrias
SBoudrias merged commit f1ec92a into SBoudrias:main Oct 13, 2025
11 checks passed
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.

5 participants