Skip to content

to_fuzzy_refine does not work with <C-Space> mapping in Powershell in Windows Terminal #2646

@kmoschcau

Description

@kmoschcau

Description

So I know this sounds weird, but for some reason to_fuzzy_refine does no longer seem to work with the <C-Space> mapping. I can't say when exactly this started, I only really noticed it recently.

When I run the live_grep builtin, <C-Space> no longer does anything. It is still listed in the output of :imap <C-Space> when in the live_grep input buffer. There is no other key mapping listed. It does also still show up in the telescope help.

At first I tried to explicitly define it in my config like so:

local actions = require "telescope.actions"
require("telescope").setup {
  pickers = {
    live_grep = {
      mappings = {
        i = {
          ["<C-Space>"] = actions.to_fuzzy_refine,
        },
      },
    },
  },
}

This also does not do anything. The mapping still shows up in :imap output and help.

Then I just had a hunch and simply changed the mapping to <C-f> and suddenly the fuzzy refine works. Both mappings show up in :imap output, pointing at the same line in the plugin's code. They also show up in the telescope help.

Oh and <C-Space> works in general. The cmp plugin for example uses it, so it shouldn't be the terminal emulator swallowing it or something like that.

Addendum

It turns out this only happens with the neovim instance running on Windows in Powershell 7.3.6 in Windows Terminal. The neovim instance running in WSL2/fish 3.6.1 in the same Windows Terminal does not exhibit this behavior, even with the same minimal config.
Version of the working neovim instance:

NVIM v0.10.0-dev
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3

Addendum 2

Turns out <C-Space> does not work in the windows instance at all. I must have misremembered. So it might just be that this is caused by either the older neovim version or Powershell

Neovim version

NVIM v0.9.1
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe /MD /Zi /O2 /Ob1  -W3 -wd4311 -wd4146 -DUNIT_TESTING -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -D_WIN32_WINNT=0x0602 -DMSWIN -DINCLUDE_GENERATED_DECLARATIONS -ID:/a/neovim/neovim/.deps/usr/include/luajit-2.1 -ID:/a/neovim/neovim/.deps/usr/include -ID:/a/neovim/neovim/.deps/usr/include -ID:/a/neovim/neovim/build/src/nvim/auto -ID:/a/neovim/neovim/build/include -ID:/a/neovim/neovim/build/cmake.config -ID:/a/neovim/neovim/src -ID:/a/neovim/neovim/.deps/usr/include -ID:/a/neovim/neovim/.deps/usr/include -ID:/a/neovim/neovim/.deps/usr/include -ID:/a/neovim/neovim/.deps/usr/include -ID:/a/neovim/neovim/.deps/usr/include -ID:/a/neovim/neovim/.deps/usr/include -ID:/a/neovim/neovim/.deps/usr/include

   system vimrc file: "$VIM\sysinit.vim"
  fall-back for $VIM: "C:/Program Files (x86)/nvim/share/nvim"

Operating system and version

Windows 11 (22H2 (OS Build 22621.2134))

Telescope version / branch / rev

branch 0.1.x (776b509)

checkhealth telescope

==============================================================================
telescope: require("telescope.health").check()

Checking for required plugins ~
- OK plenary installed.
- OK nvim-treesitter installed.

Checking external dependencies ~
- OK rg: found ripgrep 13.0.0
- OK fd: found fd 8.7.0

===== Installed extensions ===== ~

Telescope Extension: `fzf` ~
- OK lib working as expected
- OK file_sorter correctly configured
- OK generic_sorter correctly configured

Telescope Extension: `notify` ~
- No healthcheck provided

Steps to reproduce

  1. nvim -nu minimal.lua
  2. press Ctrl+/ (<C-_>)
  3. press <C-Space> -> nothing happens
  4. press <C-f> -> fuzzy refine is activated

Expected behavior

Fuzzy refine activates on <C-Space>.

Actual behavior

Fuzzy refine does not activate on <C-Space>, but does for other key mappings.

Minimal config

vim.cmd [[set runtimepath=$VIMRUNTIME]]
vim.cmd [[set packpath=/tmp/nvim/site]]
local package_root = '/tmp/nvim/site/pack'
local install_path = package_root .. '/packer/start/packer.nvim'
local function load_plugins()
  require('packer').startup {
    {
      'wbthomason/packer.nvim',
      {
        'nvim-telescope/telescope.nvim',
        requires = {
          'nvim-lua/plenary.nvim',
          { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make' },
        },
      },
      -- ADD PLUGINS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
    },
    config = {
      package_root = package_root,
      compile_path = install_path .. '/plugin/packer_compiled.lua',
      display = { non_interactive = true },
    },
  }
end
_G.load_config = function()
  require('telescope').setup {
    pickers = {
      live_grep = {
        mappings = {
          i = {
            ["<C-f>"] = require("telescope.actions").to_fuzzy_refine,
          },
        },
      },
    },
  }
  require('telescope').load_extension('fzf')
  -- ADD INIT.LUA SETTINGS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
end
if vim.fn.isdirectory(install_path) == 0 then
  print("Installing Telescope and dependencies.")
  vim.fn.system { 'git', 'clone', '--depth=1', 'https://github.com/wbthomason/packer.nvim', install_path }
end
load_plugins()
require('packer').sync()
vim.cmd [[autocmd User PackerComplete ++once echo "Ready!" | lua load_config()]]

vim.keymap.set("n", "<C-_>", require("telescope.builtin").live_grep, {
  desc = "Open telescope live grep search.",
  silent = true,
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions