Crates.io | vim-plugin-metadata |
lib.rs | vim-plugin-metadata |
version | 1.0.0-rc.0 |
source | src |
created_at | 2024-08-30 19:48:35.744601 |
updated_at | 2024-09-10 05:02:46.470019 |
description | Parse and analyze your vim plugins, from Rust! |
homepage | |
repository | https://github.com/dbarnett/vim-plugin-metadata |
max_upload_size | |
id | 1358077 |
size | 53,436 |
Parse and analyze your vim plugins, from Rust!
WARNING: This library is early alpha, still missing tons of functionality, and probably has serious bugs. Use at your own risk.
cargo add
it to your project, point it at a file, get metadata:
use vim_plugin_metadata::VimParser;
fn main() {
let mut parser = VimParser::new().unwrap();
let plugin = parser.parse_plugin_dir(".vim/plugged/someplugin").unwrap();
println!("{plugin:#?}");
}
VimPlugin {
content: [
VimModule {
path: Some("plugin/somefile.vim"),
doc: Some("File header comment"),
nodes: [],
},
VimModule {
path: Some("autoload/someplugin.vim"),
doc: None,
nodes: [
Function {
name: "someplugin#DoThing",
args: [],
modifiers: [],
doc: "Does something cool.",
},
],
},
],
}
const VIMSCRIPT_CODE: &str = r#"
""
" File header comment
""
" Does something cool.
func MyFunc() abort
…
endfunc
"#;
let module = parser.parse_module_str(VIMSCRIPT_CODE).unwrap();
println!("{module:#?}");
VimModule {
path: None,
doc: Some("File header comment"),
nodes: [
Function {
name: "MyFunc",
args: [],
modifiers: [],
doc: Some(
"Does something cool.",
),
},
]
}
See tests in src/lib.rs for more usage examples.