# AssemblyForNeovim: Neovim 안의 어셈블리 창
# AssemblyForNeovim: an assembly window inside Neovim

- Site: https://select1.dev/2026-11-12 (English), https://select1.dev/ko/2026-11-12 (Korean)
- Entry: 033
- Published: 2026-11-12 (KST). Launch date: 2026-11-11
- Pick: AssemblyForNeovim <https://github.com/0xdeadf1sh/AssemblyForNeovim> (source: Show HN)
- Verified: ran
- What: AssemblyForNeovim 은 C, C++, Rust 코드가 어떤 기계어 명령어로 컴파일되는지 Neovim 안에서 보여 주는 프로덕트다.
- What (en): AssemblyForNeovim is a product that shows the machine instructions compiled from your C, C++ or Rust code in Neovim.
- Why: 오늘의 픽으로 선정한 이유는 코드를 웹사이트에 붙여 넣지 않고 어셈블리를 확인할 수 있기 때문이다.
- Why (en): It is today’s pick because you can check assembly without pasting code into a website.
- Verdict: 작동한다. C, C++, Rust 의 어셈블리가 편집기 안의 창에 표시됐다.
- Verdict (en): It works. Assembly for C, C++ and Rust showed up in a window inside the editor.
- Tags: neovim, assembly, compiler, c, rust

## Checked against the README

- [fail] 노멀 모드에서 <leader>a 를 누르면 커서가 있는 함수의 어셈블리를 보여 준다(function under the cursor) — 플러그인은 Tree-sitter 를 켠 C 버퍼에서는 함수 전체(5~10번째 줄)를 선택했다. Tree-sitter 를 켜지 않은 C 버퍼와, 파서가 기본으로 들어 있지 않은 C++, Rust 버퍼에서는 커서가 있는 줄만 선택했다. Neovim 0.12.6 에는 C++ 와 Rust 파서가 기본으로 들어 있지 않다
- [pass] compile_commands.json 이 있으면 그 옵션을 쓴다(Uses compile_commands.json if it finds one) — -std=c17 -DSCALE=3 -O0 을 지정한 compile_commands.json 을 만들자, 3을 곱하는 명령어 lea eax, [rax+rax*2] 가 나왔다. 플러그인은 -O0 대신 창에서 선택한 최적화 수준을 사용했다.
- [fail] PATH 의 cc, c++ 나 rustc, cargo 로 컴파일한다(Needs cc/c++ or rustc/cargo on PATH) — GCC 13.3 의 cc 에서 compile_commands.json 이 없는 C 파일은 -std=c23 을 인식하지 못한다는 오류로 컴파일되지 않았다. C++ 와 Rust 파일은 c++ 와 rustc 로 컴파일됐다

## Measured

- 어셈블리 창이 표시될 때까지의 시간: C 파일 scale.c 21~25 ms, C++ 파일 174~220 ms (headless Neovim 에서 :Asm 을 호출한 때부터 창 제목에서 compiling… 이 사라질 때까지, 파일마다 3번. 같은 컴파일러 명령만 실행했을 때는 C 19~27 ms, C++ 187~213 ms 였다)

## Progress (days after launch; full history https://select1.dev/2026-11-12/progress)

- day 3 (checked 2026-11-14) [some] commits since launch 2, stars 221, releases 0, contributors 2, last commit 2026-11-12
  - C files without a compile_commands.json used to fail on GCC 13, which does not recognize the default `-std=c23`. They now fall back to `-std=c2x` when `cc` rejects `-std=c23`. Entry 033 reported this.
- day 7 (checked 2026-11-18) [quiet] commits since launch 2, stars 225, releases 0, contributors 2, last commit 2026-11-12
- day 15 (checked 2026-11-26) [some] commits since launch 4, stars 229, releases 0, contributors 3, last commit 2026-11-19
  - Passing `key` to `setup` now changes the default `<leader>a` shortcut.

## 한국어

## 무엇이 문제인가

