nixvim icon indicating copy to clipboard operation
nixvim copied to clipboard

[BUG] hardtime.nvim defaults cannot be removed in Nixvim

Open mariemachtmiau opened this issue 1 year ago • 2 comments

Field Description
Plugin hardtime
Nixpkgs doesn't matter
Home Manager doesn't matter

  • [x] I have read the FAQ and my bug is not listed there.

Description

Hardtime has default disabled keys (the arrow keys). To remove them (so allow them again), the user is supposed to pass an empty list (see https://github.com/m4xshen/hardtime.nvim/issues/20 for an example). But nixvim strips out the empty lists etc.

I think setting either/both "removeEmptyAttrValues" or "removeEmptyListEntries" when calling helpers.toLua in the module might be enough? (or rather, not using the default toLuaObject but toLua'?) https://github.com/nix-community/nixvim/blob/main/plugins/utils/hardtime.nix#L236

Minimal, Reproducible Example (MRE)

programs.nixvim = {
  plugins.hardtime.disabledKeys = {
    "<Up>" = [];
  };
}

mariemachtmiau avatar Sep 02 '24 15:09 mariemachtmiau

As a workaround for now, you should be able to set "<Up>".__raw = "{}".

I'd personally like to get rid of the "empties filtering" completely, across nixvim but that's challenging because a) we currently need it to remove undefined sub-options and b) some users may be relying on the behaviour in their own configs.

MattSturgeon avatar Sep 02 '24 15:09 MattSturgeon

As a workaround for now, you should be able to set "<Up>".__raw = "{}".

Thanks, will try that! Yeah I figured the filtering is some legacy thing which probably was a good idea at the start but now bites in the back ^^

mariemachtmiau avatar Sep 04 '24 13:09 mariemachtmiau