-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.vim
More file actions
90 lines (70 loc) · 2.21 KB
/
setup.vim
File metadata and controls
90 lines (70 loc) · 2.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
let g:vimdir = expand("<sfile>:p:h")
let g:modfile = g:vimdir . "/MODIFIED"
let g:bundledir = g:vimdir . "/bundle"
let g:vundledir = g:bundledir . "/vundle"
let s:vundle = "https://github.com/gmarik/Vundle.vim"
" ////////////////////////////////////////////
" ////////////////////////////////////////////
fun! InitVundle ( ... )
" Supply n(2) to delete bundle dir
if a:0 >= 1 && a:000[0] == "2"
call RemoveBundles()
endif
" Don't run more than once unless FORCED to
if !exists('g:vinit') || g:vinit == 0 || a:0 > 0 && a:000[0] == 1
exec "chdir " . g:vimdir
if isdirectory('bundle')
echom "BUNDLE EXISTS"
finish
else
chdir $HOME/.vim/
echom "mkdir .vim/bundle :: " . system("mkdir bundle")
chdir ./bundle
echom "clone vundle dir :: " . system( "git clone " . s:vundle . " vundle" )
chdir ./vundle
let g:vinit = 1
endif
else
echom "I don't see a need to install vundle right now."
endif
endfun
" WIPE BUNDLES
fun! RemoveBundles ()
echom "LS of .vim b4 :: " . system("/bin/ls ~/.vim/bundle")
let res = system( "/bin/rm -rf " . g:bundledir )
echom "rm ".g:bundledir . " results: " . res
echom "PWD " . getcwd()
echom "LS of .vim after :: " . system("/bin/ls ~/.vim/bundle")
let g:vinit = 0
endfun
" SET MODIFIED
fun! SetModified ()
echom "MODIFIED flag set."
return system( "!touch " . g:modfile )
endfun
fun! RemoveModified ()
echom "MODIFIED flag removed."
return system( "!rm -f " . g:modfile )
endfun
" BUNDLE UPDATE
fun! UpdateBundles( ... )
" If called with, set modified flag so we reload
if exists("a:0") && a:0 == 1
call SetModified()
echom "Supplied an arg."
endif
" If modflag is set, nuke budles and re-sync
if filereadable( g:modfile )
call RemoveModified()
echom "Updating vundle packages."
exec "source " . g:vimdir . "/vundle.vim"
exec "BundleInstall"
exec "qall"
endif
endfun
fun! BI()
exec 'BundleInstall'
exec 'qall'
endfun
command! Update call BI()
autocmd * VimEnter :call InitVundle()