neovim-gtk/src/plug_manager/manager.rs

35 lines
777 B
Rust
Raw Normal View History

2017-10-15 19:50:59 +00:00
use std::rc::Rc;
2017-10-18 14:49:56 +00:00
use std::cell::RefCell;
2017-10-16 15:34:26 +00:00
2017-10-18 14:49:56 +00:00
use super::vim_plug;
2017-10-20 15:06:05 +00:00
use super::store::Store;
2017-10-18 14:49:56 +00:00
use nvim::NeovimClient;
2017-10-15 19:50:59 +00:00
pub struct Manager {
2017-10-18 14:49:56 +00:00
pub vim_plug: vim_plug::Manager,
2017-10-15 19:50:59 +00:00
}
impl Manager {
pub fn new() -> Self {
2017-10-18 14:49:56 +00:00
Manager {
vim_plug: vim_plug::Manager::new(),
2017-10-16 15:34:26 +00:00
}
2017-10-15 19:50:59 +00:00
}
2017-10-16 15:34:26 +00:00
2017-10-18 14:49:56 +00:00
pub fn initialize(&mut self, nvim: Rc<RefCell<NeovimClient>>) {
self.vim_plug.initialize(nvim);
2017-10-16 15:34:26 +00:00
}
2017-10-20 15:06:05 +00:00
pub fn load_store(&self, vim_plug_state: &vim_plug::State) -> Store {
match *vim_plug_state {
vim_plug::State::AlreadyLoaded => {
let store = Store::load_from_plug(&self.vim_plug);
store
}
vim_plug::State::Unknown => {
Store::load()
}
}
}
2017-10-16 15:34:26 +00:00
}