C, C++, Rust 개발자는 컴파일러가 반복문을 어떻게 최적화했는지, 함수 호출이 인라인됐는지 확인하려고 컴파일된 기계어 명령어를 볼 때가 있다. 이때 많이 쓰는 도구가 Compiler Explorer(godbolt.org)다. Compiler Explorer 의 README 에 따르면, 이 웹사이트는 코드를 편집하면 컴파일 결과를 실시간으로 보여 준다.

Compiler Explorer 에서 확인하려면 코드를 붙여 넣고, 컴파일러와 옵션을 다시 선택해야 한다. 프로젝트의 헤더와 매크로는 사이트에 없으므로, 확인하려는 함수가 헤더나 매크로를 사용하면 그대로는 컴파일되지 않는다.

## 어떻게 해결했나

AssemblyForNeovim 은 2026년 11월 11일 Hacker News 에 Show HN 글로 올라왔다. 제작자 0xdeadf1sh 는 글에서 인터넷 연결 없이 로컬에 설치된 컴파일러로 어셈블리를 만든다고 소개했다. 댓글에서는 C 와 C++ 로 작성하는 렌더러 같은 취미 프로젝트에 쓰려고 만들었다고 밝혔다.

사용자가 Neovim 에서 커서를 함수 안에 두고 리더 키와 a 를 차례로 누르거나(`<leader>a`), 줄을 선택해 같은 키를 누르면, 플러그인은 로컬 컴파일러를 실행해 파일 전체를 어셈블리로 컴파일한다. 컴파일러는 이때 디버그 정보도 출력한다. 디버그 정보에는 명령어마다 소스 코드의 몇 번째 줄에서 나왔는지가 적혀 있다. 플러그인은 이 줄 번호로, 선택한 줄에서 나온 명령어만 골라 소스 코드 줄과 함께 플로팅 창에 표시한다. 창에서 `+` 와 `-` 를 누르면 최적화 수준이 바뀐다. 프로젝트에 compile_commands.json 이 있으면 그 파일에 적힌 컴파일 옵션을 쓴다.

## 무엇이 다른가

첫째, 컴파일하는 곳이 다르다. Compiler Explorer 는 웹사이트의 서버에서 컴파일한다. AssemblyForNeovim 은 사용자의 컴퓨터에 있는 컴파일러를 실행한다. 그래서 코드를 외부 서버로 보내지 않는다. compile_commands.json 에 적힌 매크로와 헤더 경로도 그대로 쓴다. 트레이드오프는 사용자의 컴퓨터에 설치된 컴파일러로만 확인할 수 있다는 점이다. Compiler Explorer 의 README 에 따르면 이 사이트에서는 언어마다 여러 컴파일러를 선택해 결과를 비교할 수 있다. Compiler Explorer 도 직접 설치해 로컬 컴파일러를 연결할 수 있지만, 편집기 밖의 브라우저에서 쓴다.

둘째, 보여 주는 범위가 다르다. Compiler Explorer 는 파일 전체의 어셈블리를 보여 준다. AssemblyForNeovim 은 선택한 줄에서 나온 명령어만 보여 준다. 파일 전체의 어셈블리에서 보려는 코드의 명령어를 찾지 않아도 된다. 트레이드오프는 선택한 범위 밖에 정의된 함수가 인라인되면, 범위 안에서 실행되는 그 함수의 명령어가 빠진다는 점이다. 인라인된 명령어는 디버그 정보에 그 함수가 정의된 줄 번호로 기록되기 때문이다.

## 어떻게 만들었나

- 저장소의 커밋은 2개다. 2026년 10월 9일 첫 커밋에서 Lua 398줄로 된 플러그인 전체를 추가했다. 둘째 커밋에서는 README 에 영상을 넣었다. Show HN 글은 첫 커밋 한 달 뒤에 올라왔다.
- Lua 의존성은 없다. Neovim 에 들어 있는 API(프로세스 실행, Tree-sitter, 파일 찾기)만 쓴다.
- 라이선스는 Unlicense 로, 코드는 퍼블릭 도메인이다.

