diff --git a/dots/.nvim-environments/primary/config/lua/plugins/configs/hydra.lua b/dots/.nvim-environments/primary/config/lua/plugins/configs/hydra.lua index a5f4966b..98aeb1af 100644 --- a/dots/.nvim-environments/primary/config/lua/plugins/configs/hydra.lua +++ b/dots/.nvim-environments/primary/config/lua/plugins/configs/hydra.lua @@ -1,26 +1,26 @@ -local hydra = require('hydra') +local hydra = require("hydra") -- Side Scroll hydra({ - name = 'Side scroll', + name = "Side scroll", config = { { - position = 'bottom-right', - border = 'rounded', + position = "bottom-right", + border = "rounded", }, }, - mode = 'n', - body = 'z', + mode = "n", + body = "z", heads = { - { 'h', '5zh' }, - { 'l', '5zl', { desc = '←/→' } }, - { 'H', 'zH' }, - { 'L', 'zL', { desc = 'half screen ←/→' } }, + { "h", "5zh" }, + { "l", "5zl", { desc = "←/→" } }, + { "H", "zH" }, + { "L", "zL", { desc = "half screen ←/→" } }, }, }) -- Git Integration -local gitsigns = require('gitsigns') +local gitsigns = require("gitsigns") local hint = [[ _J_: next hunk _s_: stage hunk _d_: show deleted _b_: blame line @@ -33,11 +33,11 @@ local hint = [[ hydra({ hint = hint, config = { - color = 'pink', + color = "pink", invoke_on_body = true, hint = { - position = 'bottom-right', - border = 'rounded', + position = "bottom-right", + border = "rounded", }, on_enter = function() vim.bo.modifiable = false @@ -50,68 +50,103 @@ hydra({ gitsigns.toggle_deleted(false) end, }, - mode = { 'n', 'x' }, - body = 'G', + mode = { "n", "x" }, + body = "G", heads = { { - 'J', + "J", function() if vim.wo.diff then - return ']c' + return "]c" end vim.schedule(function() gitsigns.next_hunk() end) - return '' + return "" end, { expr = true }, }, { - 'K', + "K", function() if vim.wo.diff then - return '[c' + return "[c" end vim.schedule(function() gitsigns.prev_hunk() end) - return '' + return "" end, { expr = true }, }, - { 's', ':Gitsigns stage_hunk', { silent = true } }, - { 'u', gitsigns.undo_stage_hunk }, - { 'S', gitsigns.stage_buffer }, - { 'p', gitsigns.preview_hunk }, - { 'd', gitsigns.toggle_deleted, { nowait = true } }, - { 'b', gitsigns.blame_line }, + { "s", ":Gitsigns stage_hunk", { silent = true } }, + { "u", gitsigns.undo_stage_hunk }, + { "S", gitsigns.stage_buffer }, + { "p", gitsigns.preview_hunk }, + { "d", gitsigns.toggle_deleted, { nowait = true } }, + { "b", gitsigns.blame_line }, { - 'B', + "B", function() gitsigns.blame_line({ full = true }) end, }, - { '/', gitsigns.show, { exit = true } }, -- show the base of the file - { '', 'Neogit', { exit = true } }, - { 'q', nil, { exit = true, nowait = true } }, + { "/", gitsigns.show, { exit = true } }, -- show the base of the file + { "", "Neogit", { exit = true } }, + { "q", nil, { exit = true, nowait = true } }, }, }) -- Hydra to repeat expanding windows hydra({ - name = 'Window Sizing', - mode = 'n', - body = '', + name = "Window Sizing", + mode = "n", + body = "", config = { { - position = 'bottom-right', - border = 'rounded', + position = "bottom-right", + border = "rounded", }, }, heads = { - { '<', '2<' }, - { '>', '2>', { desc = '←/→' } }, - { '+', '2+' }, - { '-', '2-', { desc = '↑/↓' } }, + { "<", "2<" }, + { ">", "2>", { desc = "←/→" } }, + { "+", "2+" }, + { "-", "2-", { desc = "↑/↓" } }, + }, +}) + +-- Hydra for diagrams +local hint = [[ + Arrow^^^^^^ Select region with + ^ ^ _K_ ^ ^ _f_: surround it with box + _H_ ^ ^ _L_ + ^ ^ _J_ ^ ^ __ +]] + +hydra({ + name = "Draw Diagram", + hint = hint, + config = { + color = "pink", + invoke_on_body = true, + hint = { + border = "rounded", + }, + on_enter = function() + vim.o.virtualedit = "all" + vim.o.cursorline = true + vim.o.cursorcolumn = true + end, + }, + mode = "n", + body = "D", + heads = { + { "H", "h:VBox" }, + { "J", "j:VBox" }, + { "K", "k:VBox" }, + { "L", "l:VBox" }, + { "f", ":VBox", { mode = "v" } }, + { "", nil, { exit = true } }, }, }) diff --git a/dots/.nvim-environments/primary/config/lua/plugins/plugins.lua b/dots/.nvim-environments/primary/config/lua/plugins/plugins.lua index d19c5815..c66c56d8 100755 --- a/dots/.nvim-environments/primary/config/lua/plugins/plugins.lua +++ b/dots/.nvim-environments/primary/config/lua/plugins/plugins.lua @@ -738,6 +738,8 @@ return packer.startup({ requires = { "anuvyklack/keymap-layer.nvim", "lewis6991/gitsigns.nvim", + + "jbyuki/venn.nvim", }, config = function() require("plugins.configs.hydra")