plugins.which-key.settings

Options provided to the require('which-key').setup function.

Type: attribute set of anything

Default: { }

Example:

{
  delay = 200;
  expand = 1;
  notify = false;
  preset = false;
  replace = {
    desc = [
      [
        "<space>"
        "SPACE"
      ]
      [
        "<leader>"
        "SPACE"
      ]
      [
        "<[cC][rR]>"
        "RETURN"
      ]
      [
        "<[tT][aA][bB]>"
        "TAB"
      ]
      [
        "<[bB][sS]>"
        "BACKSPACE"
      ]
    ];
  };
  spec = [
    {
      __unkeyed-1 = "<leader>b";
      group = "Buffers";
      icon = "󰓩 ";
    }
    {
      __unkeyed = "<leader>c";
      group = "Codesnap";
      icon = "󰄄 ";
      mode = "v";
    }
    {
      __unkeyed-1 = "<leader>bs";
      group = "Sort";
      icon = "󰒺 ";
    }
    {
      __unkeyed-1 = [
        {
          __unkeyed-1 = "<leader>f";
          group = "Normal Visual Group";
        }
        {
          __unkeyed-1 = "<leader>f<tab>";
          group = "Normal Visual Group in Group";
        }
      ];
      mode = [
        "n"
        "v"
      ];
    }
    {
      __unkeyed-1 = "<leader>w";
      group = "windows";
      proxy = "<C-w>";
    }
    {
      __unkeyed-1 = "<leader>cS";
      __unkeyed-2 = "<cmd>CodeSnapSave<CR>";
      desc = "Save";
      mode = "v";
    }
    {
      __unkeyed-1 = "<leader>db";
      __unkeyed-2 = {
        __raw = ''
          function()
            require("dap").toggle_breakpoint()
          end
        '';
      };
      desc = "Breakpoint toggle";
      mode = "n";
      silent = true;
    }
  ];
  win = {
    border = "single";
  };
}

Declared by:

plugins.which-key.settings.debug

Enable wk.log in the current directory.

Type: null or boolean or raw lua code

Default: null

Plugin default: false

Declared by:

plugins.which-key.settings.defer

Start hidden and wait for a key to be pressed before showing the popup.

Only used by enabled xo mapping modes.

Type: null or lua function string

Default: null

Plugin default:

{
  __raw = ''
    function(ctx)
      return ctx.mode == "V" or ctx.mode == "<C-V>
     end'';
}

Declared by:

plugins.which-key.settings.delay

Delay before showing the popup. Can be a number or a function that returns a number.

Type: null or signed integer or raw lua code

Default: null

Plugin default:

{
  __raw = ''
    function(ctx)
      return ctx.plugin and 0 or 200
    end
  '';
}

Declared by:

plugins.which-key.settings.expand

Expand groups when <= n mappings.

Type: null or signed integer or floating point number or raw lua code

Default: null

Plugin default: 0

Declared by:

plugins.which-key.settings.filter

Filter used to exclude mappings

Type: null or lua function string

Default: null

Plugin default:

{
  __raw = ''
    function(mapping)
      return true
    end
  '';
}

Declared by:

plugins.which-key.settings.notify

Show a warning when issues were detected with your mappings.

Type: null or boolean or raw lua code

Default: null

Plugin default: true

Declared by:

plugins.which-key.settings.preset

Preset style for WhichKey. Set to false to disable.

Type: null or one of “classic”, “modern”, “helix”, false or raw lua code

Default: null

Plugin default: "classic"

Declared by:

plugins.which-key.settings.show_help

Show a help message in the command line for using WhichKey.

Type: null or boolean or raw lua code

Default: null

Plugin default: true

Declared by:

plugins.which-key.settings.show_keys

Show the currently pressed key and its label as a message in the command line.

Type: null or boolean or raw lua code

Default: null

Plugin default: true

Declared by:

plugins.which-key.settings.sort

Mappings are sorted using configured sorters and natural sort of the keys.

Type: null or (list of (one of “local”, “order”, “group”, “alphanum”, “mod”, “manual”, “case” or raw lua code))

Default: null

Plugin default:

[
  "local"
  "order"
  "group"
  "alphanum"
  "mod"
]

Declared by:

plugins.which-key.settings.spec

WhichKey automatically gets the descriptions of your keymaps from the desc attribute of the keymap. So for most use-cases, you don’t need to do anything else.

However, the mapping spec is still useful to configure group descriptions and mappings that don’t really exist as a regular keymap.

Please refer to the plugin’s documentation.

Type: null or (list of ((attribute set of anything) or raw lua code))

Default: null

Plugin default: [ ]

Example:

[
  {
    __unkeyed-1 = "<leader>b";
    group = "Buffers";
    icon = "󰓩 ";
  }
  {
    __unkeyed = "<leader>c";
    group = "Codesnap";
    icon = "󰄄 ";
    mode = "v";
  }
  {
    __unkeyed-1 = "<leader>bs";
    group = "Sort";
    icon = "󰒺 ";
  }
  {
    __unkeyed-1 = [
      {
        __unkeyed-1 = "<leader>f";
        group = "Normal Visual Group";
      }
      {
        __unkeyed-1 = "<leader>f<tab>";
        group = "Normal Visual Group in Group";
      }
    ];
    mode = [
      "n"
      "v"
    ];
  }
  {
    __unkeyed-1 = "<leader>w";
    group = "windows";
    proxy = "<C-w>";
  }
  {
    __unkeyed-1 = "<leader>cS";
    __unkeyed-2 = "<cmd>CodeSnapSave<CR>";
    desc = "Save";
    mode = "v";
  }
  {
    __unkeyed-1 = "<leader>db";
    __unkeyed-2 = {
      __raw = ''
        function()
          require("dap").toggle_breakpoint()
        end
      '';
    };
    desc = "Breakpoint toggle";
    mode = "n";
    silent = true;
  }
]

Declared by:

plugins.which-key.settings.triggers

Manually setup triggers

Type: null or (list of ((attribute set of anything) or raw lua code))

Default: null

Plugin default:

[
  {
    __unkeyed-1 = "<auto>";
    mode = "nxsot";
  }
]

Declared by: