See where your bytes go without leaving Neovim.
Visualize C/C++ struct and class memory layouts — field offsets, padding, alignment — in a floating window. Hover over a type or variable and see exactly how the compiler laid it out.
- Works on structs, classes, unions, and STL types
- Resolves variables to their underlying type via clangd
- Auto-detects compiler flags from
compile_commands.json - Cached — first lookup compiles, subsequent lookups are instant
- Neovim >= 0.10
- clang in PATH
- clangd for type resolution from variables and qualified types
-- lazy.nvim
{
"J-Cowsert/classlayout.nvim",
ft = { "c", "cpp" },
opts = {},
}Default config — override what you need:
require("classlayout").setup({
keymap = "<leader>cl",
compiler = "clang",
args = {},
compile_commands = true,
})Cursor on a type name or variable. Press <leader>cl or :ClassLayout.
Press q to close.
The layout is based on the saved file — save before invoking.