Skip to content

Latest commit

 

History

41 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

disenchant

Inspired by emacs plugin disaster, disenchant lets you see asm of the current C, C++, or Rust file.

Assembly code is generated by compiling the target containing the current file. The compilation method for C and C++ is chosen based on the following order of precedence:

compile_commands.json > Makefile > direct gcc/g++ invocation

Rust files in Cargo packages are compiled in their crate context. The package and target are detected through cargo metadata, including library, binary, example, integration test, benchmark, proc-macro, and build script targets. Required target features are enabled automatically. Standalone Rust files are compiled directly with rustc.

The compiled artifact is passed to the configured objdump. If it cannot disassemble the artifact, the plugin falls back to rust-objdump or llvm-objdump when either is available. The asm is then shown in a split window.

installation & configuration

lazy.nvim

Values inside opts are defaults. If you don't want to change them, opts can be {}.

    {
        "evilwaveforms/disenchant",
        opts = {
            keymap = {
                disassemble = "<leader>om",
            },
            compile_command_c = "gcc -g3 -c %s -o %s",
            compile_command_cpp = "g++ -g3 -c %s -o %s",
            compile_command_rust = "rustc -g --emit=obj %s -o %s",
            compile_command_rust_lib = "rustc -g --crate-type=lib --emit=obj %s -o %s",
            cargo_command = "cargo",
            cargo_args = {},
            objdump_command = "objdump -Sl --demangle -Mintel --source-comment --no-show-raw-insn -d %s",
        },
    },

Use cargo_args for project-specific Cargo options such as features, profiles, or target triples:

cargo_args = { "--all-features", "--release" }

About

disassemble C/C++/Rust in neovim

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages