hn.today

Show HN: Godbolt-in-a-floating-window for Neovim (C, C++, Rust)

github.com104 points20 comments
Screenshot of Show HN: Godbolt-in-a-floating-window for Neovim (C, C++, Rust)

AssemblyForNeovim is a small Lua plugin that brings compiler-generated assembly into Neovim in a floating window. It supports C, C++, and Rust, targeting x64 and AArch64. Its purpose is to let developers inspect how code is translated into machine instructions without leaving the editor, much like using an online compiler explorer. The repository provides a demonstration video and installation instructions for lazy.nvim; setup consists of adding the plugin and calling `require("asm").setup()`.

In normal mode, pressing `a` displays the assembly for the function under the cursor. In visual mode, the same key compiles the selected text, and the `:Asm` command can also be used with selected lines. Within the floating window, `+` and `-` adjust the compiler optimization level, `R` reruns compilation, and `q` closes the window. The plugin requires `cc` or `c++` for C and C++ compilation, or `rustc` or `cargo` for Rust, to be available on the system path. When present, a `compile_commands.json` file is used to obtain compilation settings. The project is a compact editor utility rather than a full debugger: its focus is quickly comparing source code with the assembly produced by different optimization levels.

Read on github.com20 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Programming

Ggml v1.0.0

Ggml v1.0.0

ggml 1.0.0 removes deprecated public APIs and legacy DIAG_MASK operations, while adding configurable YaRN truncation and FP8 support. It also improves backend performance with quantized matrix multiplication, fused MoE operations, and new attention and scheduling paths. (github.com)

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.