Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

keymap: Support <D-...> (super/command key). #4317

Merged
merged 1 commit into from Feb 22, 2016

Conversation

Projects
None yet
4 participants
@justinmk
Copy link
Member

justinmk commented Feb 22, 2016

Adds support for:

  • api:vim_input("<D-a>")
  • ":nnoremap <C-D-S-...>" and permutations thereof

UIs must capture the modifier and send it as "<D-...>" to vim_input().

Note: Before this commit, any arbitrary ":nnoremap <{foo}-{bar}>"
mapping could already be invoked with feedkeys("\<{foo}-{bar}>"). This
commit supports "D-" as a modifier that can be combined with "C-", "A-",
"S-" in any order.

For non-GUI (terminal) support, user must:

:set <D-a>={CSI sequence}

then send the {CSI sequence} from their terminal. But this does not work
yet (regression #2204).

Closes #2190

@@ -4967,6 +4962,9 @@ insert_special (
* Only use mod_mask for special keys, to avoid things like <S-Space>,
* unless 'allow_modmask' is TRUE.
*/
if (mod_mask & MOD_MASK_CMD) { // Command-key never produces a normal key.
allow_modmask = true;
}

This comment has been minimized.

@justinmk

justinmk Feb 22, 2016

Author Member

from Vim's gui_mac.c

if ((modifiers & MOD_MASK_SHIFT) && ASCII_ISALPHA(key)) {
key = TOUPPER_ASC(key);
modifiers &= ~MOD_MASK_SHIFT;
if (!(modifiers & MOD_MASK_CMD)) { // Command-key is special

This comment has been minimized.

@justinmk

justinmk Feb 22, 2016

Author Member

from Vim's gui_mac.c

keymap: Support <D-...> (super/command key).
Adds support for:
  - api:vim_input("<D-a>")
  - ":nnoremap <C-D-S-...>" and permutations thereof

UIs must capture the modifier and send it as "<D-...>" to vim_input().

Note: Before this commit, any arbitrary ":nnoremap <{foo}-{bar}>"
mapping could already be invoked with feedkeys("\<{foo}-{bar}>"). This
commit supports "D-" as a modifier that can be combined with "C-", "A-",
"S-" in any order.

For non-GUI (terminal) support, user must:
  :set <D-a>={CSI sequence}
then send the {CSI sequence} from their terminal. But this does not work
yet (regression #2204).

Closes #2190
@justinmk

This comment has been minimized.

Copy link
Member Author

justinmk commented Feb 22, 2016

@equalsraf Looking at neovim-qt's InputConv::modPrefix I'm guessing this might work without any modifications? Is it also possible to capture the super ("Windows") key in gtk?

@equalsraf

This comment has been minimized.

Copy link
Contributor

equalsraf commented Feb 22, 2016

Looking at neovim-qt's InputConv::modPrefix I'm guessing this might work without any modifications?

Yes for Mac OS X it should, cc @rkitover.

Gtk has GDK_SUPER_MASK, in vim-gtk is seems to map to META.

justinmk added a commit that referenced this pull request Feb 22, 2016

Merge pull request #4317 from justinmk/superkey
keymap: Support <D-...> (super/command key).

@justinmk justinmk merged commit e71de26 into neovim:master Feb 22, 2016

2 of 3 checks passed

continuous-integration/travis-ci/pr The Travis CI build failed
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
default Build pr-4317 finished with status SUCCESSFUL
Details

@justinmk justinmk deleted the justinmk:superkey branch Feb 22, 2016

@justinmk

This comment has been minimized.

Copy link
Member Author

justinmk commented Feb 22, 2016

@rogual @rhysd Might be interested in this as well.

@rogual

This comment has been minimized.

Copy link
Contributor

rogual commented Feb 22, 2016

Thanks for the ping, will add this to nv.app

@rogual rogual referenced this pull request Feb 22, 2016

Closed

Support new <D-> modifier #214

@rhysd

This comment has been minimized.

Copy link
Member

rhysd commented Feb 23, 2016

@justinmk

Thanks. I will implement meta key to NyaoVim after next Neovim release.

@rhysd

This comment has been minimized.

Copy link
Member

rhysd commented Aug 7, 2016

@justinmk

This looks not to work in HEAD. I set :nnoremap <D-s> :echo "test"<CR> as precondition. Then I send vim_input('<D-s>') via RPC but nvim did not interpret it as Cmd+s. In insert mode, <D-s> string is inserted as-is.

rhysd added a commit to rhysd/neovim-component that referenced this pull request Aug 7, 2016

consider Cmd/Super key (fix #21)
but this does not look to work yet because of neovim issue.

neovim/neovim#4317 (comment)
@justinmk

This comment has been minimized.

Copy link
Member Author

justinmk commented Aug 7, 2016

@rhysd you need inoremap :)

@rhysd

This comment has been minimized.

Copy link
Member

rhysd commented Aug 8, 2016

@justinmk Ah... sorry 😳

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.