Skip to content

taproot-wizards/bitcoin-script-hints.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 

Repository files navigation

bitcoin-script-hints.nvim

A magical neovim plugin for Bitcoin Script 🪄

description

How does it work?

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.

Example usage

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
    }
}

Installation

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
}

Requirements

  • Neovim >= 0.8.0
  • nvim-treesitter

Acknowledgments

This plugin was inspired by the Script Wiz IDE, which does an excellent job at showing stack changes with real data.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages