mikavilpas / yazi.nvim

A Neovim Plugin for the yazi terminal file manager
MIT License
243 stars 7 forks source link

Can't call yazi when the plugin is installed via vimplug #48

Closed lucasreis1 closed 2 months ago

lucasreis1 commented 2 months ago

I'd like to apologize in advance because I feel like this issue is entirely my fault, as I'm still stuck on a legacy plugin manager for vim because I can't deal with porting everything to lazynvim right now. Anyway, here's how I installed the plugin:

" These two plugins are required for yazi nvim
Plug 'mikavilpas/yazi.nvim'
Plug 'nvim-lua/plenary.nvim'

And here's my config.lua

require("yazi").setup({
  keys = {
    {
      "<leader>e",
      function()
        require("yazi").yazi()
      end,
      { desc = "Open the file manager" },
    },
  },
  ---@type YaziConfig
  opts = {
    open_for_directories = false,
  },
})

The issue in question is that my combination key simply does not work. Any guidance is appreciated!

mikavilpas commented 2 months ago

Hi! Looks like your approach can work fine, but I think it maybe mixes up lazy.nvim style setup with yazi specific setup. Try this instead:

local yazi = require("yazi")

yazi.setup(
  ---@type YaziConfig
  {
    open_for_directories = false,
  }
)

vim.keymap.set("n", "<leader>e", function()
  yazi.yazi()
end, { noremap = true, silent = true, desc = "Open the file manager" })

If you have your lua language server setup, it should provide you with basic autocompletion, although that is of course optional:

image

lucasreis1 commented 2 months ago

Thank you. Your solution did indeed work. I'll try setting up the language server for lua, seems like it might be useful in the future!