nvim-telescope / telescope.nvim

Find, Filter, Preview, Pick. All lua, all the time.
MIT License
15.22k stars 813 forks source link

Some normal mode mappings don't work #2891

Open AntonC9018 opened 7 months ago

AntonC9018 commented 7 months ago

Description

Some default vim normal mode mappings don't work, while in a telescope window, e.g. u, p, possibly others.

Neovim version

NVIM v0.9.4
Build type: Release
LuaJIT 2.1.1700008891

Operating system and version

macOS Sonoma 14.2.1

Telescope version / branch / rev

0.1.5

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 14.1.0
- WARNING fd: not found. Install [sharkdp/fd](https://github.com/sharkdp/fd) for extended capabilities

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

Steps to reproduce

  1. :Telescope
  2. Type something
  3. Esc to enter normal mode
  4. Vy to copy (works, but V selects the caret too, which is intended?)
  5. p doesn't work.

Expected behavior

No response

Actual behavior

Pasting doesn't work?

Minimal config

vim.cmd [[set runtimepath=$VIMRUNTIME]]
vim.cmd [[set packpath=/tmp/nvim/site]]
-- just the default config
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()
  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()]]
jamestrew commented 7 months ago

This is just the behavior of the prompt buffer using vim's buftype='prompt' option.

Normal commands are only available on the last line of the buffer. So p will work on the if you type in insert mode first to create a line and go back to normal mode and try to paste. It's a little weird, I'd admit. I can't seem to get u to work but <c-r> works and :undo works. Maybe some of this behavior is a bug, maybe there's a good reason I'm not sure. But part of the point of prompt buffers is to restrict available commands so plugins using them don't have to handle arbitrary commands.

I'm not sure it's telescope's responsibility to "fix" them. Even if we wanted to, it could result in even less intuitive behaviors.

AntonC9018 commented 7 months ago

Sure... Is there a way to change the buffer type telescope uses then? Because it's unintuitive imo that paste works in insert mode but not in normal mode, it just makes no sense whatsoever to me as a user

jamestrew commented 7 months ago

I think that would break more things 😕