aboutsummaryrefslogtreecommitdiff
path: root/dot_config/nvim/lua/plugins/herdr.lua
blob: d12f729b844e3fc29335893998dc9ce94b4b4245 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
return {
  "lmilojevicc/herdr-splits.nvim",
  cond = vim.env.HERDR_ENV == "1",
  event = "VeryLazy",

  -- Keep the Neovim and Herdr halves on the same commit.
  build = function()
    require("herdr-splits").sync_herdr()
  end,

  opts = {
    auto_sync_herdr = true,

    -- Spatial navigation should stop at the outside edge.
    -- Wrapping would make Ctrl+HJKL less predictable.
    at_edge = "stop",

    -- Neovim split resizing is measured in cells.
    neovim_amount = 3,

    -- Herdr pane resizing is a fraction of the terminal.
    default_amount = 0.03,

    nav_keys = {
      left = "<C-h>",
      down = "<C-j>",
      up = "<C-k>",
      right = "<C-l>",
    },

    resize_keys = {
      left = "<M-h>",
      down = "<M-j>",
      up = "<M-k>",
      right = "<M-l>",
    },
  },

  keys = {
    {
      "<C-h>",
      function()
        require("herdr-splits").move_cursor_left()
      end,
      desc = "Move left",
    },
    {
      "<C-j>",
      function()
        require("herdr-splits").move_cursor_down()
      end,
      desc = "Move down",
    },
    {
      "<C-k>",
      function()
        require("herdr-splits").move_cursor_up()
      end,
      desc = "Move up",
    },
    {
      "<C-l>",
      function()
        require("herdr-splits").move_cursor_right()
      end,
      desc = "Move right",
    },

    {
      "<M-h>",
      function()
        require("herdr-splits").resize_left()
      end,
      desc = "Resize left",
    },
    {
      "<M-j>",
      function()
        require("herdr-splits").resize_down()
      end,
      desc = "Resize down",
    },
    {
      "<M-k>",
      function()
        require("herdr-splits").resize_up()
      end,
      desc = "Resize up",
    },
    {
      "<M-l>",
      function()
        require("herdr-splits").resize_right()
      end,
      desc = "Resize right",
    },
  },
}