Oni: Some shortcuts or command palette commands do not work

Created on 1 Aug 2018  路  4Comments  路  Source: onivim/oni

Oni Version:

0.3.6

Operating System:

MacOS High Sierra

Issue:

Some of the key bindings or command palette commands do not work for me

Expected behavior:

When I hit ctrl + p I should see the quick open pane - unfortunately it works only when invoked with cmd + p (muscle memory from terminal vim). I've even tried to add binding to the Onivim config but it didn't work for me (according to here it should work out of the box):

export const activate = (oni: Oni.Plugin.Api) => {
  console.log("config activated")

  const isNormalMode = () => oni.editors.activeEditor.mode === "normal"

  oni.input.unbind("<c-p>")

  oni.input.bind("<c-p>", () =>
    isNormalMode() && !oni.menu.isMenuOpen()
  )
}

Also some of the commands from command palette are not working i.e. Toggle Bufferlist works only when invoked with ctrl + tab. When I invoke it from command palette, nothing happens; the same for Open Bufferlist command.

Actual behavior:

  • When I hit ctrl + p I should see quick open pane
  • When I select buffer command from command palette it should be executed

Steps to reproduce:

  • ctrl + p results in displaying quick open pane
  • Selecting buffer related command from command palette executes successfully
bug

All 4 comments

for me (according to here it should work out of the box):

So the line you've linked is actually in an if statement of "If mac do a bunch of cmd binds, if not mac do a bunch of ctrl binds". I think this is since most other editors/programs use cmd on Mac? I'm not a mac user so I can't quite be sure. But the line you should be looking at is:

https://github.com/onivim/oni/blob/e2c3fef196db096aa371a19d3c91bd285850c23c/browser/src/Input/KeyBindings.ts#L44

(Where m/meta is what the key resolver library classes cmd as, which is why your binding isn't working as well).
So it is correct that ctrl-p doesn't work on mac, and it is instead cmd-p.

As to why there is a mix of cmd and ctrl binds on mac.....I'm honestly not too sure. Toggle Bufferlist is set to be Ctrl-tab on mac, but I'm not sure why that and other commands are not using cmd (@Akin909 ?)

Both Toggle/Open Bufferlist don't work for me, so it looks like there is some bug there though.

@CrossR thanks for the response.

So the line you've linked is actually in an if statement of "If mac do a bunch of cmd binds, if not mac do a bunch of ctrl binds".

You are right, sorry I missed that part. However I think it should be possible to create my own binding for <c-p>, should't it? At the moment it does not work if I use the code from the first post.

I think this is since most other editors/programs use cmd on Mac? I'm not a mac user so I can't quite be sure.

Yes, most programs use cmd on mac which is represented as <m-something> key in bindings.

but I'm not sure why that and other commands are not using cmd

<cmd-tab> is reserved (default shortcut) for switching between application on the system level.

Yep, I think the binding would be:

oni.input.unbind("<m-p>")
oni.input.bind(
    "<c-p>",
    "quickOpen.show",
    () => isNormalMode() && !oni.menu.isMenuOpen()
)

And ah! That would make a lot of sense, I hadn't realised some system things were on cmd binds.

@CrossR thanks for correct binding, it works for me now (there was small typo in your example - missing comma after "quickOpen.show")!

Was this page helpful?
0 / 5 - 0 ratings