stevearc / oil.nvim

Neovim file explorer: edit your filesystem like a buffer
MIT License
3.46k stars 99 forks source link

bug: opens the file in the floating mode modal #330

Open sebasruiz09 opened 4 months ago

sebasruiz09 commented 4 months ago

Did you check the docs and existing issues?

Neovim version (nvim -v)

0.9.5 Release

Operating system/version

Arch linux 6.7.8-arch1-1

Describe the bug

when i open oil in floating mode, and while i keep it open i open a telescope window and open a file, it opens in the floating oil modal.

image

What is the severity of this bug?

minor (annoyance)

Steps To Reproduce

  1. open oil in float mode
  2. open telescope
  3. select file in live_grep or find_files
  4. open this file

Expected Behavior

think the Oil window should be closed.

Directory structure

No response

Repro

return {
  "stevearc/oil.nvim",
  event = "VimEnter",
  keys = {
    { "<leader>e", "<cmd>Oil --float<cr>", mode = { "n" }, desc = "File explorer" },
  },
  opts = {
    default_file_exporer = true,
    view_options = {
      show_hidden = true,
    },
   columns = {
        "icon",
    --"mtime",
    --"size",
      },
    float = {
      padding = 2,
      max_width = 155,
      max_height = 32,
      border = "rounded",
      win_options = {
        winblend = 0,
      },
      preview = {
        max_width = 0.9,
        min_width = { 40, 0.4 },
        width = nil,
        max_height = 0.9,
        min_height = { 5, 0.1 },
        height = nil,
        border = "rounded",
        win_options = {
          winblend = 0,
        },
        update_on_cursor_moved = true,
      },
      override = function(conf)
        return conf
      end,
    },
  },
}

Did you check the bug with a clean config?

stevearc commented 4 months ago

Please use the minimal init.lua template in the bug report template to produce a single file that I can use to reproduce the issue.

sebasruiz09 commented 4 months ago

Please use the minimal init.lua template in the bug report template to produce a single file that I can use to reproduce the issue.

yes, I have also used the minimum configuration and the bug is reproduced in the same way.

return {
  "stevearc/oil.nvim",
  config = function()
    require("oil").setup({})
  end,
}
stevearc commented 4 months ago

I mean use a full minimal init.lua file such as below

-- 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/oil.nvim",
    config = function()
      require("oil").setup({})
    end,
  },
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

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

and provide exact steps (keymaps, commands) to reproduce the issue

sebasruiz09 commented 4 months ago
  1. install lazy , Oil and Telescope in init.lua
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({
    "git",
    "clone",
    "--filter=blob:none",
    "https://github.com/folke/lazy.nvim.git",
    "--branch=stable", -- latest stable release
    lazypath,
  })
end
vim.opt.rtp:prepend(lazypath)

require("lazy").setup({
  {
    "stevearc/oil.nvim",
    config = function()
      require("oil").setup({})
    end,
  },
  {
    "nvim-telescope/telescope.nvim",
    tag = "0.1.6",
    dependencies = { "nvim-lua/plenary.nvim" },
  },
})
  1. reload neovim and open Oil in float mode

    Oil --float
  2. Open any file with telescope or :edit

    :edit init.lua

    the file opens, but in the oil pop-up window