Skip to content

NickTsaizer/splitasm.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

splitasm.nvim

In some cases, inspecting the source is not sufficient; the relevant behavior is only visible in the generated machine code.

splitasm.nvim supports that workflow inside Neovim by opening objdump output beside the current file and keeping source and assembly aligned during navigation.

splitasm preview

Overview

Assembly inspection often requires repeatedly switching between source code and disassembled output. SplitAsm keeps both views in a single workspace:

  • source on one side
  • disassembly on the other
  • optional build step before loading
  • cursor sync between both buffers
  • optional cleaned asm for easier reading
  • stable row coloring for asm lines that map back to source

Typical workflow

  1. Open a source file.
  2. Run :SplitAsmOpen.
  3. Read both sides together.

If SplitAsm already knows the executable path, no further setup is required.

Otherwise, it attempts to locate a nearby executable. If that fails, it directs you to :SplitAsmSetup, :SplitAsmConfig, or a one-time explicit path.

Within the assembly split:

  • q closes the split
  • r refreshes the assembly view
  • s toggles synchronization

The same s mapping is also added to source buffers while a SplitAsm session is active.

Installation

lazy.nvim

{
  "NickTsaizer/splitasm.nvim",
  cmd = {
    "SplitAsm",
    "SplitAsmOpen",
    "SplitAsmSetup",
    "SplitAsmConfig",
    "SplitAsmToggleSync",
  },
  opts = {},
}

Minimal setup

require("splitasm").setup()

Example setup

require("splitasm").setup({
  compiler_cmd = "cargo build --release",
  executable_path = "./target/release/myapp",
  auto_sync = true,
  clean_asm = false,
  source_row_colors = true,
})

Opening an executable

Use the configured or auto-detected executable:

:SplitAsmOpen

Use a specific executable for a single invocation:

:SplitAsmOpen ./build/myapp

Windows example:

:SplitAsmOpen .\build\myapp.exe

When executable_path is unset, SplitAsm searches in:

  • .
  • ./build
  • ./bin
  • ./out
  • ./dist

On Windows, auto-detection also tries .exe variants.

Configuration

require("splitasm").setup({
  compiler_cmd = nil,
  executable_path = nil,
  auto_sync = true,
  clean_asm = false,
  source_row_colors = true,
})
Option Default Description
compiler_cmd nil Command to run before loading assembly
executable_path nil Executable to inspect; when unset, SplitAsm auto-detects one, including .exe candidates on Windows
auto_sync true Keep source and assembly cursors aligned on movement
clean_asm false Remove source markers and normalize instruction text
source_row_colors true Apply stable subtle line highlights to asm rows that map back to a source line

require("splitasm").setup() remains intentionally small. SplitAsm validates option types up front and reports invalid values immediately.

Commands

Command Description
:SplitAsmOpen [path] Open the assembly view for the configured executable or an explicit path
:SplitAsm [path] Alias for :SplitAsmOpen
:SplitAsmSetup Guided setup for build command and executable path
:SplitAsmConfig Show current settings, then prompt for updates
:SplitAsmToggleSync Toggle automatic source/assembly sync

Requirements and backend behavior

SplitAsm depends on the following conditions:

  • Neovim 0.9+
  • A supported disassembler backend on your PATH:
    • GNU objdump / objdump.exe
    • LLVM llvm-objdump / llvm-objdump.exe
  • Any external build tool referenced by compiler_cmd must already be installed and runnable from Neovim's current working directory
  • A compiled executable with debug line info for best source mapping

SplitAsm reads assembly through one of these backend-specific commands:

  • GNU objdump -d -Mintel --no-show-raw-insn -l -C
  • LLVM llvm-objdump -d -M intel --no-show-raw-insn -l -C

Limitations

  • Source-to-assembly mapping depends on debug line markers in the binary
  • Auto-detection is heuristic and may not fit every project layout
  • clean_asm = true improves readability, but slightly changes raw objdump presentation
  • Build failures and missing executables are reported clearly, but SplitAsm does not infer project-specific build steps for you
  • SplitAsm only supports GNU/LLVM objdump-style backends
  • Mixed shell environments on Windows may still require manual PATH or executable-path configuration

Help

After installation, see :help splitasm.

About

godbolt at home

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages