mikavilpas / yazi.nvim

A Neovim Plugin for the yazi terminal file manager
MIT License
488 stars 16 forks source link

Opening yazi in neovim is slow to respond #518

Open mochouaaaaa opened 1 day ago

mochouaaaaa commented 1 day ago

https://github.com/user-attachments/assets/5b411f67-3564-48b1-bf74-6ac6804f647c

When you open it in Kitty, you can't detect the response problem, but it's obvious in Neovim. No log file was found for the plugin's survival, indicating that my environment meets its requirements, so how can I locate the problem?

mikavilpas commented 1 day ago

Could you please try https://github.com/mikavilpas/yazi.nvim/blob/main/documentation/reproducing-issues.md ?

mochouaaaaa commented 1 day ago

repro.lua

    -- You can use this file to reproduce an issue with your configuration.

    ---@module "yazi"
    ---@module "lazy"

    -- DO NOT change the paths and don't remove the colorscheme
    local root = vim.fn.fnamemodify("./.repro", ":p")

    -- set stdpaths to use .repro
    for _, name in ipairs({ "config", "data", "state", "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",
            "https://github.com/folke/lazy.nvim.git",
            lazypath,
        })
    end
    vim.opt.runtimepath:prepend(lazypath)
    vim.g.mapleader = " "

    -- install the following plugins
    ---@type LazySpec
    local plugins = {
        { "catppuccin/nvim", name = "catppuccin", opts = { flavour = "macchiato" } },
        {
            "mikavilpas/yazi.nvim",
            event = "VeryLazy",
            keys = {
                {
                    "<leader>-",
                    "<cmd>Yazi<cr>",
                    desc = "Open yazi at the current file",
                },
                {
                    -- Open in the current working directory
                    "<leader>cw",
                    "<cmd>Yazi cwd<cr>",
                    desc = "Open the file manager in nvim's working directory",
                },
                {
                    -- NOTE: this requires a version of yazi that includes
                    -- https://github.com/sxyazi/yazi/pull/1305 from 2024-07-18
                    "<c-up>",
                    "<cmd>Yazi toggle<cr>",
                    desc = "Resume the last yazi session",
                },
            },
            ---@type YaziConfig
            opts = {
                open_for_directories = false,
            },
        },
    }
    require("lazy").setup(plugins, {
        root = root .. "/plugins",
        install = { colorscheme = { "catppuccin" } },
    })

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

Log

[2024-10-16 21:03:47] DEBUG YaziFloatingWindow opening (content_buffer: 4, win: 1003)
[2024-10-16 21:03:47] DEBUG Opening yazi with the command: (yazi '/Users/mochou/.config/nvim' --chooser-file /var/folders/nj/l3cj2f0n4kvb43sdg_5mkyh40000gn/T/nvim.mochou/GnnOvW/0 --client-id 511382738877524).
[2024-10-16 21:03:47] DEBUG Opening ya with the command: (ya sub rename,delete,trash,move,cd,hover,bulk), attempt 0
[2024-10-16 21:03:47] DEBUG ya stderr: 'Error: No running Yazi instance found

Caused by:'
[2024-10-16 21:03:47] DEBUG Looks like starting ya failed because yazi had not started yet. Retrying to open ya...
[2024-10-16 21:03:47] DEBUG ya stderr: '
    Connection refused (os error 61)
'
[2024-10-16 21:03:47] DEBUG ya stdout: ''
[2024-10-16 21:03:47] DEBUG Opening ya with the command: (ya sub rename,delete,trash,move,cd,hover,bulk), attempt 1
[2024-10-16 21:03:47] DEBUG ya stderr: 'Error: No running Yazi instance found

Caused by:
    Connection refused (os error 61)
'
[2024-10-16 21:03:47] DEBUG Looks like starting ya failed because yazi had not started yet. Retrying to open ya...
[2024-10-16 21:03:47] DEBUG ya stdout: ''
[2024-10-16 21:03:47] DEBUG Opening ya with the command: (ya sub rename,delete,trash,move,cd,hover,bulk), attempt 2
[2024-10-16 21:03:47] DEBUG ya stderr: 'Error: No running Yazi instance found

Caused by:
    Connection refused'
[2024-10-16 21:03:47] DEBUG Looks like starting ya failed because yazi had not started yet. Retrying to open ya...
[2024-10-16 21:03:47] DEBUG ya stderr: ' (os error 61)
'
[2024-10-16 21:03:47] DEBUG ya stdout: ''
[2024-10-16 21:03:47] DEBUG Opening ya with the command: (ya sub rename,delete,trash,move,cd,hover,bulk), attempt 3
[2024-10-16 21:03:47] DEBUG ya stderr: 'Error: No running Yazi instance found

Caused by:
'
[2024-10-16 21:03:47] DEBUG Looks like starting ya failed because yazi had not started yet. Retrying to open ya...
[2024-10-16 21:03:47] DEBUG ya stderr: '    Connection refused (os error 61)
'
[2024-10-16 21:03:47] DEBUG ya stdout: ''
[2024-10-16 21:03:47] DEBUG Opening ya with the command: (ya sub rename,delete,trash,move,cd,hover,bulk), attempt 4
[2024-10-16 21:03:47] DEBUG ya stderr: 'Error: '
[2024-10-16 21:03:47] DEBUG ya stderr: 'No running Yazi instance found

Caused by:
    Connection refused (os error 61)
'
[2024-10-16 21:03:47] DEBUG Looks like starting ya failed because yazi had not started yet. Retrying to open ya...
[2024-10-16 21:03:47] DEBUG ya stdout: ''
[2024-10-16 21:03:47] DEBUG Opening ya with the command: (ya sub rename,delete,trash,move,cd,hover,bulk), attempt 5
[2024-10-16 21:03:47] DEBUG ya stderr: 'Error: No running Yazi instance found

Caused by:
    Connection refused (os error 61)
'
[2024-10-16 21:03:47] DEBUG Failed to open ya after 5 retries
[2024-10-16 21:03:47] DEBUG ya stdout: ''

shell, use brew install yazi

╰─❯ which ya
/usr/local/bin/ya

╰─❯ which yazi
/usr/local/bin/yazi
mikavilpas commented 1 day ago

Thanks. It looks like the default repro.lua reproduces the issue for you. I do not get the same slowness effect on my system, however.

I think it means the issue is outside of yazi.nvim.

Can you post the output of :checkhealth yazi?

Here's mine for comparison:


==============================================================================
yazi:                                           require("yazi.health").check()

yazi ~
- Running yazi.nvim version 6.4.1
- Found `yazi` version `Yazi 0.3.3 (dcbe787 2024-10-06)` 👍
- yazi.nvim log file is at /Users/mikavilpas/.local/state/nvim/yazi.log
-     hint: use `gf` to open the file path under the cursor
- Found `ya` version `Ya 0.3.3 (dcbe787 2024-10-06)` 👍
- You have enabled `open_for_directories` in your config. Because of this, please make sure you are loading yazi when Neovim starts.

yazi.config ~
- hint: execute the following command to see your configuration: >
  :lua =require('yazi').config

- OK yazi
mochouaaaaa commented 1 day ago

Thanks. It looks like the default repro.lua reproduces the issue for you. I do not get the same slowness effect on my system, however.谢谢。看起来默认的 repro.lua 为您重现了该问题。然而,我的系统并没有受到同样的缓慢影响。

I think it means the issue is outside of yazi.nvim.我认为这意味着问题不在 yazi.nvim 之外。

Can you post the output of :checkhealth yazi?您可以发布:checkhealth yazi的输出吗?

Here's mine for comparison:这是我的比较:

==============================================================================
yazi:                                           require("yazi.health").check()

yazi ~
- Running yazi.nvim version 6.4.1
- Found `yazi` version `Yazi 0.3.3 (dcbe787 2024-10-06)` 👍
- yazi.nvim log file is at /Users/mikavilpas/.local/state/nvim/yazi.log
-     hint: use `gf` to open the file path under the cursor
- Found `ya` version `Ya 0.3.3 (dcbe787 2024-10-06)` 👍
- You have enabled `open_for_directories` in your config. Because of this, please make sure you are loading yazi when Neovim starts.

yazi.config ~
- hint: execute the following command to see your configuration: >
  :lua =require('yazi').config

- OK yazi

==============================================================================
yazi: require("yazi.health").check()

yazi ~
- Running yazi.nvim version 6.4.1
- Found `yazi` version `Yazi 0.3.3 (Homebrew 2024-10-13)` 👍
- yazi.nvim log file is at /Users/mochou/.local/state/nvim/yazi.log
-     hint: use `gf` to open the file path under the cursor
- Found `ya` version `Ya 0.3.3 (Homebrew 2024-10-13)` 👍
- WARNING The `resolve_relative_path_application` (`grealpath`) is not found on PATH. Please either install it, make sure it is on your PATH, or set `config.keymaps.copy_relative_path_to_selected_files = nil` in your configuration.
- The default application (realpath) should be installed on most linux systems by default. On OSX, the default (grealpath) can be found in https://formulae.brew.sh/formula/coreutils

yazi.config ~
- hint: execute the following command to see your configuration: >
  :lua =require('yazi').config

- OK yazi