plugins.hydra.hydras

A list of hydra configurations. See here.

Type: list of (attribute set of anything)

Default: [ ]

Example:

[
  {
    body = "<leader>g";
    config = {
      color = "pink";
      hint = {
        position = "bottom";
      };
      invoke_on_body = true;
      on_enter = ''
        function()
          vim.bo.modifiable = false
          gitsigns.toggle_signs(true)
          gitsigns.toggle_linehl(true)
        end
      '';
      on_exit = ''
          function()
        	gitsigns.toggle_signs(false)
        	gitsigns.toggle_linehl(false)
        	gitsigns.toggle_deleted(false)
        	vim.cmd("echo") -- clear the echo area
        end
      '';
    };
    heads = [
      [
        "J"
        {
          __raw = ''
            function()
              if vim.wo.diff then
                return "]c"
              end
              vim.schedule(function()
                gitsigns.next_hunk()
              end)
              return "<Ignore>"
            end
          '';
        }
        {
          expr = true;
        }
      ]
      [
        "K"
        {
          __raw = ''
            function()
              if vim.wo.diff then
                return "[c"
              end
              vim.schedule(function()
                gitsigns.prev_hunk()
              end)
              return "<Ignore>"
            end
          '';
        }
        {
          expr = true;
        }
      ]
      [
        "s"
        ":Gitsigns stage_hunk<CR>"
        {
          silent = true;
        }
      ]
      [
        "u"
        {
          __raw = "require('gitsigns').undo_stage_hunk";
        }
      ]
      [
        "S"
        {
          __raw = "require('gitsigns').stage_buffer";
        }
      ]
      [
        "p"
        {
          __raw = "require('gitsigns').preview_hunk";
        }
      ]
      [
        "d"
        {
          __raw = "require('gitsigns').toggle_deleted";
        }
        {
          nowait = true;
        }
      ]
      [
        "b"
        {
          __raw = "require('gitsigns').blame_line";
        }
      ]
      [
        "B"
        {
          __raw = ''
            function()
              gitsigns.blame_line({ full = true })
            end,
          '';
        }
      ]
      [
        "/"
        {
          __raw = "require('gitsigns').show";
        }
        {
          exit = true;
        }
      ]
      [
        "<Enter>"
        "<cmd>Neogit<CR>"
        {
          exit = true;
        }
      ]
      [
        "q"
        null
        {
          exit = true;
          nowait = true;
        }
      ]
    ];
    hint = {
      __raw = ''
        [[
           _J_: next hunk   _s_: stage hunk        _d_: show deleted   _b_: blame line
           _K_: prev hunk   _u_: undo stage hunk   _p_: preview hunk   _B_: blame show full
           ^ ^              _S_: stage buffer      ^ ^                 _/_: show base file
           ^
           ^ ^              _<Enter>_: Neogit              _q_: exit
        ]]
      '';
    };
    mode = [
      "n"
      "x"
    ];
    name = "git";
  }
]

Declared by:

plugins.hydra.hydras.*.body

Key required to activate the hydra, when excluded, you can use Hydra:activate().

Type: null or string or raw lua code

Default: null

Declared by:

plugins.hydra.hydras.*.heads

Each Hydra’s head has the form: `[head rhs opts]

Similar to the vim.keymap.set() function.

  • The head is the “lhs” of the mapping (given as a string). These are the keys you press to perform the action.
  • The rhs is the action that gets performed. It can be a string, function (use __raw) or null. When null, the action is a no-op.
  • The opts attrs is empty by default.

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

Default: null

Declared by:

plugins.hydra.hydras.*.hint

The hint for a hydra can let you know that it’s active, and remind you of the hydra’s heads. The string for the hint is passed directly to the hydra.

See the README for more information.

Type: null or string or raw lua code

Default: null

Declared by:

plugins.hydra.hydras.*.mode

Modes where the hydra exists, same as vim.keymap.set() accepts.

Type: null or one of “c”, “i”, “!”, “l”, “n”, “”, “o”, “s”, “t”, “v”, “x” or list of (one of “c”, “i”, “!”, “l”, “n”, “”, “o”, “s”, “t”, “v”, “x”)

Default: null

Plugin default: n

Declared by:

plugins.hydra.hydras.*.name

Hydra’s name. Only used in auto-generated hint.

Type: null or string or raw lua code

Default: null

Declared by: