vice brings a fast, local-first, live Compiler Explorer directly into Vim (8.2+/9+) and Neovim (0.10+) on Windows and Linux.
No web APIs, no uploading private code, no embedded +python3 build headaches, and zero runtime third-party Python dependencies.
Type in your buffer and watch demangled assembly update asynchronously with color-coded line mappings (:ViceOpen clang -O2):
Compare flags or compilers side-by-side (:ViceCompare clang -O0 vs clang -O2) with label-normalized +/-/~ gutter diff cues:
Open any .py file and run :ViceOpen with zero external compiler installs — or compare -O0 vs -O1 to watch assert bytecode disappear:
All demos above are reproducibly generated from live
vice-coreoutput viascripts/demos/generate_gifs.py.
- Works in both Vim and Neovim (Windows & Linux): Async binary NDJSON JSON-RPC 2.0 stdio worker (
vice-core, Python 3.11+ stdlib-only)—never freezes your editor and needs zeropip install. - Real project & unsaved buffer support: Pipes unsaved buffer contents via
stdinwith-iquote <source_dir>so relative#include "..."works while typing, plus trust-gatedcompile_commands.jsonflag loading. - Cross-platform ABI & debug info: Parses Linux ELF DWARF v4/v5 (
.file/.loc), Windows Clang COFF/CodeView (.cv_file/.cv_loc, quoted MSVC labels, SEH), ARM64 (//comments, arch-gated-masm=intel), and LLVM IR (!dbg/!DILocation). - Batched symbol demangling: Demangles hundreds of C++ symbols in one call (in-process Windows
dbghelp.dllfor MSVC +llvm-cxxfilt/c++filt). - Multi-language, bytecode & performance analysis: Built-in adapters for C/C++ (GCC, Clang, MSVC
cl.exe), LLVM IR (llvm-ir), LLVM-MCA (llvm-mcacycle/IPC/resource-pressure reports), WebAssembly (wasm/watviaclang --target=wasm32+llvm-objdump/wasm2wat), Binary Disassembly (objdump/llvm-objdump), Python Bytecode & AST (python-dis,python-ast, zero external tools, never executes user code), Java Bytecode (java,javac -g+javap -c -p -lwithLineNumberTable), Rust (rustc), Zig (zig), and Go (goPlan 9 asm).:ViceOpenautomatically routes by filetype/extension. - Interactive assembly UX & inline metrics: Press
K(:ViceExplain) on any x86-64, ARM64, Python, JVM, or WebAssembly instruction for an offline opcode explanation; pressgdor<CR>on a branch target/call to jump straight to its label (<C-o>jumps back); fold functions withza/zM/zR; toggle inline per-line instruction counts ([3 insns]) with:ViceToggleMetrics; and toggle Clang optimization remarks (-Rpass*) with:ViceRemarks. - Multi-pane comparisons with semantic diff cues: Open synchronized mirrors (
:ViceCompare clang -O0 vs clang -O3, or:ViceCompare clang -O2 vs llvm-ir -O1) with color-coded source↔output highlighting, label-normalized semantic diff signs (+/-/~, ignoring synthetic.LBB0_1vs.L3label differences), bidirectional cursor sync, and dimmed[STALE]retention on transient syntax errors. - Extensible by design: Add any local compiler declaratively via user-owned
compilers.toml(gas,llvm-ir, orpassthroughparsers), or ship third-party Python adapters via thevice.compilersentry-point group. - AI-friendly: Export selected source + exact mapped assembly/IR + flags via
:ViceContext, script structured Schema v1 JSON withvice compile --format json, or connect MCP-compatible AI agents directly via the zero-dependencyvice mcpserver (compile_code,compare_compilers,list_compilers).
- Editor: Vim 8.2+ / 9+ or Neovim 0.10+
- Python: Python 3.11+ on
PATH(no external Python packages required) - Compiler:
clang/clang++and/orgcc/g++(or any custom compiler configured incompilers.toml)
{
"vstiago/vice",
config = function()
require("vice").setup({
default_compiler = "auto",
syntax = "intel", -- automatically gated to x86/x86-64 targets
debounce_ms = 400,
keymaps = {
open = "<leader>vo",
compare = "<leader>vd",
close = "<leader>vc",
toggle_highlight = "<leader>vh",
context = "<leader>vx",
},
})
end,
}Plug 'vstiago/vice'
" Optional configuration & <Plug> mappings:
let g:vice_default_compiler = 'auto'
let g:vice_debounce_ms = 400
nmap <leader>vo <Plug>(ViceOpen)
nmap <leader>vd <Plug>(ViceCompare)
nmap <leader>vc <Plug>(ViceClose)
nmap <leader>vh <Plug>(ViceToggleHighlight)
nmap <leader>vx <Plug>(ViceContext)
xmap <leader>vx <Plug>(ViceContext)git clone https://github.com/vstiago/vice.git ~/.vim/pack/plugins/start/vice- Neovim:
:checkhealth vice - Vim:
:ViceCheckHealth
| Command | Description |
|---|---|
:ViceOpen [compiler] [flags...] |
Open a synchronized output pane (auto-routes C/C++, Python, Java, Rust, Go, Zig; e.g. :ViceOpen clang -O2, :ViceOpen llvm-mca, :ViceOpen python-dis -O1). |
:ViceCompare [A] vs [B] |
Open two synchronized mirrors side-by-side (defaults to -O0 vs -O3; try :ViceCompare clang -O2 vs llvm-ir -O1 or :ViceCompare python-dis -O0 vs python-dis -O1). |
:ViceFlags [flags...] |
Update compiler flags on the current pane/session and recompile immediately. |
:ViceRemarks [pattern] |
Toggle Clang optimization remarks (-Rpass*) as inline note diagnostics. |
:ViceExplain [mnemonic] (K) |
Show offline opcode documentation (x86-64, ARM64, Python, JVM, WebAssembly) in a floating window / popup. |
:ViceToggleHighlight |
Toggle color-coded source↔output line highlights (light & dark theme aware). |
:ViceToggleSyntax |
Flip active mirror(s) between Intel and AT&T syntax and recompile immediately. |
:ViceToggleDemangle |
Toggle symbol demangling on active mirror(s) and recompile immediately. |
:ViceToggleMetrics |
Toggle inline per-source-line instruction-count virtual text ([N insns]). |
:[range]ViceContext[!] [markdown|json] |
Copy selected source + exact mapped assembly/IR + flags to clipboard (+) and unnamed register ("); add ! to open in a vice://context buffer. |
:ViceCompilers |
List detected built-in and user-configured compilers. |
:ViceTrust [path] |
Trust a project .vice.toml or compile_commands.json by canonical path + SHA-256 hash. |
:ViceClose |
Close the current mirror (or all mirrors for the current source buffer). |
See :help vice (doc/vice.txt) for full documentation.
vice-core also runs directly as a CLI (install with pipx install . or run zero-install via PYTHONPATH=src python -m vice_core):
# Emit normalized Schema v1 JSON (lines, source_to_asm, asm_to_source, diagnostics)
vice compile path/to/file.cpp --compiler clang --args "-O2" --format json --pretty
# Inspect LLVM IR from the CLI
vice compile path/to/file.cpp --compiler llvm-ir --args "-O1" --format text
# Explain any x86-64, ARM64, Python, JVM, or WebAssembly opcode offline
vice explain cmovg
# List detected compilers and targets
vice list-compilers
# Run as an MCP (Model Context Protocol) stdio server for AI coding agents
vice mcpPoint any MCP-compatible AI client (Claude Code, Cursor, Antigravity, etc.) at vice mcp:
{
"mcpServers": {
"vice": {
"command": "python",
"args": ["-m", "vice_core", "mcp"],
"env": { "PYTHONPATH": "/path/to/vice/src" }
}
}
}Exposes compile_code, compare_compilers (with label-normalized semantic diff), and list_compilers.
Define custom compilers, cross-compilers, or other languages in your user-owned compilers.toml:
- Linux / macOS:
~/.config/vice/compilers.toml - Windows:
%APPDATA%\vice\compilers.toml
[compilers.arm64-clang]
name = "Clang ARM64 Cross"
executable = "clang++"
args = ["--target=aarch64-linux-gnu", "-S", "-g1", "-x", "c++", "-", "-o", "-"]
languages = ["cpp"]
input_mode = "stdin"
output_mode = "stdout"
parser = "gas" # "gas" | "llvm-ir" | "passthrough"
target = "aarch64-linux-gnu"Then run :ViceOpen arm64-clang -O2 inside Vim or Neovim!
- Custom compiler executables/templates are never loaded from repository
.vice.tomlfiles—only from your user-ownedcompilers.toml. - Repository
.vice.tomlflags andcompile_commands.jsonare ignored until explicitly approved with:ViceTrust(stored by canonical path + SHA-256 hash; any change on disk automatically revokes trust).
See docs/ARCHITECTURE.md for the layered architecture and Schema v1 specification, and AGENTS.md for contributor & AI-agent guidelines.
python -m venv .venv
# Linux/macOS: source .venv/bin/activate | Windows: .\.venv\Scripts\Activate.ps1
pip install -e ".[dev]"
ruff check src tests && ruff format --check src tests && mypy src && pytest -v(The original 2021 +python3 prototype is preserved at git tag v0.0-legacy.)
MIT — see LICENSE.