## 실행해 보니

GCC 13.3, Rust 1.97 이 설치된 컴퓨터의 Neovim 0.12.6 에서 플러그인을 불러왔다. 직접 만든 시험 파일 4개(C 2개, C++ 1개, Rust 1개)를 열어 `:Asm` 명령을 실행하고 `<leader>a` 를 눌렀다.

1. C 기본 설정. compile_commands.json 이 없는 C 파일은 컴파일되지 않았다. 플러그인은 C 를 `cc -std=c23` 으로 컴파일하는데, Ubuntu 24.04 의 cc 인 GCC 13.3 은 이 옵션을 인식하지 못한다는 오류를 출력하고 `-std=c2x` 를 제안했다.
2. compile_commands.json. `-std=c17 -DSCALE=3 -O0` 을 지정한 compile_commands.json 을 만들자 C 파일이 컴파일됐다. 어셈블리에는 3을 곱하는 명령어 `lea eax, [rax+rax*2]` 가 보였다. 플러그인은 `-O0` 대신 창에서 선택한 최적화 수준(기본 `-O2`)을 적용했다. `-` 를 누를 때마다 최적화 수준이 `-O1`, `-O0` 으로 낮아졌다.
3. 인라인. sum_squares(5~10번째 줄)에서 `<leader>a` 를 누르자 반복문의 명령어가 표시됐지만, 곱셈 명령어 `imul eax, eax` 는 없었다. 이 명령어는 3번째 줄에 정의된 square() 에서 인라인돼, 디버그 정보의 줄 번호가 3이다. 커서를 3번째 줄에 두자 `imul` 이 sum_squares 의 명령어로 나타났다.
4. 함수 고르기. 플러그인은 C 버퍼에서 Tree-sitter 를 켰을 때(`vim.treesitter.start()`) 함수 전체(5~10번째 줄)를 선택했다. 켜지 않은 C 버퍼에서는 구문 트리가 없어 커서가 있는 한 줄만 선택했다. Neovim 0.12.6 에는 C++ 와 Rust 파서가 기본으로 들어 있지 않다. 그래서 C++ 함수에서는 커서가 있던 `for` 문 줄의 명령어만 표시돼, 반복문 본문의 더하기 명령어가 빠졌다.
5. Rust. `pub fn` 함수에서는 `-O2` 일 때 표시할 어셈블리가 없다는 안내가 나왔다. 안내에 따르면 의도된 동작이다. `-` 를 눌러 `-O1` 로 낮추자 명령어가 표시됐다.
6. 시간. `:Asm` 실행부터 어셈블리 표시까지 scale.c 와 C++ 파일을 세 번씩 측정하니, scale.c 는 21~25 ms, `<vector>` 를 포함한 C++ 파일은 174~220 ms 였다. 같은 컴파일러 명령만 실행했을 때(C 19~27 ms, C++ 187~213 ms)와 범위가 겹쳤다. 걸린 시간은 대부분 컴파일 시간이다.

```asm title="AssemblyForNeovim 창, scale.c 5~10번째 줄, -O2"
  ; 8 | s += square(a[i]) * SCALE;
        mov eax, DWORD PTR [rdi]
  ; 7 | for (size_t i = 0; i < n; i++)
        add rdi, 4
  ; 8 | s += square(a[i]) * SCALE;
        lea eax, [rax+rax*2]
        add edx, eax
```

```asm title="터미널, 같은 반복문" {4}
$ cc -std=c17 -DSCALE=3 scale.c -S -g -O2 -masm=intel -o -
        mov     eax, DWORD PTR [rdi]
        add     rdi, 4
        imul    eax, eax        # .loc 1 3, square() 의 줄
        lea     eax, [rax+rax*2]
        add     edx, eax
```

## 판정

