Skip to content

Rust library to support retrieving variables from vim & neovim

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

chipsenkbeil/vimvar-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vimvar-rs: Library to read neovim/vim variables from Rust

Build Status Crates.io Docs.rs


Installation

# Cargo.toml
[dependencies]
vimvar = "0.3"

Usage

// Loads g:my_global_var from default vimrc, returning None if it does not
// exist, and casting to type String from the default serde_json::Value
//
// Only fails unwrap if neovim/vim fails to run or type fails to cast
let var: Option<String> = vimvar::load_typed_global_var("my_global_var").unwrap();
println!("Loaded g:my_global_var = {:?}", var);

For more a more explicit example

use vimvar::*;
use serde_json::json;

// Load explicitly a buffer variable (b:my_buffer_var) using neovim
let var = VimVar::new(Cmd::NeoVim, Scope::Buffer, "my_buffer_var");

// Load the variable using a different config file versus the standard one
let value = var.load_with_config("path/to/config.vim", false).expect("Failed to load variable");
assert_eq!(value, Some(json!("some buffer value")));

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in vimvar by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

About

Rust library to support retrieving variables from vim & neovim

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

 
 
 

Languages