@@ -0,0 +1,105 @@
1+#!/usr/bin/env python
2+
3+from os import makedirs
4+from os.path import basename
5+from os.path import dirname
6+from os.path import exists
7+from os.path import expanduser
8+from os.path import join
9+from os.path import splitext
10+from shutil import copyfile
11+from subprocess import call
12+
13+
14+HOME = expanduser("~")
15+PWD = dirname(__file__)
16+
17+
18+def create_vim_bundle():
19+ """ Create necessary folders: .vim/bundle """
20+
21+ bundle = join(HOME, ".vim/bundle")
22+ autoload = join(HOME, ".vim/autoload")
23+
24+ if not exists(bundle):
25+ makedirs(bundle)
26+
27+ if not exists(autoload):
28+ makedirs(autoload)
29+
30+
31+def install_pathogen():
32+ """ get and install the latest pathogen """
33+
34+ autoload = join(HOME, ".vim/autoload/pathogen.vim")
35+
36+ if not exists(autoload):
37+ call(["curl", "-L", "https://tpo.pe/pathogen.vim", "-o", autoload])
38+
39+
40+def clone_plugins():
41+ """ read from the list and clone each one """
42+
43+ plugin_list = join(PWD, "vim_plugins.txt")
44+ bundle = join(HOME, ".vim/bundle")
45+
46+ with open(plugin_list) as f:
47+ plugins_list = f.readlines()
48+
49+ for plugin_url in plugins_list:
50+ foldername = splitext(basename(plugin_url))[0]
51+ print join(bundle, foldername)
52+ call(["git", "clone", plugin_url, join(bundle, foldername)])
53+
54+
55+def setup_vim():
56+ """ copy the vim file """
57+
58+ vimrc = join(HOME, ".vimrc");
59+
60+ if not exists(vimrc):
61+ copyfile(join(PWD, "vimrc"), vimrc)
62+
63+
64+def install_ohmyzsh():
65+ """ installs oh-my-zsh """
66+
67+ ohmyzsh_folder = join(HOME, ".oh-my-zsh")
68+ zshrc_file = join(HOME, ".zshrc")
69+ install_script = join(PWD, "ohmyzsh_install.sh")
70+
71+ if exists(ohmyzsh_folder) and exists(zshrc_file):
72+ print "Looks installed, won't forcefully re-install"
73+ return
74+
75+ call(["curl", "-L", "http://install.ohmyz.sh", "-o", install_script])
76+ call(["sh", install_script])
77+
78+
79+def setup_zsh():
80+ """ moves the file into the correct place """
81+
82+ zshrc = join(HOME, ".zshrc")
83+ theme = join(HOME, ".oh-my-zsh/custom/themes/xonecas.zsh-theme")
84+
85+ if not exists(zshrc):
86+ copyfile(join(PWD, "zshrc"), zshrc)
87+
88+ if not exists(theme):
89+ copyfile(join(PWD, "xonecas.zsh-theme"), join(theme))
90+
91+
92+def main():
93+ # vim
94+ create_vim_bundle()
95+ install_pathogen()
96+ clone_plugins()
97+ setup_vim()
98+
99+ # zsh
100+ install_ohmyzsh()
101+ setup_zsh()
102+
103+
104+if __name__ == "__main__":
105+ main()