작동한다. C, C++, Rust 의 어셈블리가 편집기 안의 창에 표시됐다. 다만 선택한 범위 밖에 정의된 함수가 인라인되면, 창에서 그 함수의 명령어가 빠진다. 실행한 커밋 148cec5 에서는 GCC 13 일 때 compile_commands.json 이 없으면 C 의 기본 옵션 `-std=c23` 때문에 컴파일이 실패한다. 제작자는 11월 12일 커밋 820949a 를 머지해 이 문제를 수정했다. Neovim 에서 C, C++, Rust 의 최적화 결과를 자주 확인하는 경우에 써 볼 만하다.

## 얻어갈 것

- 디버그 정보의 줄 번호로 어셈블리를 거르는 도구를 만든다면, 선택한 함수 안에 인라인된 명령어는 줄 번호가 범위 밖이어도 따로 표시하자.
- 컴파일러 옵션을 기본값으로 지정할 때는 사용자의 컴파일러가 그 옵션을 지원하는지 먼저 확인하자. AssemblyForNeovim 은 `-dumpmachine` 으로 대상 아키텍처가 x86 인지는 확인하지만, `-std=c23` 은 지원 여부를 확인하지 않고 지정한다.

### 용어

- 인라인: 컴파일러가 함수를 호출하는 대신 그 함수의 명령을 호출하는 코드 안에 직접 넣는 최적화. 호출 비용이 사라진다.
- Neovim: Vim 을 바탕으로 만든 텍스트 편집기. 터미널에서 키보드로 조작하고, Lua 로 작성한 플러그인으로 기능을 추가할 수 있다.
- 리더 키: Vim 과 Neovim 에서 사용자가 설정한 단축키 앞에 누르는 키. 기본값은 백슬래시(\)다.
- compile_commands.json: 프로젝트의 파일마다 어떤 컴파일러 명령과 옵션으로 컴파일하는지 적은 파일. CMake 같은 빌드 도구가 이 파일을 만든다. 편집기와 분석 도구는 이 파일에서 컴파일 옵션을 읽는다.
- Tree-sitter: 소스 코드를 구문 트리로 분석하는 라이브러리. 편집기는 언어마다 설치한 파서로 함수의 시작과 끝을 찾거나 구문을 강조한다.

## English

## The problem

C, C++ and Rust developers sometimes look at the machine instructions their code compiles to. They check how the optimizer changed a loop, or whether a function call was inlined. A common tool for this is Compiler Explorer (godbolt.org). According to its README, it is a website that shows the compiled result in real time as you edit code.

You paste your code into the site and pick the compiler and options again. The site does not have your project’s headers and macros. If the function you want to check uses those headers or macros, it does not compile as is.

## How it solves it

AssemblyForNeovim was posted on Hacker News as a Show HN on November 11, 2026. In the post, the maker, 0xdeadf1sh, says it needs no internet connection and uses a locally installed compiler. In a comment, the maker says it was built for hobby projects such as renderers written in C and C++.

In Neovim, you put the cursor inside a function and press the leader key followed by the letter a. This is written as `<leader>a`. You can also select some lines and press the same keys. The plugin then compiles the whole file to assembly with your local compiler. The compiler also emits debug info, which records the source line that each instruction came from. The plugin uses these line numbers to keep only the instructions from the chosen lines. It shows them with the source lines in a floating window. In the window, `+` and `-` change the optimization level. If the project has a compile_commands.json, the plugin uses the compile options written there.

## What is different

The first difference is where the code is compiled. Compiler Explorer compiles on the website’s servers. AssemblyForNeovim runs the compiler on your own computer. Your code never leaves the machine, and the plugin uses the macros and header paths from compile_commands.json. The tradeoff is that you can only use the compilers installed on your computer. According to its README, Compiler Explorer offers several compilers for each language, so you can compare results. You can also install Compiler Explorer yourself with local compilers, but you still use it in a browser, outside the editor.

The second difference is how much it shows. Compiler Explorer shows the assembly for the whole file. AssemblyForNeovim shows only the instructions from the chosen lines. The tradeoff is that when a function defined outside the range is inlined, its instructions drop out, even though they run inside the range. The debug info records inlined instructions with the line number where that function is defined.

