-
Notifications
You must be signed in to change notification settings - Fork 7
/
.vimrc
170 lines (141 loc) · 5.99 KB
/
.vimrc
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""o "
" @file vimrc
" @author Charles Gueunet, Axel Martin
" @brief Vim main configuration file
" @version 0.6
" @date 04-01-2016
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"}}}"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Usefull variables {{{
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Windows ?
let g:isWin = has('win16') || has('win32') || has('win64')
" / or \ depending on OS
let g:file_sep = (g:isWin)?'\':'/'
" Exemples on Linux, using $HOME/.vimmic as install folder
" ~/
let g:Vimmic_HOME = fnamemodify(expand('<sfile>'), ':p:h:gs').g:file_sep
if getftype(expand('<sfile>')) ==# 'link'
" ~/.vimmic/
let g:Vimmic_BASE = fnamemodify(resolve(expand('<sfile>')), ':p:h:gs').g:file_sep
else
" default to ~/.vim/ if not the symLink install method
let g:Vimmic_BASE = g:Vimmic_HOME.g:file_sep.'.vim'.g:file_sep
endif
" ~/.vimmic/config/
let g:Vimmic_CONFIG = g:Vimmic_BASE.'config'.g:file_sep
" ~/.vimmic/config/plugins/
let g:Vimmic_CONFIG_PLUGINS = g:Vimmic_CONFIG.'plugins'.g:file_sep
" ~/.vimmic/dein/repos/github.com/Shougo/dein.vim/
let g:Vimmic_DEIN = g:Vimmic_BASE.join(['dein', 'repos', 'github.com', 'Shougo', 'dein.vim'], g:file_sep)
" ~/.vimmic/.vimrc.preconf
let g:Vimmic_PRECONF = g:Vimmic_BASE.'.vimrc.preconf'
" ~/.vimmic/.vimrc.postconf
let g:Vimmic_POSTCONF = g:Vimmic_BASE.'.vimrc.postconf'
" Plugins blacklist
let g:Vimmic_DISABLED = []
"}}}"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Dein first install {{{
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" First install
let g:deinNeedInstall=0
if !filereadable(expand(g:Vimmic_DEIN).g:file_sep.'README.md')
if executable('git')
let g:deinNeedInstall=1
echom 'Install dein'
exec '!git clone --depth 1 https://github.com/Shougo/dein.vim '.g:Vimmic_DEIN
else
echohl WarningMsg
echom 'Git needed ! (how did you get this conf without it ?)'
echohl None
endif
endif
"}}}"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" User custom configuration {{{
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Load the vimrc.preconf if exist
if filereadable(g:Vimmic_PRECONF)
execute 'source' g:Vimmic_PRECONF
endif
"}}}"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Global configuration {{{
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Leader key
if !exists('g:mapleader')
let g:mapleader=',' " Leader key is `,`.
endif
" Basics configuration of the editor (file, search, completion, cursor, ...)
execute 'source '.g:Vimmic_CONFIG.'editor.vim'
" basics functions to Update plugins, debug, highlight under cursor...
execute 'source '.g:Vimmic_CONFIG.'functions.vim'
" Basics colors and theme
execute 'source '.g:Vimmic_CONFIG.'theme.vim'
" Basics vim shortcuts (editor, completion, navigation, ...)
execute 'source '.g:Vimmic_CONFIG.'shortcuts.vim'
"}}}"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Plugin import {{{
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"dein Scripts-----------------------------
if &compatible
set nocompatible " Be iMproved
endif
execute 'set runtimepath^='.g:Vimmic_DEIN
" no git history
let g:dein#types#git#clone_depth =1
let g:Vimmic_NEED_LOAD = dein#load_state(g:Vimmic_BASE.'dein')
if g:Vimmic_NEED_LOAD
call dein#begin(g:Vimmic_BASE.'dein')
call dein#load_toml(g:Vimmic_BASE.'plugins.toml')
call dein#load_toml(g:Vimmic_BASE.'plugins_ft.toml', {'lazy': 1})
" To add you custom plugins, add them in this file
" The syntax is realy simple, see vimmic-toml help
if filereadable(g:Vimmic_BASE.'custom.toml')
call dein#load_toml(g:Vimmic_BASE.'custom.toml')
endif
" To disable default plugins of this conf, add them in this file
" The syntax is realy simple, see vimmic-toml help
if filereadable(g:Vimmic_BASE.'disable.toml')
call DisablePlugins(g:Vimmic_BASE.'disable.toml', 1)
" Dein update after modifying this file
call add(g:dein#_vimrcs, g:Vimmic_BASE.'disable.toml')
endif
" Required:
call dein#end()
call dein#save_state()
endif
" keep construction this list of disabled plugins
" Required:
filetype plugin indent on
"End dein Scripts-------------------------
" Install post-process
" If you want to install not installed plugins on startup.
if g:deinNeedInstall
if dein#check_install()
"fix ensure the user will see the procedure
let g:dein#install_max_processes = 1
call dein#install()
execute 'helptags '.g:Vimmic_BASE.'doc'
endif
endif
"}}}"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Module and environment configuration {{{
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Load all plugins confs
" Each file have:
" - settings
" - shortcuts
" - colors and theme
for s:pluginConf in globpath(g:Vimmic_CONFIG_PLUGINS, '*.vim' ,0 ,1)
execute 'source' s:pluginConf
endfor
" Add the vimmic folder in the runtimpath for the documentation
" (in case it is not ~/.vim)
execute 'set runtimepath ^='.g:Vimmic_BASE
"}}}"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Post-configuration : used for plugins configuration and colors / themes
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Load the vimrc.postconf if exist
" See the help in vimmic-config
if filereadable(g:Vimmic_POSTCONF)
execute 'source' g:Vimmic_POSTCONF
endif