Skip to content

Repository files navigation

nvim-chef

Native CyberChef-style data operations for Neovim. nvim-chef keeps the editor path quiet: the runtime file defines lightweight command and <Plug> entry points, while the registry, UI, algorithms, and individual operation modules load only when first used.

The implementation is pure Lua. It does not start Python or Node.js, embed CyberChef, access the network, or keep a background process alive.

Current focus

The first compatibility target is the useful data and cryptography core:

  • arbitrary-precision To Base/From Base plus Base32, Base45, Base58, Base62, Base64, Base85, and Base92
  • hexadecimal, binary, octal, decimal, and URL encoding
  • Unicode character-code conversion
  • byte-wise XOR, AND, OR, NOT, ADD, and SUB
  • MD5, SHA-1, every SHA-2 variant, every SHA-3 size, SHAKE, and HMAC
  • Adler, XOR, Fletcher, MurmurHash3, and common CRC checksums
  • AES-128/192/256 with ECB, CBC, CFB, OFB, and CTR modes
  • ChaCha, Salsa20, RC4/RC4 Drop, and PBKDF2, HKDF, and EVP key derivation
  • byte slicing, endianness, COBS, HTML entities, Quoted-Printable, and Unicode escapes
  • sorting, unique/filter-style text workflows, wrapping, padding, case conversion, and line tools
  • ROT13/47, Affine, Atbash, A1Z26, Vigenère, Morse, URL/IP defanging, and Unicode-aware reverse

QR codes, images, audio, video, OCR, charts, and other presentation/multimedia operations are intentionally outside this phase. See COMPATIBILITY.md for exact coverage and known boundaries.

Requirements

  • Neovim 0.10 or newer
  • no runtime dependencies

Installation

With lazy.nvim:

{
  "MichaelWeissDEV/nvim-chef",
  cmd = { "Chef", "ChefPick", "ChefPickArgs", "ChefRecipe" },
  opts = {},
}

setup() is optional. No user key is claimed by default.

require("nvim-chef").setup({
  notify = false,
  preview = {
    border = "rounded",
    height = 0.72,
    width = 0.78,
  },
})

Usage

:Chef replaces the current line or an explicit Ex range. Add ! to show the result in a temporary floating preview instead.

:Chef To Base64
:'<,'>Chef From Hex
:%Chef URL Encode
:Chef! SHA2 -- ["256"]
:Chef XOR -- [{"string":"42","option":"Hex"}]

The optional argument list is JSON and follows CyberChef's positional argument order. Separate it from the operation name with --. This keeps operation names containing spaces unambiguous.

Use the built-in picker when the exact operation name is not known:

:'<,'>ChefPick
:'<,'>ChefPick!

ChefPick immediately runs the selected operation with its defaults. Use ChefPickArgs when the operation needs a key or non-default arguments:

:'<,'>ChefPickArgs

For exact characterwise visual transformations, map one of the provided <Plug> targets. They do not occupy any keys by themselves:

vim.keymap.set("x", "<leader>c", "<Plug>(NvimChefPick)")
vim.keymap.set("x", "<leader>C", "<Plug>(NvimChefPickArgsPreview)")

Recipes use CyberChef's {"op": ..., "args": [...]} shape and execute without intermediate buffer writes:

:%ChefRecipe [{"op":"From Base64"},{"op":"To Hex","args":["None"]}]

The Lua API works on byte-preserving Lua strings and returns the output plus either "bytes" or "text":

local chef = require("nvim-chef")

local encoded = chef.transform("To Base64", "Hello")
local result = chef.bake("SGVsbG8=", {
  { op = "From Base64" },
  { op = "To Hex", args = { "None" } },
})

Design

  • plugin/nvim-chef.lua is the complete startup footprint: lightweight commands and <Plug> targets.
  • The operation index contains metadata but no algorithm code.
  • Each algorithm family is required on demand.
  • Transformations take a snapshot and refuse a delayed picker result if the source buffer changed.
  • Binary Lua strings are preserved, including NUL bytes and embedded line feeds.
  • Preview buffers are disposable nofile buffers; q or <Esc> closes them.
  • No user-facing key is mapped; only opt-in <Plug> targets are defined.
  • There are no autocmds, timers, jobs, or network calls.

Run :checkhealth nvim-chef to verify the Neovim version and native registry.

Tests

make test

The headless suite includes published RFC/NIST vectors, binary round trips, recipe execution, and an actual ranged :Chef command. The Python pychef sibling project is useful as a development oracle, but it is not imported or required by this plugin.

Security note

The cryptographic code exists for CyberChef-compatible inspection, CTF, decoding, and editor workflows. It is pure Lua and is not an audited cryptographic library. Do not use it as a replacement for a reviewed security library when protecting production secrets.

About

Neovim plugins für Cyberchef operations

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages