Vscode: Allow to use Ctrl P/N for up and down navigation in quick open

Created on 20 Jun 2016  Â·  12Comments  Â·  Source: microsoft/vscode

  • VSCode Version: 1.2.1
  • OS Version: 10.11.5

Steps to Reproduce:

  1. Invoke command palette
  2. Begin typing a query i.e. ext
  3. Attempt to move up/down the list with ctrl+p and ctrl+n

I installed the latest version of VS Code (1.2.1) on El Capitan. When I used the Atom (and ST2?) text editor and invoked the command palette I could cursor up/down the list using ctrl+p/ctrl+n.

For example, if I launch the command palette and search for extension I get the following list:

Extensions: Install Extension
Extensions: Show Extension Recommendations
Extensions: Show Installed Extensions
Extensions: Show Outdated Extensions

If I want to get to 'Show Installed Extensions' I would press ctrl+n twice in Atom. When I try doing this with VS Code nothing happens. In looking at the Default Keyboard Shortcuts there are:

{ "key": "ctrl+p", "command": "cursorUp", "when": "editorTextFocus" },
{ "key": "ctrl+n", "command": "cursorDown", "when": "editorTextFocus" },
feature-request verification-needed verified

Most helpful comment

@joaomoreno I can create a new patch to make it work as you liked (not needing enter to select). However my opinion on the matter is that it shouldn't work that way, ctrl+p/ctrl+n work universally as up and down arrows on mac (this is true for vscode too apart from quickOpenWidget as only part of my patch was reverted).

All 12 comments

Fix: implement Ctrl P and Ctrl N for Up and Down.

Fixed by #7316

@bpasero Adding you since the changes are quick open widget, not in the tree.

@joaomoreno I can create a new patch to make it work as you liked (not needing enter to select). However my opinion on the matter is that it shouldn't work that way, ctrl+p/ctrl+n work universally as up and down arrows on mac (this is true for vscode too apart from quickOpenWidget as only part of my patch was reverted).

Yes, useful to note that ctrl+p/ctrl+n work nicely when navigating the auto-complete popup. I agree with @elemongw that certainly on a mac, ctrl+p/ctrl+n are common aliases for up/down everywhere. I've always taken this as being originally of emacs heritage, so this behaviour is common on linux, too.

I added new commands workbench.action.quickOpenSelectNext and workbench.action.quickOpenSelectPrevious which on macOS are bound to Ctrl+N and Ctrl+P by default and work only when quick open is visible.

The difference to the commands workbench.action.quickOpenNavigateNext and workbench.action.quickOpenNavigatePrevious is that upon releasing the key, the item will be opened.

  • [ ] To verify:
    On macOS you can use Ctrl+N and Ctrl+P to navigate inside the opened quick open up and down, similar to arrow up and arrow down.

@bpasero also cmd+p navigates in quick open (instead of changing the quick open topic to open file). Is that a regression from this?

@jrieken no this is actually behaviour we have ever since quick navigation in quick open to make @joaomoreno happy because he uses Cmd+E to bring up quick open and another Cmd+E to quickly open the element.

Can be controlled via

{ "key": "cmd+p", "command": "workbench.action.quickOpenNavigateNext", "when": "inQuickOpen" }

Unsure how this is related to cmd+e? I am talking about cmd+p. Do the following

  • hit cmd+p, see file picker
  • while file picker shows, hit F1, see command picker
  • while command picker shows, hit cmd+p, some item selected

I removed Cmd+P and Cmd+E to select and execute the command when quick open is visible. The commands are still there if someone wants to keep it. Also fixes https://github.com/Microsoft/vscode/issues/10957

Thank you for this fix @bpasero – my favourite feature in this release!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vsccarl picture vsccarl  Â·  3Comments

VitorLuizC picture VitorLuizC  Â·  3Comments

mrkiley picture mrkiley  Â·  3Comments

sirius1024 picture sirius1024  Â·  3Comments

curtw picture curtw  Â·  3Comments