vuejs / vitepress

Vite & Vue powered static site generator.

Home Page:https://vitepress.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

add new key binding (like ctrl-p and ctrl-n) to select adjacent search items

shellRaining opened this issue · comments

Is your feature request related to a problem? Please describe.

just an enhancement , I found I can't select next item when type ctrl-n

Describe the solution you'd like

add Ctrl-n binding to select the next search item, while Ctrl-p to select prev.

Describe alternatives you've considered

No response

Additional context

I really like this project, and also like the Vim-style key bindings. So I wish to add these two mappings.

I really hope to be able to participate in this project. If this enhancement is adopted, I am happy to submit a PR~

Validations

Why do you want to select search results? 👀 Do you want to avoid doing arrow down/up + return?

Moreover ctrl/cmd + p is for printing and ctrl/cmd + n is for new window. It would conflict with those.

I often use the search function.

First, press Ctrl-k to open the search box
then enter the search text, and then use the up or down keys to select a matching entry.
Finally, press Enter to view the full article.

However, up or down are quite far away. I hope I can use Ctrl-n or Ctrl-p instead.

Why do you want to select search results? 👀 Do you want to avoid doing arrow down/up + return?

Moreover ctrl/cmd + p is for printing and ctrl/cmd + n is for new window. It would conflict with those.

Oh, sorry, I am using a Mac keyboard. I forgot that Ctrl n and Ctrl p are browser shortcuts.

That seems not a good suggestion.

However, up or down are quite far away.

? They are literally reachable without stretching hand!

image

Can we just do this key mapping for Mac, I found that Next.js documentation can use shortcuts like Ctrl-n

However, up or down are quite far away.

? They are literally reachable without stretching hand!

Moving the little finger to up or down will make the right hand leave its original position, I think it's uncomfortable 😂