Rust plugin for Nextpad++ / Notepad++ on macOS — a full rewrite of the original
Windows/Rust plugin rustnpp by
ნიკა (Nika Begiashvili), reimplemented from scratch in Objective-C++ as a
standard native plugin.
Adds two commands under Plugins → Rust plugin:
- Run — run the current Rust source via the toolchain.
- Build — compile the current Rust source via the toolchain.
Behaviour (faithful to the original):
- If the current file is inside a Cargo project — that is, walking up the
file's path reaches a directory named
srcwhose parent contains aCargo.toml— the plugin runscargo run/cargo buildfrom that project root. - Otherwise the file is treated as a stand-alone
.rsfile: Build runsrustc <file.rs>in the file's directory; Run additionally executes the produced binary (./<file-stem>) afterwards.
The combined stdout + stderr of the toolchain (and the program, for Run) is
opened in a new editor tab. This is the macOS-native equivalent of the
original Windows behaviour, which popped a console window
(cmd /c start cmd /c "<cmd> & pause") showing the same output.
Install Rust from https://www.rust-lang.org/tools/install. The recommended
rustup installer places cargo and rustc in ~/.cargo/bin, which the plugin
searches (along with your PATH and the usual /usr/local/bin,
/opt/homebrew/bin, …). If the toolchain can't be found, the plugin shows an
alert with install instructions instead of doing anything destructive.
- Output surface: new editor tab (captured via
NSTask) instead of a pop-up console window — there is no per-plugin console window on macOS, and a new tab is the established Notepad++-macOS idiom for command output. - Keyboard shortcuts: the original bound F10 (Run) and Ctrl+F10
(Build). The macOS host ignores plugin-supplied shortcuts (
FuncItem._pShKey), so these are not bound here. Invoke the commands from the Plugins menu. - Toolchain discovery: the original assumed
cargo/rustcwere onPATH. A GUI app on macOS inherits a minimalPATH, so this port also looks in~/.cargo/bin. - The plugin makes no changes to the host and ships no bundled resources or toolbar icons (the original Rust crate had none).
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -jProduces a universal (arm64 + x86_64) rustnpp.dylib. cmake --install build
copies it to
~/Library/Application Support/Nextpad++/plugins/rustnpp/rustnpp.dylib.
The original rustnpp repository did not include a license file. This macOS
port follows the original; treat it as provided by its respective authors.