first version of install script
This commit is contained in:
42
install_files.py
Executable file
42
install_files.py
Executable file
@@ -0,0 +1,42 @@
|
|||||||
|
#! /usr/bin/env python3
|
||||||
|
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
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")
|
||||||
|
|
||||||
|
|
||||||
|
try:
|
||||||
|
pdotfiles_vimrc = pdotfiles.resolve().relative_to(phome.resolve()) / Path(".vimrc")
|
||||||
|
except ValueError:
|
||||||
|
pdotfiles_vimrc = pdotfiles / Path(".vimrc")
|
||||||
|
|
||||||
|
if force and phome_vimrc.exists():
|
||||||
|
phome_vimrc.unlink()
|
||||||
|
|
||||||
|
if phome_vimrc.exists():
|
||||||
|
print('.vimrc already there')
|
||||||
|
else:
|
||||||
|
print("Symlinking {} to {}".format(phome_vimrc, pdotfiles_vimrc))
|
||||||
|
phome_vimrc.symlink_to(pdotfiles_vimrc)
|
||||||
|
|
||||||
|
#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())
|
||||||
|
print("Install Vundle")
|
||||||
|
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]))
|
||||||
|
|
||||||
Reference in New Issue
Block a user