## 事象
以下のように `control + enter` に対して[[VSCode Neovim]]でキーマップを設定しようとしても、実際にはコマンドが実行されない。
```lua
vim.keymap.set("n", "<C-CR>", function()
-- コマンド(省略)
end, opts)
```
### 環境
| 対象 | バージョン |
| ----------------- | ------- |
| [[macOS]] | 15.4.1 |
| [[VSCode]] | 1.100.2 |
| [[VSCode Neovim]] | 1.18.22 |
## 原因
修飾キーやアルファベット/数値以外のショートカットキーは明示的に[[VSCode Neovim]]へ信号を送ることを記載しなければいけないから。
> Every special (control/alt/non-alphanumerical) keyboard shortcut must be explicitly defined in VSCode to send to neovim. By default, only bindings that are used by Neovim by default are sent.
> *[vscode-neovim/vscode-neovim: Vim mode for VSCode, powered by Neovim](https://github.com/vscode-neovim/vscode-neovim?tab=readme-ov-file#keybinding-passthroughs)*
<div class="link-card-v2">
<div class="link-card-v2-site">
<img class="link-card-v2-site-icon" src="https://github.githubassets.com/favicons/favicon.svg" />
<span class="link-card-v2-site-name">GitHub</span>
</div>
<div class="link-card-v2-title">
GitHub - vscode-neovim/vscode-neovim: Vim mode for VSCode, powered by Neovim
</div>
<div class="link-card-v2-content">
Vim mode for VSCode, powered by Neovim. Contribute to vscode-neovim/vscode-neovim development by creating an acc ...
</div>
<img class="link-card-v2-image" src="https://opengraph.githubassets.com/3246d782ac03201284902459640d13d2dfe980e06c662cf08ab3c9f333ff2e63/vscode-neovim/vscode-neovim" />
<a href="https://github.com/vscode-neovim/vscode-neovim?tab=readme-ov-file#keybinding-passthroughs"></a>
</div>
controlキーとの組み合わせで明示的指定が不要なものは以下であり、`control + enter` はこれに該当しない。
> Default: `["a", "b", "d", "e", "f", "h", "i", "j", "k", "l", "m", "o", "r", "t", "u", "v", "w", "x", "y", "z", "/", "]"]`
> *[vscode-neovim/vscode-neovim: Vim mode for VSCode, powered by Neovim](https://github.com/vscode-neovim/vscode-neovim?tab=readme-ov-file#normal-mode-control-keys-passthrough)*
## 解決方法
`control + enter` が押された時に `<C-CR>` を[[VSCode Neovim]]に伝えるよう [[keybindings.json]] に設定を追加する。
```json
{
"command": "vscode-neovim.send",
"key": "ctrl+enter",
"when": "editorTextFocus && neovim.mode != insert",
"args": "<C-CR>"
}
```
## 参考
- [Search | DeepWiki](https://deepwiki.com/search/keymap-vimkeymapsetn-cr-functi_2314425f-7da5-4aa1-9c8b-dcd9adc750c8)