feat: add custom key mappings for visual mode text block movements

This commit is contained in:
2024-09-14 17:04:57 -04:00
parent 5615d74659
commit 0affef0abc
3 changed files with 84 additions and 36 deletions
+53
View File
@@ -440,6 +440,59 @@ M.misc = {
mode = "n",
hidden = true,
},
{ -- Visual mode: Move selected block of text up
lhs = "K",
rhs = function()
require("data.func").move_visual(true)
end,
desc = "Move block of text up",
mode = "v",
},
{ -- Visual mode: Move selected block of text down
lhs = "J",
rhs = function()
require("data.func").move_visual(false)
end,
desc = "Move block of text down",
mode = "v",
},
{ -- Test Prompt: Enter your name
lhs = "<leader>qP",
rhs = function()
require("data.func").InputPrompt("Enter your name: ", function(input)
if input then
-- trim whitespace from end of input
input = input:gsub("%s+$", "")
print("👋😎 Hello " .. input .. "!")
else
print("Input was canceled")
end
end)
end,
desc = "Test Prompt",
},
{ -- Paste over text with overwrite
lhs = "<leader>cp",
rhs = function()
require("data.func").paste_overwrite()
end,
desc = "Paste overwrite",
mode = "n",
},
{ -- Dump buffer contents to a table in register
lhs = "<leader>bY",
rhs = function()
require("data.func").dump_buffer_to_table("+")
end,
desc = "Yank buffer as table",
mode = "n",
},
{ -- Yank buffer
lhs = "<leader>by",
rhs = "<cmd>%y<cr>",
desc = "Yank buffer",
mode = "n",
},
}
M.nekifoch = {