Search code examples
powershellvim-pluginneovimwindows-terminal

<C-space> doesn't work in neovim in PowerShell in Windows terminal


everyone!

I’m configuring neovim for “Windows terminal”. And I installed the coc plugin. And I would like to use for triggering suggestions like in VSC. But the problem is that in neovim doesn't work at all.

This is the remap I try to use:

" Use <c-space> to trigger completion.
if has('nvim')
    inoremap <silent><expr> <c-space> coc#refresh()
else
    inoremap <silent><expr> <c-@> coc#refresh()
endif

I tried:

inoremap <silent><expr> <Nul> coc#refresh()
inoremap <silent><expr> <c-@> coc#refresh()

and they don’t work either.

Also I tried to check if works with other remaps:

inoremap <c-@> print<cr>
inoremap <c-space> print<cr>
inoremap <Nul> print<cr>

And even directly with powershell, command prompt, bash and cmder terminals it didn’t type “print” text.

And BTW ctrl+space works directly in “windows terminal” and PowerShell as autocomplete. Can someone tell me please, is it neovim or terminal issue?

Did someone solve this problem previously?

I discovered the internet before posting and the only thing I found is this 2 years old article and it didn’t help.


Solution

  • https://github.com/neovim/neovim/issues/8435#issuecomment-2119332145 C:\Users\UserName\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json

    {
      "actions": [
        {
          "keys": "ctrl+space",
          "command": {
            "action": "sendInput",
            "input": "\u001b[32;5u"
          }
        }
      ]
    }
    

    This solved a problem for me.