blob: 8c35f6fc89c3ab7c148c0a5ea681957f8217fbaf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
--
-- 50-transform_text.lua
--
-- * Transforms the visual selection in place via dotfiles.selection (URL-encode / URL-decode).
--
-- Keymaps:
-- `<Leader>tte`: URL-encode selection
-- `<Leader>ttd`: URL-decode selection
--
local selection = require("dotfiles.selection")
-- URL-encode the visual selection.
local function url_encode_selection()
selection.transform(vim.uri_encode)
end
-- URL-decode the visual selection.
local function url_decode_selection()
selection.transform(vim.uri_decode)
end
vim.keymap.set("x", "<Leader>tte", url_encode_selection, { desc = "URL-encode selection" })
vim.keymap.set("x", "<Leader>ttd", url_decode_selection, { desc = "URL-decode selection" })
|