nvimtools / hydra.nvim

Create custom submodes and menus
MIT License
145 stars 8 forks source link

Can't remove "hint.border" message when using lazyvim #35

Closed sollymay closed 5 months ago

sollymay commented 7 months ago

Hi team!

First of all, thank you so much for taking this over and maintaining it!

I have been using hydra.nvim for a while and now I am getting the message:

[Hydra.nvim] Option "hint.border" has been deprecated and will be removed on 2024-02-01 -- See hint.float_opt

I thought I could just get rid of it by adding a:

  opts = {
    hint = false,
  },

on the config and on the hydras themselves, but it doesn't seem to work and I keep getting the message. Is there an easy way to get rid of the warning? My guess is that since lazyvim is using the old hint.border, I will always get this message?

Here's my config:

return {
  "nvimtools/hydra.nvim",
  opts = {
    hint = false,
  },
  config = function()
    local Hydra = require("hydra")

    Hydra({
      name = "Change / Resize Window",
      mode = { "n" },
      body = "<C-w>",
      config = {
        hint = false,
      },
      heads = {
        -- move between windows
        { "<C-h>", "<C-w>h" },
        { "<C-j>", "<C-w>j" },
        { "<C-k>", "<C-w>k" },
        { "<C-l>", "<C-w>l" },

        -- resizing window
        { "H", "<C-w>3<" },
        { "L", "<C-w>3>" },
        { "K", "<C-w>2+" },
        { "J", "<C-w>2-" },

        -- equalize window sizes
        { "e", "<C-w>=" },

        -- close active window
        { "Q", ":q<cr>" },
        { "<C-q>", ":q<cr>" },

        -- exit this Hydra
        { "q", nil, { exit = true, nowait = true } },
        { ";", nil, { exit = true, nowait = true } },
        { "<Esc>", nil, { exit = true, nowait = true } },
      },
    })
  end,
}
miversen33 commented 6 months ago

Did you "see hint.float_opts" as the error rightly points you? Check out the hint section of the readme which explains this more

sollymay commented 6 months ago

My config has hint as false globally and for the hydra I have, so I am not using hints for hydra and expected not to get a message for hints when I don’t use them?On Apr 3, 2024, at 1:52 PM, Mike Iversen @.***> wrote: Did you "see hint.float_opts" as the error rightly points you? Check out the hint section of the readme which explains this more

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

miversen33 commented 6 months ago

Interesting, good point. I will dig into this more tonight and see what is going on :)

miversen33 commented 6 months ago

So here's something interesting. Your config works fine with the following lazy.nvim configuration

-- repro.lua
--
-- To use this, simply run
-- nvim --clean -u repro.lua
local root = vim.fn.fnamemodify('./.repro', ':p')
for _, name in ipairs({ 'config', 'data', 'state', 'cache' }) do
  vim.env[('XDG_%s_HOME'):format(name:upper())] = root .. '/' .. name
end
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)
local plugins = {
  'folke/tokyonight.nvim',
  {
    'https://github.com/nvimtools/hydra.nvim',
    config = function()
      local hydra = require('hydra')
      hydra({
         name = "Change / Resize Window",
         mode = { "n" },
         body = "<C-w>",
         config = {
           hint = false,
         },
         heads = {
           -- move between windows
           { "<C-h>", "<C-w>h" },
           { "<C-j>", "<C-w>j" },
           { "<C-k>", "<C-w>k" },
           { "<C-l>", "<C-w>l" },

           -- resizing window
           { "H", "<C-w>3<" },
           { "L", "<C-w>3>" },
           { "K", "<C-w>2+" },
           { "J", "<C-w>2-" },

           -- equalize window sizes
           { "e", "<C-w>=" },

           -- close active window
           { "Q", ":q<cr>" },
           { "<C-q>", ":q<cr>" },

           -- exit this Hydra
           { "q", nil, { exit = true, nowait = true } },
           { ";", nil, { exit = true, nowait = true } },
           { "<Esc>", nil, { exit = true, nowait = true } },
         },
       })
    end,
  },
}
require('lazy').setup(plugins, { root = root .. '/plugins' })
vim.cmd.colorscheme('tokyonight')

Can you verify 2 things for me quick?

1) What is your neovim version you are running?
2) Does the above reproduction configuration "work" as expected for you?

sollymay commented 6 months ago

Hi, I just tested and replying here:

  1. I'm using nvim v0.9.5
  2. This does work as expected

What do you think the problem is now that you have more insight into what might be going on? Do I need to open an issue with lazyvim team for them to fix something?

Thank you!

miversen33 commented 5 months ago

Possibly. I am not intimately familiar with LazyVim, it could be that they are pinned to an older version of hydra which is causing you this issue.

That is my current guess as you are getting an old deprecation warning (which has been removed as of the date it says in the warning).

It might be worth investigating that some. Maybe see if you can point your LazyVim version to the "latest" commit of Hydra? I have no idea how to do this but I suspect its something that is configurable

sollymay commented 5 months ago

Thanks!

That gave me all the info I needed. Found out that I had two versions of hydra and that I had a dependency in hydra due to using multicursors.nvim which uses another fork of hydra that still has the old message. I will raise a ticket in @smoka7 fork to either move to use this fork of hydra or to update the fork so that the message is no longer shown.