aymericbeaumet / vim-symlink

:running: Automagically follow symlinks
MIT License
74 stars 10 forks source link

:vim[grep] throws many errors and is extremely slow when searching in symlinked directories #17

Open jamilraichouni opened 1 year ago

jamilraichouni commented 1 year ago

Hi!

First I want to say thank you for this really helpful plugin (especially when combined with vim-fugitive).

When I search something recursively in Neovim 0.9.2 via the command

:vim /PATTERN/ /path/to/a/symlinked/dir/**/*

I get many E937: Attempt to delete a buffer that is in use: /some/path error messages.

When I uninstall vim-symlink the same command runs just fine and very quick.

BTW: Installing the optional dependency moll/vim-bbye does also help. At the same time I'd be happy to avoid installing an additional plugin.

I created a Dockerfile with which one can easily reproduce the error. To build the Docker image place a file named Dockerfile in some temp directory and run

docker build -t bug .

in that directory.

To run the Docker container run docker run --rm -it bug afterwards.

FROM fedora:38

RUN dnf install -y git neovim
RUN mkdir -p $HOME/.config/nvim/lua
RUN echo 'lua require("init")' > $HOME/.config/nvim/init.vim
RUN echo -e 'return {{"aymericbeaumet/vim-symlink"}}' > $HOME/.config/nvim/lua/plugins.lua
RUN echo -e '\
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"\n\
if not vim.loop.fs_stat(lazypath) then\n \
    vim.fn.system({\n \
        "git",\n \
        "clone",\n \
        "--filter=blob:none",\n \
        "https://github.com/folke/lazy.nvim.git",\n \
        "--branch=stable", -- latest stable release\n \
        lazypath,\n \
    })\n \
end\n \
vim.opt.rtp:prepend(lazypath)\n \
require("plugins")\n \
require("lazy").setup("plugins", {\n \
    ui = {\n \
        border = "rounded",\n \
        size = { width = 0.6, height = 0.9 },\n \
    }\n \
})\n' > $HOME/.config/nvim/lua/init.lua

RUN nvim --headless -c'Lazy sync' -c'q'
RUN ln -s /usr/share $HOME
CMD nvim -c'vim /PATTERN/ $HOME/share/**/*'

When the optional dependency moll/vim-bbye is being added (4th RUN statement below) the search runs without any error:

FROM fedora:38

RUN dnf install -y git neovim
RUN mkdir -p $HOME/.config/nvim/lua
RUN echo 'lua require("init")' > $HOME/.config/nvim/init.vim
RUN echo -e 'return {{"aymericbeaumet/vim-symlink", dependencies = {"moll/vim-bbye"}}}' > $HOME/.config/nvim/lua/plugins.lua
RUN echo -e '\
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"\n\
if not vim.loop.fs_stat(lazypath) then\n \
    vim.fn.system({\n \
        "git",\n \
        "clone",\n \
        "--filter=blob:none",\n \
        "https://github.com/folke/lazy.nvim.git",\n \
        "--branch=stable", -- latest stable release\n \
        lazypath,\n \
    })\n \
end\n \
vim.opt.rtp:prepend(lazypath)\n \
require("plugins")\n \
require("lazy").setup("plugins", {\n \
    ui = {\n \
        border = "rounded",\n \
        size = { width = 0.6, height = 0.9 },\n \
    }\n \
})\n' > $HOME/.config/nvim/lua/init.lua

RUN nvim --headless -c'Lazy sync' -c'q'
RUN ln -s /usr/share $HOME
CMD nvim -c'vim /PATTERN/ $HOME/share/**/*'