local M = { -- keybinds where you only hit the head once "anuvyklack/hydra.nvim", dependencies = { "jbyuki/venn.nvim", -- draw ascii diagrams "mrjones2014/smart-splits.nvim", -- the name says it all }, keys = { "", "V" }, } local venn_hint = [[ Arrow^^^^^^ Select region with ^ ^ _K_ ^ ^ _f_: surround it with box _H_ ^ ^ _L_ ^ ^ _J_ ^ ^ __ ]] local window_hint = [[ ^^^^^^^^^^^^ Move ^^ Size ^^ ^^ Split ^^^^^^^^^^^^------------- ^^-----------^^ ^^--------------- ^ ^ _k_ ^ ^ ^ ^ _K_ ^ ^ ^ __ ^ _s_: horizontally _h_ ^ ^ _l_ _H_ ^ ^ _L_ __ __ _v_: vertically ^ ^ _j_ ^ ^ ^ ^ _J_ ^ ^ ^ __ ^ _q_: close focus^^^^^^ window^^^^^^ ^_=_: equalize^ _o_: close remaining ]] function M.config() local Hydra = require("hydra") local pcmd = require("hydra.keymap-util").pcmd local splits = require("smart-splits") -- {{{ Diagrams Hydra({ name = "Draw Diagram", hint = venn_hint, config = { invoke_on_body = true, hint = { border = "rounded", }, on_enter = function() vim.o.virtualedit = "all" end, }, mode = "n", body = "V", heads = { { "H", "h:VBox" }, { "J", "j:VBox" }, { "K", "k:VBox" }, { "L", "l:VBox" }, { "f", ":VBox", { mode = "v" } }, { "", nil, { exit = true } }, }, }) -- }}} -- {{{ Windows local resize = function(direction) return function() splits["resize_" .. direction](2) end end Hydra({ name = "Windows", hint = window_hint, config = { invoke_on_body = true, hint = { border = "rounded", offset = -1, -- vertical offset (larger => higher up) }, }, mode = "n", body = "", heads = { { "h", "h" }, { "j", "j" }, { "k", "k" }, { "l", "l" }, { "H", "H" }, { "J", "J" }, { "K", "K" }, { "L", "L" }, { "", resize("left") }, { "", resize("down") }, { "", resize("up") }, { "", resize("right") }, { "=", "=", { desc = "equalize" } }, { "s", pcmd("split", "E36") }, { "v", pcmd("vsplit", "E36") }, { "o", "o", { exit = true, desc = "remain only" } }, { "q", pcmd("close", "E444"), { desc = "close window" } }, }, }) -- }}} end return M