## How it was built

- The repository has 2 commits. The first, on October 9, 2026, adds the whole plugin, 398 lines of Lua. The second adds a video to the README. The Show HN post came a month after the first commit.
- It has no Lua dependencies. It uses only the APIs built into Neovim for running processes, tree-sitter and finding files.
- The license is the Unlicense, which puts the code in the public domain.

## Running it

I loaded the plugin in the official Neovim 0.12.6 release, with GCC 13.3 and Rust 1.97. I used the plugin’s `:Asm` command and `<leader>a` on 4 test files I wrote: 2 in C, 1 in C++ and 1 in Rust.

1. C defaults. A C file with no compile_commands.json did not compile. The plugin compiles C with `cc -std=c23`. The cc on Ubuntu 24.04 is GCC 13.3. It did not recognize `-std=c23` and suggested `-std=c2x`.
2. compile_commands.json. The code compiled with a compile_commands.json listing `-std=c17 -DSCALE=3 -O0`. The instruction `lea eax, [rax+rax*2]`, which multiplies by 3, showed that SCALE was 3. The plugin dropped `-O0` and used the level chosen in the window, `-O2` by default. Pressing `-` changed it to `-O1`, then `-O0`.
3. Inlining. I pressed `<leader>a` in sum_squares, lines 5 to 10. The window showed the loop’s instructions, but the multiply instruction `imul eax, eax` was missing. It comes from square(), which is defined on line 3. The compiler inlined square(), but the debug info still records line 3 for `imul`. When I put the cursor on line 3, `imul` appeared as part of sum_squares.
4. Picking the function. When I turned on tree-sitter in the C buffer with `vim.treesitter.start()`, the plugin picked the whole function, lines 5 to 10. Without it, the buffer had no syntax tree, and the plugin picked only the cursor line. Neovim 0.12.6 does not come with parsers for C++ or Rust. In a C++ function, the window showed only the instructions for the `for` line, where the cursor was, so the add instruction in the loop body was missing.
5. Rust. For a `pub fn` at `-O2`, a note said there was no assembly to show. According to the note, this is by design. Lowering the level to `-O1` with `-` showed the instructions.
6. Time. I timed scale.c and the C++ file 3 times each, from running `:Asm` until the assembly showed up. It took 21 to 25 ms for scale.c and 174 to 220 ms for the C++ file that includes `<vector>`. Running the same compiler command alone took 19 to 27 ms for C and 187 to 213 ms for C++. The ranges overlap, so the time is mostly compile time.

```asm title="AssemblyForNeovim window, scale.c lines 5 to 10, -O2"
  ; 8 | s += square(a[i]) * SCALE;
        mov eax, DWORD PTR [rdi]
  ; 7 | for (size_t i = 0; i < n; i++)
        add rdi, 4
  ; 8 | s += square(a[i]) * SCALE;
        lea eax, [rax+rax*2]
        add edx, eax
```

```asm title="Terminal, the same loop" {4}
$ cc -std=c17 -DSCALE=3 scale.c -S -g -O2 -masm=intel -o -
        mov     eax, DWORD PTR [rdi]
        add     rdi, 4
        imul    eax, eax        # .loc 1 3, the line of square()
        lea     eax, [rax+rax*2]
        add     edx, eax
```

## Verdict

It works. Assembly for C, C++ and Rust showed up in a window inside the editor. But when a function defined outside the chosen range is inlined, its instructions drop out of the window. At commit 148cec5, C files without a compile_commands.json fail to compile on GCC 13 because of the default option `-std=c23`. On November 12, the maker merged commit 820949a to fix this. It is worth trying if you often check C, C++ or Rust optimizer output in Neovim.

## What to take away

- If your tool filters assembly by debug-info line numbers, show the instructions inlined into the chosen function separately, even when their line numbers fall outside the range.
- Before you add a compiler option as a default, check that the user’s compiler supports it. AssemblyForNeovim runs `-dumpmachine` to check whether the target is x86, but adds `-std=c23` without a check.

