vii 0.0.4

Bindings to Vim objects, bindings to Vim channel commands, and a way to interact with Vim using Rust.
Documentation

pre-commit

Bindings to Vim objects, bindings to Vim channel commands, and a way to interact with Vim using Rust.

Aims to be able to eventually write standard plugins in Rust, and potentially services for Vim in Rust using channels.

Installation

Add this line to your dependencies section of your Cargo.toml file.

vii = "0.0.1"

Current interface is highly unstable.

Usage

Data Types

Working with Vim data types.

use vii::DataType;

// Using a Vim data type
let vim_float = DataType::Float(3.14);
// Serializing for transmission to Vim
let serialized_float = vim_float.to_string();  // "3.14"

let vim_string = DataType::String("Hello World!".to_string());
let serialized_string = vim_string.to_string();  // "\"Hello World!\""

Support

List of data type support.

  • Number
  • String
  • Funcref
  • List
  • Dictionary
    • Work in progress using HashMap<String, String>
  • Float
  • Boolean
  • None
  • Job
  • Channel
  • Blob

Vim Channels

Working with Vim channels (see :help channel.txt in Vim).

_Note: This is a low-level API. The eventual, high-level API should look like let expr = Expr::from("line('$')");.

use vii::channel::{
  ChannelCommand,
  Call,
  Expression,
};

// Number of Lines in Current Buffer
// ["expr","line('$')"]
let expression = ChannelCommand::Expr(
  Expression {
    expression: "line('$')".to_string(),
  },
  None,
);

// Number of Lines in Current Buffer
// ["call", "line", ["$"]]
let call = ChannelCommand::Call(
  Call {
    function: "line".to_string(),
    args: vec![DataType::String("$")],
  },
  None,
);


println!("{}", expression.to_string());
// ["expr","line('$')"]
println!("{}", call.to_string());
// ["call", "line", ["$"]]

Contributing

If there are any features you would like added, found any potential bugs, or have any questions, then feel free to create an issue.

Testing

cargo test

Unittests are in the same file, next to the units they are testing (bottom). Integration tests are in /tests/.