Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
Fix vim breakage. Detect ~/.vim/vimrc as well
Browse files Browse the repository at this point in the history
  • Loading branch information
r-darwish committed Jun 7, 2018
1 parent c490b2c commit 6cceb58
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,8 @@ fn main() -> Result<(), Error> {
}
}

if let Ok(vim) = which("Vim") {
let vimrc = home_path(".vimrc");
if vimrc.exists() {
if let Ok(vim) = which("vim") {
if let Some(vimrc) = vim::vimrc() {
if let Some(plugin_framework) = vim::PluginFramework::detect(&vimrc) {
terminal.print_separator(&format!("vim ({:?})", plugin_framework));
run_vim(&vim, &vimrc, plugin_framework.upgrade_command())
Expand Down
19 changes: 19 additions & 0 deletions src/vim.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use super::home_path;
use std::fs;
use std::path::PathBuf;

Expand Down Expand Up @@ -31,3 +32,21 @@ impl PluginFramework {
}
}
}

pub fn vimrc() -> Option<PathBuf> {
{
let vimrc = home_path(".vimrc");
if vimrc.exists() {
return Some(vimrc);
}
}

{
let vimrc = home_path(".vim/vimrc");
if vimrc.exists() {
return Some(vimrc);
}
}

None
}

0 comments on commit 6cceb58

Please sign in to comment.