telescope.nvim icon indicating copy to clipboard operation
telescope.nvim copied to clipboard

Files open in insert mode when using reactive.nvim

Open ImmanuelHaffner opened this issue 5 months ago • 1 comments

Description

Error Description

When using Telescope together with reactive.nvim plugin, opening files from the picker immediately enters insert mode.

Potentially Related Issues

  • https://github.com/nvim-telescope/telescope.nvim/issues/2027
  • https://github.com/nvim-telescope/telescope.nvim/issues/2501
  • https://github.com/nvim-telescope/telescope.nvim/issues/2785
  • https://github.com/nvim-telescope/telescope.nvim/issues/2766

My reactive config

return {
    { 'rasulomaroff/reactive.nvim',
        config = function()
            local reactive = require'reactive'
            reactive.add_preset{
                name = 'default',
                init = function()
                    -- making our cursor to use `MyCursor` highlight group
                    vim.opt.guicursor:append('a:MyCursor')
                    vim.opt.cursorline = true

                    -- Configure colors of cursorline and colorcolumn
                    vim.cmd[[
                    hi! ColorColumn guifg=Red guibg='#380000'
                    hi! CursorLine guibg=#021020
                    hi! CursorLineNr gui=bold
                    ]]
                end,
                lazy = false,
                priority = 100,
                modes = {
                    n = {
                        winhl = {
                            -- we use `winhl` because we want to highlight CursorLine only in a current window, not in all of them
                            -- if you want to change global highlights, use the `hl` field instead.
                            CursorLine = { bg = '#102947' },
                            CursorLineNr = { fg = '#0b1d33', bg = '#98c379' },
                        },
                    },
                    no = {
                        -- You can also specify winhl and hl that will be applied with every operator
                        winhl = {},
                        hl = {},
                        operators = {
                            d = {
                                winhl = {
                                    CursorLine = { bg = '#450a0a' },
                                },
                                hl = {
                                    MyCursor = { bg = '#fca5a5' },
                                },
                            },
                            y = {
                                winhl = {
                                    CursorLine = { bg = '#422006' },
                                },
                                hl = {
                                    MyCursor = { bg = '#fdba74' },
                                }
                            }
                        }
                    },
                    i = {
                        winhl = {
                            CursorLine = { bg = '#0b1d33' },
                            CursorLineNr = { fg = '#0b1d33', bg = '#61afef' },
                        },
                        hl = {
                            MyCursor = { bg = '#ff6b6b' },
                        },
                    },
                    [{ 'v', 'V', '\x16' }] = {
                        winhl = {
                            CursorLineNr = { fg = '#0b1d33', bg = '#c678dd' },
                        },
                    },
                },
            }
        end,
    }
}

Neovim version

NVIM v0.9.5
Build type: Release
LuaJIT 2.1.1702233742

Operating system and version

ArchLinux, 6.6.8-arch1-1

Telescope version / branch / rev

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

===== 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

Telescope Extension: `ui-select` ~
- No healthcheck provided

Steps to reproduce

Telescope find_files, then open, e.g. with <C-x>

Expected behavior

Normal mode

Actual behavior

Insert mode

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()
  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()]]

ImmanuelHaffner avatar Jan 24 '24 13:01 ImmanuelHaffner

This is likely an upstream neovim issue that was fixed recently. You can try out the nightly build of neovim.

I could try myself but I need a proper minimal config, not just an extract from your config. Please edit the minimal config in the issue template adding the smallest amount of changes to replicate the bug.

jamestrew avatar Jan 24 '24 15:01 jamestrew