### Terms

- inlining: An optimization where the compiler puts a function’s instructions into the calling code instead of calling it. The call cost goes away.
- Neovim: A text editor based on Vim. You use it in the terminal with the keyboard and extend it with plugins written in Lua.
- leader key: In Vim and Neovim, a key you press before your own shortcuts. The default is the backslash (\).
- compile_commands.json: A file that lists the compiler command and options used to build each file in a project. Build tools such as CMake generate it, and editors and analysis tools read it.
- tree-sitter: A library that parses source code into a syntax tree. Editors load a parser for each language to find where a function starts and ends, or to highlight syntax.

## Launches the same day

- bo2-mac <https://github.com/adrbn/bo2-mac> (Show HN, 130): 정적 재컴파일 프로젝트. Black Ops II 를 ARM64 macOS 프로그램으로 바꾼다.
- AssemblyForNeovim <https://github.com/0xdeadf1sh/AssemblyForNeovim> (Show HN, 89): Neovim 플러그인. C, C++, Rust 코드의 어셈블리를 플로팅 창에 보여 준다.
- litesql <https://github.com/cattlecloud/litesql> (Show HN, 18): Go 라이브러리. SQLite 를 읽기 연결과 쓰기 연결로 나눠 쓰게 한다.
- ThingStudio <https://thingstudio.net/> (Show HN, 12): 마이크로컨트롤러 개발 도구. Node-RED 처럼 노드를 이어 프로그램을 만든다.
- GPU Rental Prices <https://taipeiledger.com/gpu/> (Show HN, 12): GPU 임대 가격표. AWS, Azure, RunPod, Vast.ai 의 가격을 매일 모은다.
- yogurt <https://github.com/FrigadeHQ/yogurt> (GitHub, 268): 회의록 앱. 녹음을 내 컴퓨터에서 받아 적고 요약한다.
- solana-vigil <https://github.com/ValidatorStack/solana-vigil> (GitHub, 241): Solana 검증 노드 점검 도구. 상태 점수와 디스크 예측을 실행 파일 하나로 낸다.
- xj-scanner <https://github.com/MZULALI/xj-scanner> (GitHub, 106): 자동차 진단 도구. 1991~95년식 Jeep 의 엔진 컴퓨터를 Arduino Nano 로 읽는다.
- ScroogeFrog AI <https://www.producthunt.com/products/scroogefrog-ai-antifraud> (Product Hunt, 227): 광고 사기 탐지 도구. 가짜 클릭을 걸러 마케팅 예산을 지킨다.
- Nod by n8n <https://www.producthunt.com/products/n8n-io> (Product Hunt, 219): 오픈소스 개인 에이전트. 자신의 컴퓨터를 하나 가지고 일한다.
- CALL-E <https://www.producthunt.com/products/call-e> (Product Hunt, 170): AI 에이전트용 전화 회선. 에이전트가 전화를 걸고 받는다.

## Getting started

- Steps: lazy.nvim 설정에 0xdeadf1sh/AssemblyForNeovim 을 추가하고 require("asm").setup() 호출 ; 함수 안에서 <leader>a, 또는 줄을 선택하고 :Asm
- Needs: Neovim. C 와 C++ 에는 cc 와 c++, Rust 에는 rustc 와 cargo 가 필요하다. 함수 전체의 어셈블리를 보려면 그 언어의 Tree-sitter 파서가 있고, 버퍼에서 Tree-sitter 가 켜져 있어야 한다.
- Cost: Unlicense(퍼블릭 도메인), 무료.
- Note: 플러그인은 C 파일을 기본 옵션 -std=c23 으로 컴파일한다. GCC 13 은 이 옵션을 인식하지 못하므로 compile_commands.json 이 필요하다. 이 파일이 있으면 플러그인은 최적화 수준을 제외하고 파일에 적힌 옵션을 사용한다.
