A magical neovim plugin for Bitcoin Script 🪄
This plugin is intended to be used in Rust projects that use the script!
macro (from rust-bitcoin-script).
The first line after the script!
invocation must be in one of these formats:
[X, Y]
(just the main stack)[X, Y], [Z]
(the main stack and the alt-stack)
You can try it out with some examples from the Bitcoin Wildlife Sanctuary.
use bitcoin_script::{define_pushable, script};
define_pushable!();
fn retrieve_hashed_leaf_item() -> ScriptBuf {
script! {
// [1, 2], [3] <-- Add this comment
OP_DUP // you should now see [1, 2, 2], [3] here
OP_2 // and [1, 2, 2, 2], [3] here
OP_ADD // etc...
OP_DEPTH
OP_GREATERTHAN
OP_IF
OP_FROMALTSTACK
OP_SWAP
OP_ENDIF
}
}
Using lazy.nvim:
{
"taproot-wizards/bitcoin-script-hints.nvim",
dependencies = { "nvim-treesitter/nvim-treesitter" },
config = function()
require("bitcoin-script-hints").setup()
end
}
Using vim-plug
Plug 'taproot-wizards/bitcoin-script-hints.nvim'
Plug 'nvim-treesitter/nvim-treesitter'
" After plugin installation, add to your init.vim/init.lua:
lua require('bitcoin-script-hints').setup()
Using packer.nvim:
use {
'taproot-wizards/bitcoin-script-hints.nvim',
requires = { 'nvim-treesitter/nvim-treesitter' },
config = function()
require('bitcoin-script-hints').setup()
end
}
- Neovim >= 0.8.0
- nvim-treesitter
This plugin was inspired by the Script Wiz IDE, which does an excellent job at showing stack changes with real data.