A powerful Neovim plugin to convert between various formats
ascii, bin, dec, hex, oct, b64, sha256, md5, morseB, KB, MB, GB, TBpex, rem, pt, mm, cm, m, km, in, ft, yd, mihex, rgb, hsl, tailwindms, s, min, hdeg, rad, grad, turncelcius, fahrenheit, kelvin{
"necrom4/convy.nvim",
cmd = { "Convy", "ConvySeparator" },
opts = {}
}
{
opts = {
-- default configuration
notifications = true,
separator = " ",
window = {
blend = 25,
border = "rounded"
},
},
keys = {
-- example keymaps
{
"<leader>cc",
":Convy<CR>",
desc = "Convert (interactive selection)",
mode = { "n", "v" },
silent = true,
},
{
"<leader>cd",
":Convy auto dec<CR>",
desc = "Convert to decimal",
mode = { "n", "v" },
silent = true,
},
{
"<leader>cs",
":ConvySeparator<CR>",
desc = "Set convertion separator (visual selection)",
mode = { "v" },
silent = true,
},
}
}
:Convy <input_format> <output_format>
:Convy " open interactive selection window
:'<,'>Convy <<input_format> <output_format>> " visual selection as string to work on
lua require("convy").convert("auto", "<output_format>") -- `auto` guesses the format of the input
lua require("convy").convert("<input_format>", "<output_format>", true) -- boolean indicates use of visual selection
lua require("convy").show_selector() -- open interactive selection window
:ConvySeparator ", " " sets the separator to `, `
:ConvySeparator \", \" " sets the separator to `", "`
:ConvySeparator | - | " spaces are not ignored, this sets the separator to `| - |`
:'<,'>ConvySeparator " visual selection as selector
lua require("convy.utils").set_separator(", ") -- sets the separator to `, `
Examples:
|represents the cursor's position,[ ... ]represents a visual selection.
" 72 1|01 108 108 111
:Convy auto ascii
" Converts hovered word from decimal to ascii
" Result: 72 e 108 108 111
" [72 101 108 108 111]
:Convy auto ascii
" Converts selection from decimal to ascii
" Result: Hello
" [Hello]
:Convy
" Opens the interactive selection window
" Choose the input format (ascii) with `j/k` and accept with `<CR>`
" Choose the output format (dec) with `j/k` and accept with `<CR>`
" Converts selection from decimal to ascii
" Result: 72 101 108 108 111