Coder Social home page Coder Social logo

Comments (8)

pkulak avatar pkulak commented on August 29, 2024 2

Not terribly related... but does anyone know how to keep which-key from spewing warnings every single startup?

from nixvim.

clemenscodes avatar clemenscodes commented on August 29, 2024 2

Not terribly related... but does anyone know how to keep which-key from spewing warnings every single startup?

I don't know of any native setting to do that, but you could downgrade which-key to a version prior to the breaking change:

{pkgs, ...}: {
  programs = {
    nixvim = {
      plugins = {
        which-key = {
          enable = true;
          package = pkgs.vimPlugins.which-key-nvim.overrideAttrs (oldAttrs: {
            src = pkgs.fetchFromGitHub {
              owner = oldAttrs.src.owner;
              repo = oldAttrs.src.repo;
              rev = "0539da005b98b02cf730c1d9da82b8e8edb1c2d2"; # v2.1.0
              hash = "sha256-gc/WJJ1s4s+hh8Mx8MTDg8pGGNOXxgKqBMwudJtpO4Y=";
            };
          });
        };
      };
    };
  };
}

from nixvim.

khaneliman avatar khaneliman commented on August 29, 2024 1

Not terribly related... but does anyone know how to keep which-key from spewing warnings every single startup?

While looking through the source, I did see https://github.com/folke/which-key.nvim/blob/6c1584eb76b55629702716995cca4ae2798a9cca/lua/which-key/config.lua#L26 which makes it look like you can suppress the warnings about mappings with the notify = false option.

from nixvim.

MattSturgeon avatar MattSturgeon commented on August 29, 2024

Thanks for making an issue and for being so detailed - this is very useful!

I've been meaning to look into this for a few days now.

We could use our transitionType to convert old values to the new type, but I think the best bet is to incorporate this as part of a general update/refactor of the module to use our new-style freeform settings option.

from nixvim.

michaelhthomas avatar michaelhthomas commented on August 29, 2024

Looks like v3 comes with several other breaking changes to configuration options, so to me, it makes sense to just fully overhaul the module as well (in the spirit of which-key v3 being a complete rewrite)

from nixvim.

MattSturgeon avatar MattSturgeon commented on August 29, 2024

(sidenote: in to-lua.nix the comment says:

        If this option is true, attrsets like { __unkeyed.1 = "a"; b = "b"; }
        will render as { "a", b = "b" }

but this is not correct. Here's what I see in nix-repl.

nix-repl> inputs.nixvim.lib.x86_64-linux.helpers.toLuaObject {__unkeyed.1 = "a"; b = "b";}
error: syntax error, unexpected FLOAT, expecting '.' or '='

       at «string»:1:62:

            1| inputs.nixvim.lib.x86_64-linux.helpers.toLuaObject {__unkeyed.1
             |                                                              ^

nix-repl> inputs.nixvim.lib.x86_64-linux.helpers.toLuaObject {__unkeyed1 = "a"; b = "b";}
"{ \"a\", b = \"b\" }"

nix-repl> inputs.nixvim.lib.x86_64-linux.helpers.toLuaObject {__unkeyed1 = "a"; __unkeyed2 = "b";}
"{ \"a\", \"b\" }"

nix-repl> inputs.nixvim.lib.x86_64-linux.helpers.toLuaObject {__unkeyed.a = "a"; b = "b";}
"{ { a = \"a\" }, b = \"b\" }"

I skimmed over this the first time I read. The comment should use quoted attr names, but other than that is is "correct". E.g. this will work: { "__unkeyed.1" = "foo"; }.

I can't recall if we normally use . or - separators elsewhere, but the toLua implementation just checks the key starts with __unkeyed.

from nixvim.

MattSturgeon avatar MattSturgeon commented on August 29, 2024

Looking at the upstream docs: https://github.com/folke/which-key.nvim#%EF%B8%8F-mappings

The wording isn't concrete, but I get the impression the add() method is now preferred over the spec config option?

Either way I think the config option would still be a better fit for nixvim's module.

EDIT:

I also noticed other related issues still open. Some of these may be resolved already:

from nixvim.

MattSturgeon avatar MattSturgeon commented on August 29, 2024

Another work-around until we provide a propper solution is to remove your plugins.which-key.registrations definition and instead call require('which-key').add with the new format.

I've done this in my config: MattSturgeon/nix-config@e0cb861

EDIT: You can now use plugins.which-key.settings.spec which I've updated my config to use here: MattSturgeon/nix-config@b1fcbde

from nixvim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.