-
Notifications
You must be signed in to change notification settings - Fork 1
/
loader.vim
85 lines (67 loc) · 1.87 KB
/
loader.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
80
81
82
83
84
85
" don't know why but shell should be defined in this script
" if move to config.vim, it slows the neovim a lot.
" set shell=/bin/bash\ --norc\ --noprofile
set shell=/bin/sh
function! g:EnvVar(name, default)
return !empty(getenv(a:name)) ? getenv(a:name) : a:default
endfunction
let g:dropbox_home = g:EnvVar('DROPBOX_HOME', expand('$HOME/Dropbox'))
let g:vim_home = expand('<sfile>:p:h')
let g:vim_data = '$HOME/.local/share/vim'
if has('nvim')
let g:vim_data = '$HOME/.local/share/nvim'
endif
if has('win64') || has('win32') || has('win16')
let g:osuname = 'Windows'
let g:vimrc = 'vimfiles'
let g:wsl = 0
else
let g:osuname = substitute(system('uname'), "\n", '', '')
let g:vimrc ='.vim'
let g:wsl = matchstr(g:osuname, 'microsoft')
endif
function! IncludeScript(scriptname)
execute 'source ' . g:vim_home . '/' . a:scriptname
endfunction
function! IncludeDir(dirname)
for f in split(glob(a:dirname), '\n')
exe 'source' f
endfor
endfunction
function! FindExecutable(paths)
for p in a:paths
if executable(p)
return p
endif
endfor
endfunction
function! g:IsEnvVarSet(name)
return !empty(getenv(a:name))
endfunction
function! g:IsEnvVarTrue(name)
let l:v = getenv(a:name)
return or(l:v ==? 'true', l:v == '1')
endfunction
function! g:IsEnvVarFalse(name)
let l:v = getenv(a:name)
return or(l:v ==? 'false', l:v == '0')
endfunction
" this must load before others
call IncludeScript('core.vim')
if has('gui_running')
call IncludeScript('gui.vim')
endif
if g:osuname ==? 'Linux'
call IncludeScript('os/linux.vim')
elseif g:osuname ==? 'Darwin'
call IncludeScript('os/macos.vim')
elseif g:osuname ==? 'Windows'
call IncludeScript('os/windows.vim')
endif
if g:wsl ==? 'Microsoft'
call IncludeScript('os/wsl.vim')
endif
call IncludeDir(g:vim_home . '/before/*.vim')
if !exists('g:lightline')
call IncludeScript('statusline.vim')
endif