irongit

My nvim configuration

feat: hydra mode for windows

huncholanehuncholaneauthored
parent 55da76fcommit 00299195bd93e70e083ffccdbfaa75a0009be8e5Browse files

3 files changed, +50 -4

+1-0lazy-lock.json
@@ -8,6 +8,7 @@
88 "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
99 "gitsigns.nvim": { "branch": "main", "commit": "20ad4419564d6e22b189f6738116b38871082332" },
1010 "grug-far.nvim": { "branch": "main", "commit": "b58b2d65863f4ebad88b10a1ddd519e5380466e0" },
11+ "hydra.nvim": { "branch": "main", "commit": "8c4a9f621ec7cdc30411a1f3b6d5eebb12b469dc" },
1112 "kulala.nvim": { "branch": "main", "commit": "c328aeb219c4b77106917dd2698c90ea9657281b" },
1213 "lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" },
1314 "leetcode.nvim": { "branch": "master", "commit": "fdd3f91800b3983e27bc9fcfb99cfa7293d7f11a" },
+0-4lua/keymaps.lua
@@ -105,10 +105,6 @@ vim.keymap.set("n", "<C-S-Left>", ":vertical resize -2<CR>")
105105 vim.keymap.set("n", "<C-S-Right>", ":vertical resize +2<CR>")
106106 vim.keymap.set("n", "<C-S-Down>", ":resize -2<CR>")
107107 vim.keymap.set("n", "<C-S-Up>", ":resize +2<CR>")
108-for i = 1, 9 do
109- easymap("n", "<leader>w" .. i, ":Resize " .. i .. "0<cr>", "Resize " .. i .. "0%")
110-end
111-easymap("n", "<leader>w0", ":Resize 100<cr>", "Resize 100%")
112108
113109 -- ########################################################################## --
114110 -- -Gotos
+49-0lua/plugins/hydra.lua
@@ -0,0 +1,49 @@
1+---@type LazySpec
2+return {
3+ "nvimtools/hydra.nvim",
4+ event = "VeryLazy",
5+ config = function()
6+ local Hydra = require("hydra")
7+
8+ Hydra({
9+ name = "Windows",
10+ mode = "n",
11+ body = "<leader>w",
12+ hint = [[
13+ _h_ _j_ _k_ _l_ move focus
14+ _H_ _J_ _K_ _L_ move window
15+ _+_ _-_ _>_ _<_ resize
16+ _=_ equalize
17+ _s_ _v_ split h/v
18+ _o_ only
19+ _q_ _c_ close
20+ _<Esc>_ exit
21+]],
22+ config = {
23+ invoke_on_body = true,
24+ hint = { type = "window", border = "rounded", position = "bottom" },
25+ },
26+ heads = {
27+ { "h", "<Cmd>wincmd h<CR>" },
28+ { "j", "<Cmd>wincmd j<CR>" },
29+ { "k", "<Cmd>wincmd k<CR>" },
30+ { "l", "<Cmd>wincmd l<CR>" },
31+ { "H", "<Cmd>wincmd H<CR>" },
32+ { "J", "<Cmd>wincmd J<CR>" },
33+ { "K", "<Cmd>wincmd K<CR>" },
34+ { "L", "<Cmd>wincmd L<CR>" },
35+ { "+", "<Cmd>resize +2<CR>" },
36+ { "-", "<Cmd>resize -2<CR>" },
37+ { ">", "<Cmd>vertical resize +2<CR>" },
38+ { "<", "<Cmd>vertical resize -2<CR>" },
39+ { "=", "<Cmd>wincmd =<CR>" },
40+ { "s", "<Cmd>split<CR>" },
41+ { "v", "<Cmd>vsplit<CR>" },
42+ { "o", "<Cmd>only<CR>" },
43+ { "q", "<Cmd>close<CR>", { exit = true } },
44+ { "c", "<Cmd>close<CR>", { exit = true } },
45+ { "<Esc>", nil, { exit = true } },
46+ },
47+ })
48+ end,
49+}