Skip to content
This repository was archived by the owner on Apr 1, 2020. It is now read-only.

Ctrl+PageUp/Ctrl+PageDown bindings don't work #404

Closed
unclechu opened this issue Apr 26, 2017 · 6 comments
Closed

Ctrl+PageUp/Ctrl+PageDown bindings don't work #404

unclechu opened this issue Apr 26, 2017 · 6 comments
Assignees
Labels
Milestone

Comments

@unclechu
Copy link

I have bindings like this;

" moving tabs
nnoremap <C-S-PageUp>   :tabm-1<CR>
nnoremap <C-S-PageDown> :tabm+1<CR>

" jump by half of screen by pageup/pagedown
nmap <PageUp>     <C-u>
nmap <PageDown>   <C-d>
xmap <PageUp>     <C-u>
xmap <PageDown>   <C-d>
" default jump by pageup/pagedown with shift prefix
nmap <S-PageUp>   <C-b>
nmap <S-PageDown> <C-f>
xmap <S-PageUp>   <C-b>
xmap <S-PageDown> <C-f>

But only these works in the Oni:

nmap <PageUp>     <C-u>
nmap <PageDown>   <C-d>
xmap <PageUp>     <C-u>
xmap <PageDown>   <C-d>
@bryphe
Copy link
Member

bryphe commented Apr 26, 2017

Thanks for the issue! There are a few places where we are hard-coding keybindings in the code (while working on a full solution for #20). Out of the box, <C-PageUp> and <C-PageDown> switch between active Oni processes, but I think I may be the only one using that functionality and it isn't well documented.

They are hardcoded here in browser/src/index.tsx:

        if (key === "<f12>") {
            commandManager.executeCommand("oni.editor.gotoDefinition", null)
        } else if (key === "<C-p>" && screen.mode === "normal") {
            quickOpen.show()
        } else if (key === "<C-P>" && screen.mode === "normal") {
            tasks.show()
        } else if (key === "<C-pageup>") {
            multiProcess.focusPreviousInstance()
        } else if (key === "<C-pagedown>") {
            multiProcess.focusNextInstance()
        } else {
            instance.input(key)
        }

For the <C-pageup> and <C-pagedown> bindings, we could do an interim solution while #20 is in progress:

  • Create commands to represent these, like oni.nextActiveProcess and oni.previousActiveProcess
  • Create a VimL bridge for executing commands (like OniExecuteCommand('oni.nextActiveProcess')), and then in my init.vim I can include these bindings. Once the work for Synchronizing VimScript keybindings. #20 is complete, I could include these in config.js instead.

@bryphe bryphe added the bug label Apr 26, 2017
@bryphe bryphe added this to the 0.3 milestone Apr 26, 2017
@Bretley
Copy link
Contributor

Bretley commented Apr 26, 2017

@extr0py I think we should have a list of Oni commands based on object lookup defined by key mappings. This would make it so that you could define oni operations in your config.js and then have them mapped to a fast object lookup. This way we can avoid if-statements piling up and not have any hardcoding of keys.

@bryphe bryphe self-assigned this Apr 27, 2017
@bryphe
Copy link
Member

bryphe commented Apr 27, 2017

@bert88sta - 👍 , I agree, this seems like a natural time to even bring in a keybindings.js so we can stop baking in commands and start having them be configurable. This would remove a large chunk of if-statements especially in index.tsx.

@Bretley
Copy link
Contributor

Bretley commented Apr 27, 2017 via email

@bryphe
Copy link
Member

bryphe commented Sep 2, 2017

With PR #633 , you can now opt-out of the default pageup/pagedown behavior.

You'll need to add these to the activate method of your config.js:

// Opt-out of default bindings for pageup/pagedown
oni.input.unbind("<c-pageup>")
oni.input.unbind("<c-pagedown>")

More information on keyboard bindings here: https://github.com/extr0py/oni/wiki/Configuration#keyboard-bindings

@bryphe
Copy link
Member

bryphe commented Sep 2, 2017

I'll close this for now, but let me know if you have any questions, or feel free to reopen if this doesn't solve the problem.

@bryphe bryphe closed this as completed Sep 2, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants