Remove .vim file when disabled

This commit is contained in:
daa 2017-11-05 22:31:38 +03:00
parent 9c997a5165
commit bff3bdb120
3 changed files with 4 additions and 3 deletions

View File

@ -1,5 +1,5 @@
use std::path::PathBuf;
use std::fs::OpenOptions;
use std::fs::{remove_file, OpenOptions};
use std::io::Write;
use dirs;
@ -27,6 +27,7 @@ impl NvimConfig {
Ok(file) => Some(file),
}
} else {
NvimConfig::config_path().map(remove_file);
None
}
}

View File

@ -27,7 +27,7 @@ impl Manager {
}
}
pub fn load_config(&self) -> Option<PlugManagerConfigSource> {
pub fn generate_config(&self) -> Option<PlugManagerConfigSource> {
if self.store.is_enabled() {
Some(PlugManagerConfigSource::new(&self.store))
} else {

View File

@ -116,7 +116,7 @@ impl<'a> Ui<'a> {
let mut manager = self.manager.borrow_mut();
manager.clear_removed();
manager.save();
if let Some(config_path) = NvimConfig::new(manager.load_config()).generate_config() {
if let Some(config_path) = NvimConfig::new(manager.generate_config()).generate_config() {
if let Some(path) = config_path.to_str() {
manager.vim_plug.reload(path);
}