Skip to content

PLAZMAMA/bunnyhop.nvim

Repository files navigation

bunnyhop.nvim

Hop across your code at lightning speed ⚡️⚡️⚡️

Note

This plugin is in alpha version, expect bugs, lacking features and documentation. If you found a bug, reporting it would be appriciated, while fixing it via a pull request would be greatly appriciated.

Features

Supports Copilot and Hugging Face LLM's

Predicts your next desired cursor position a preview window, allowing you to hop to it via your chosen keybinding.

bhop_feat_1

Installation

Prerequisites

Either Copilot(Recommenced) or Hugging Face's Serverless.

  • For Copilot, you only need to set it up via copilot.lua or copilot.vim.
  • For Hugging Face, an API key is required. Learn how to set it up here. Once you have the API key, create an enviornment variable for the key, eg. export HF_API_KEY=************.
{
    "PLAZMAMA/bunnyhop.nvim",
    lazy = false, -- This plugin does not support lazy loading for now
    -- Setting the keybinding for hopping to the predicted location.
    -- Change it to whatever suits you.
    keys = {
        {
            "<C-h>",
            function()
                require("bunnyhop").hop()
            end,
            desc = "[H]op to predicted location.",
        },
    },
    opts = {}, -- if using copilot
    -- Or
    -- opts = {adapter = "hugging_face", api_key = "HF_API_KEY", model = "Qwen/Qwen2.5-Coder-32B-Instruct"}, -- if using hugging face
},

Configuration

Bunnyhop is configured via the setup() function. The default configuration values can be found here.

Development

Run tests

Running tests requires either

to be installed1.

You can then run:

luarocks test --local
# or
busted

Or if you want to run a single test file:

luarocks test spec/path_to_file.lua --local
# or
busted spec/path_to_file.lua

Common Errors

If you encounter the module 'busted.runner' not found or pl.path requires LuaFileSystem errors, fix it by runing the following command the following command:

eval $(luarocks path --no-bin)

If you encounter sh: nlua: command not found error the error above occurs do1:

Linux/Max

Run the following command:

export PATH=$PATH:~/.luarocks/bin

Windows

See the following guide to a variable to the PATH: add to PATH.

Note

For local testing to work you need to have Lua 5.1 set as your default version for luarocks. If that's not the case you can pass --lua-version 5.1 to all the luarocks commands above, or set lua version 5.1 globally by running luarocks config --scope system lua_version 5.1.

Acknowledgments

  • Thank you Oli Morris for encoraging me to make to plugin.
  • Cursor for the inspiration for this plugin.

Footnotes

  1. The test suite assumes that nlua has been added to the PATH. 2

About

🐇 Hop around your code at lightning speed ⚡️

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages