stevearc / stickybuf.nvim

Neovim plugin for locking a buffer to a window
MIT License
246 stars 7 forks source link

The telescope.nvim will open a file with insert mode while using this plugin #26

Closed nullptr-yxw closed 9 months ago

nullptr-yxw commented 10 months ago

While using this plugin, the telescope.nvim will open a file with insert mode.

https://github.com/stevearc/stickybuf.nvim/assets/96286337/0e9512c8-d556-4cc8-9781-c116321423cb

(You can see the mode in lualine)

--stickybuf.lua
return {
    "stevearc/stickybuf.nvim",
    enabled = true,
    opts = {},
}
--telescope.lua
return {
    'nvim-telescope/telescope.nvim',
    dependencies = { 'nvim-lua/plenary.nvim' },
    opts = {},
}

If I disable this plugin, the telescope.nvim will open a file with normal mode as expect

https://github.com/stevearc/stickybuf.nvim/assets/96286337/7d51887e-c314-4571-8de5-840f82419edf

--stickybuf.lua, which disables the plugin
return {
    "stevearc/stickybuf.nvim",
    enabled = false,
    opts = {},
}
stevearc commented 10 months ago

I tried reproducing this with the following minimal init file

-- save as repro.lua
-- run with nvim -u repro.lua
-- DO NOT change the paths
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "runtime", "cache" }) do
    vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
    vim.fn.system({
        "git",
        "clone",
        "--filter=blob:none",
        "--single-branch",
        "https://github.com/folke/lazy.nvim.git",
        lazypath,
    })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
    "folke/tokyonight.nvim",
    -- add any other plugins here
    "stevearc/stickybuf.nvim",
    {
        "nvim-telescope/telescope.nvim",
        dependencies = { "nvim-lua/plenary.nvim" },
        opts = {},
    },
}
require("lazy").setup(plugins, {
    root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here

Using Telescope find_files I could not reproduce the issue. The files seem to open in normal mode. Could you find a minimal init file where the issue repros?

nullptr-yxw commented 10 months ago

I tried reproducing this with the following minimal init file

-- save as repro.lua
-- run with nvim -u repro.lua
-- DO NOT change the paths
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "runtime", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({
      "git",
      "clone",
      "--filter=blob:none",
      "--single-branch",
      "https://github.com/folke/lazy.nvim.git",
      lazypath,
  })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  "folke/tokyonight.nvim",
  -- add any other plugins here
  "stevearc/stickybuf.nvim",
  {
      "nvim-telescope/telescope.nvim",
      dependencies = { "nvim-lua/plenary.nvim" },
      opts = {},
  },
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here

Using Telescope find_files I could not reproduce the issue. The files seem to open in normal mode. Could you find a minimal init file where the issue repros?

I retried it, and find the bug will only happen when both stickybuf.nvim, the telescope and dashboard-nvim are loaded And the minimal init file is:

-- save as repro.lua
-- run with nvim -u repro.lua
-- DO NOT change the paths
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "runtime", "cache" }) do
        vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
        vim.fn.system({
                "git",
                "clone",
                "--filter=blob:none",
                "--single-branch",
                "https://github.com/folke/lazy.nvim.git",
                lazypath,
        })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
        -- add any other plugins here
        {
                "stevearc/stickybuf.nvim",
                opts = {},
        },
        {
                "nvim-telescope/telescope.nvim",
                dependencies = { "nvim-lua/plenary.nvim" },
                opts = {},
        },
        {
                "nvimdev/dashboard-nvim",
                opts = {
                        theme = "doom",
                },
        },
}
require("lazy").setup(plugins, {
        root = root .. "/plugins",
})

-- add anything else here

Using Telescope find_files and open a file in telescope's insert mode (for example, type a file name and press enter), and the bug will be reproduced.

stevearc commented 9 months ago

Should be fixed