Add support for using Emacs keymap to move cursor

It’s better to add the simple Emacs keymap support for the command palette.

I strongly recommend finding an Emacs and Vim expert in your team to be a consultant for this feature. If there is not. I would like to help.

I only mentioned Emacs keymap here because Vim is using h j k l for moving the cursor. I don’t think it’s easy to implement. Maybe Vim experts can give a good suggestion on this.

Here are some basic keymap examples:

  • control + p: Up
  • control + n: Down
  • control + g: Cancel
  • control + u: Delete from end of line
  • control + k: Delete from start of line

Which product is also using Emacs keymap for moving the cursor

  • Alfred
  • Apple Spotlight Search
  • Cerebro
  • Most of the dropdowns on macOS, iPadOS (I don’t have a Windows device, so I don’t know how the ecosystem in Windows is)
    • Chrome’s dropdowns: address bar, <select>, …
    • Safari’s dropdowns
    • GitHub’s File Finder

Some information

macOS and some Linux operating system has built-in support for control + p and control + n to control the page scrolling. So we should only enable the feature when the input field is focused. The File Finder on GitHub implemented this feature very well. You can refer to the File Finder.

4 Likes

Thanks @LitoMore for all the detailed feedback / feature request! Our accessibility team is currently working on a keyboard shortcut remapping feature that might be able to address the use case you’ve described above. I’ve shared this with the related teams so they can consider this as they scope out and design the feature

1 Like

ctrl-p and ctrl-n work on basically every list view on macOS, so having them makes for a very seamless experience, and having them not work on the command palette is very jarring. Especially since command palettes are keyboard-first UI paradigms by design.

Fingers crossed!

1 Like