-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimsrc_bootstrap.vim
executable file
·79 lines (73 loc) · 3.3 KB
/
vimsrc_bootstrap.vim
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
if ! exists("g:vimruntime.ignore_further_bootstrapping") || g:vimruntime.ignore_further_bootstrapping != 1
let g:vimruntime.ignore_further_bootstrapping = 1
if expand("$VIMINIT") !=# '$VIMINIT'
unlet $VIMINIT
endif
" vimruntime.bootstrap.vimrc | setup variable scopes / bootstrap{{{
if ! exists("vimruntime")
call _VimRuntimeLog("vimruntime dictionary not found; it seems stock_vim_init.vim was not loaded", 1)
endif
if ! exists("vimruntime.bootstrap")
let vimruntime.bootstrap = {}
endif
if ! exists("vimruntime.bootstrap.vimrc")
let vimruntime.bootstrap.vimrc = {}
endif
let vimruntime.bootstrap.dir = expand('<sfile>:p:h')
let vimruntime.bootstrap.vimrc.scriptfile = expand('<sfile>:p')
let vimruntime.bootstrap.vimrc.optutils = fnamemodify(vimruntime.bootstrap.vimrc.scriptfile, ':p:h')."/opt/bootstrap_vimrc_utils.vim"
"}}}
" source optional utils from .../opt/{{{
if filereadable(vimruntime.bootstrap.vimrc.optutils)
exec printf('source %s', vimruntime.bootstrap.vimrc.optutils)
endif
"}}}
let vimruntime.bootstrap.vimrc.sourced = []
let vimruntime.bootstrap.vimrc.sourced_lastrun = []
"sourcing definitions in function and command, execution for first time
"TODO: should this function declare 'abort'?
fun! _SourceAllVimrc()
let g:vimruntime.bootstrap.vimrc.sourced_lastrun = []
" try
for rcfile in g:vimruntime.stock_vim_init.vimrc_spec.rc
" TODO: there should be ways to make a rcfile optional!
if filereadable(rcfile)
execute printf("source %s", rcfile)
else
if index(g:vimruntime.stock_vim_init.vimrc_spec.rc_is_optional, rcfile) == -1
throw "vimrc_spec.rc contains a non-existent file that's non-optional: ".rcfile
endif
endif
call add(g:vimruntime.bootstrap.vimrc.sourced, rcfile)
call add(g:vimruntime.bootstrap.vimrc.sourced_lastrun, rcfile)
endfor
" finally
" let wrapupRcfile = g:vimruntime.bootstrap.dir . "/wrapup/wrapup.vim"
" execute printf("source %s", wrapupRcfile)
" call add(g:vimruntime.bootstrap.vimrc.sourced, wrapupRcfile)
" call add(g:vimruntime.bootstrap.vimrc.sourced_lastrun, wrapupRcfile)
" endtry
endf
" Set it off...
let $MYVIMRC=expand("<sfile>:p")
fun! _calcRuntimepath()
let recalculatedParts = g:vimruntime.stock_vim_init.newRTPList
let beforeParts = g:vimruntime.stock_vim_init.prependRTPList
let afterParts = g:vimruntime.stock_vim_init.appendRTPList
let &runtimepath = join(beforeParts+recalculatedParts+afterParts, ",")
endfun
fun! _calcPackpath()
let recalculatedParts = g:vimruntime.stock_vim_init.newPPList
let beforeParts = g:vimruntime.stock_vim_init.prependPPList
let afterParts = g:vimruntime.stock_vim_init.appendPPList
let &packpath = join(beforeParts+recalculatedParts+afterParts, ",")
endfun
call _calcRuntimepath()
" echom "Runtimepath:"
" ReadPathE &runtimepath
call _calcPackpath()
" echom "Packpath:"
" ReadPathE &packpath
endif
exec printf("source %s/simpleide.vim", expand('<sfile>:p:h'))
call _SourceAllVimrc()