This commit is contained in:
2015-12-04 12:16:49 +01:00
parent f6b407a14c
commit d976b94905
2 changed files with 20 additions and 9 deletions

View File

@@ -6,19 +6,20 @@ from pathlib import Path
from subprocess import check_call
import shutil
def install_vim(pdotfiles, force=False):
phome = Path(os.path.expanduser("~")).resolve()
phome_vimrc = phome / Path(".vimrc")
prelvimrc = Path("vim/vimrc")
try:
pdotfiles_vimrc = pdotfiles.resolve().relative_to(phome.resolve()) / prelvimrc
except ValueError:
pdotfiles_vimrc = pdotfiles / prelvimrc
if force and phome_vimrc.is_symlink():
phome_vimrc.unlink() # only kill symlinks
phome_vimrc.unlink() # only kill symlinks
if phome_vimrc.exists():
print('.vimrc already there!')
@@ -26,18 +27,19 @@ def install_vim(pdotfiles, force=False):
print("Symlinking {} to {}".format(phome_vimrc, pdotfiles_vimrc))
phome_vimrc.symlink_to(pdotfiles_vimrc)
#vundle
# vundle
pvundle = phome / Path(".vim/bundle/Vundle.vim")
if not force and pvundle.exists():
print("Vundle already installed?")
else:
if force and pvundle.exists():
shutil.rmtree(pvundle.as_posix())
shutil.rmtree(pvundle.as_posix())
print("Install Vundle")
check_call(["git", "clone", "https://github.com/VundleVim/Vundle.vim.git", pvundle.as_posix()])
check_call(
["git", "clone", "https://github.com/VundleVim/Vundle.vim.git",
pvundle.as_posix()])
if __name__ == "__main__":
if len(sys.argv) == 2:
install_vim(Path(sys.argv[1]))