boxofrox / neovim-scorched-earth

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

neovim-scorched-earth

A stupid proof-of-concept for a Neovim plugin written in Rust using daa84/neovim-lib.

What does it do?

Scorched Earth highlights the region of text that was touched by the cursor while in Insert or Replace modes.

demo

Why... this?

  1. This is my first Neovim plugin in Rust.

  2. A highlight plugin is new territory and interests me, so I'm less likely to give up on it.

  3. I'm unfamiliar with the nuances of Msgpack RPC communications with Neovim using neovim-lib. The way was fraught with danger. This project was just deep enough to burn myself a few times tinkering with different designs, and shallow enough that I didn't invest a depressing amount of work that needed refactoring.

  4. Experiment with a directory structure to combine the rust source and vimscript plugin.

Try it out

  1. It's dangerous to go alone. Take this! https://www.rustup.rs/

  2. Use the stable rust compiler.

rustup install stable
rustup default stable
  1. Fetch the plugin.
$ git clone https://github.com/boxofrox/neovim-scorched-earth.git
  1. Build the binary portion of the plugin.
$ cd neovim-scorched-earth
$ cargo build --release
  1. Test it out in a fresh instance of Neovim. (If Windows requires any changes, open an issue!)
nvim -u ./init.vim --noplugin -c ":ScorchedEarthConnect"

The ScorchedEarthConnect command spawns the Rust plugin in a separate process and establishes a channel.

Todo

  • Add vimscript variable g:scorched_earth_syntax_group to select highlight color using existing syntax groups.

  • Add vimscript variable g:scorched_earth_program to specify location of Rust plugin binary. Will facilitate testing development binaries.

About

License:Apache License 2.0


Languages

Language:Rust 57.8%Language:Vim Script 42.2%