-
Notifications
You must be signed in to change notification settings - Fork 105
/
vimrc
287 lines (213 loc) · 7.93 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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
"
" __ _(_)_ __ ___ _ __ ___
" \ \ / / | '_ ` _ \| '__/ __|
" \ V /| | | | | | | | | (__
" (_)_/ |_|_| |_| |_|_| \___|
"
" Author: Xianzhe Liang <[email protected]>
" Source: https://github.com/liangxianzhe/oh-my-vim
" Setup language {{{ ==========================================================
" language en_US.UTF-8 " Solve some plugins incompatibilities
" }}}
set nocompatible " No to the total compatibility with the ancient vi
" TODO use vimscript to check update, this will leave some blank lines after
" leaving vim
silent !sh $OH_MY_VIM/tools/check_for_upgrade.sh
" Load external configuration before anything else {{{
let s:before_vimrc = expand('~/.before.vimrc')
if filereadable(s:before_vimrc)
exec ':so ' . s:before_vimrc
endif
" }}}
"
" NEOBUNDLE {{{ ===============================================================
" NeoBundle auto-installation and setup {{{
" Auto installing NeoBundle
let iCanHazNeoBundle=1
let neobundle_readme=expand($OH_MY_VIM."/bundle/neobundle.vim/README.md")
let neobundle_runtimepath=expand($OH_MY_VIM."/bundle/neobundle.vim/")
if !filereadable(neobundle_readme)
echo "Installing NeoBundle.."
echo ""
execute "silent !mkdir -p ".$OH_MY_VIM."/bundle"
execute "silent !git clone https://github.com/Shougo/neobundle.vim ".$OH_MY_VIM."/bundle/neobundle.vim"
let iCanHazNeoBundle=0
endif
" Call NeoBundle
if has('vim_starting')
let &rtp=neobundle_runtimepath.','.&rtp
endif
call neobundle#begin(expand($OH_MY_VIM.'/bundle/'))
" is better if NeoBundle rules NeoBundle (needed!)
NeoBundle 'Shougo/neobundle.vim'
" }}}
" BUNDLES (plugins administrated by NeoBundle) {{{
" Shougo's way {{{
" Vimproc to asynchronously run commands (NeoBundle, Unite)
NeoBundle 'Shougo/vimproc', {
\ 'build' : {
\ 'windows' : 'make -f make_mingw32.mak',
\ 'cygwin' : 'make -f make_cygwin.mak',
\ 'mac' : 'make -f make_mac.mak',
\ 'unix' : 'make -f make_unix.mak',
\ },
\ }
" Unite. The interface to rule almost everything
NeoBundle 'Shougo/unite.vim'
" Unite sources
NeoBundleLazy 'Shougo/unite-outline', {'autoload':{'unite_sources':'outline'}}
NeoBundleLazy 'tsukkee/unite-help', {'autoload':{'unite_sources':'help'}}
NeoBundleLazy 'ujihisa/unite-colorscheme', {'autoload':{'unite_sources':
\ 'colorscheme'}}
NeoBundleLazy 'ujihisa/unite-locate', {'autoload':{'unite_sources':'locate'}}
NeoBundleLazy 'thinca/vim-unite-history', { 'autoload' : { 'unite_sources' :
\ ['history/command', 'history/search']}}
NeoBundleLazy 'osyo-manga/unite-filetype', { 'autoload' : {'unite_sources' :
\ 'filetype', }}
NeoBundleLazy 'osyo-manga/unite-quickfix', {'autoload':{'unite_sources':
\ ['quickfix', 'location_list']}}
NeoBundleLazy 'osyo-manga/unite-fold', {'autoload':{'unite_sources':'fold'}}
NeoBundleLazy 'tacroe/unite-mark', {'autoload':{'unite_sources':'mark'}}
NeoBundleLazy 'tsukkee/unite-tag', {'autoload':{'unite_sources':'tag'}}
NeoBundleLazy 'Shougo/neomru.vim', {'autoload':{'unite_sources':
\['file_mru', 'directory_mru']}}
" }}}
" Colorschemes {{{
" Dark themes
" Improved terminal version of molokai, almost identical to the GUI one
NeoBundle 'joedicastro/vim-molokai256'
NeoBundle 'tomasr/molokai'
NeoBundleLazy 'sjl/badwolf', { 'autoload' :
\ { 'unite_sources' : 'colorscheme', }}
NeoBundleLazy 'nielsmadan/harlequin', { 'autoload' :
\ { 'unite_sources' : 'colorscheme', }}
" Light themes
NeoBundleLazy 'vim-scripts/summerfruit256.vim', { 'autoload' :
\ { 'unite_sources' : 'colorscheme', }}
NeoBundleLazy 'joedicastro/vim-github256', { 'autoload' :
\ { 'unite_sources' : 'colorscheme', }}
" Make terminal themes from GUI themes
NeoBundleLazy 'godlygeek/csapprox', { 'autoload' :
\ { 'commands' : ['CSApprox', 'CSApproxSnapshot']}}
" }}}
" GUI {{{
" A better looking status line
NeoBundle 'vim-airline/vim-airline'
NeoBundle 'vim-airline/vim-airline-themes'
" }}}
call neobundle#end()
" END BUNDLES }}}
" <Leader> & <LocalLeader> mapping {{{
let mapleader=','
let maplocalleader= ' '
" }}}
" menus {{{
let g:unite_source_menu_menus = {}
" menu prefix key (for all Unite menus) {{{
nnoremap [menu] <Nop>
nmap <LocalLeader> [menu]
" }}}
" menus menu
nnoremap <silent>[menu]u :Unite -silent -winheight=20 menu<CR>
" }}}
" Local vimrc configuration {{{
let s:local_vimrc = expand('~/.local.vimrc')
if filereadable(s:local_vimrc)
exec ':so ' . s:local_vimrc
endif
" }}}
" END NEOBUNDLE }}}
" IMPORT PACKAGES {{{
exec ':so ' $OH_MY_VIM."/autoload/helperfuncs.vim"
for package in g:oh_my_vim_packages
let package_path = $OH_MY_VIM . "/packages/" . package . ".vimrc"
if filereadable(package_path)
exec ':so ' package_path
endif
endfor
" Indent and plugins by filetype. Need to turn it on after importing packages.
filetype plugin indent on
" END IMPORT PACKAGES }}}
" Auto install the plugins {{{
" First-time plugins installation
if iCanHazNeoBundle == 0
echo "Installing Bundles, please ignore key map error messages"
echo ""
set nomore
NeoBundleInstall
endif
set more
" Check if all of the plugins are already installed, in other case ask if we
" want to install them (useful to add plugins in the .vimrc)
NeoBundleCheck
" }}}
" PLUGINS Setup {{{
" Airline {{{
set noshowmode
let g:airline_theme='powerlineish'
let g:airline_powerline_fonts=1
let g:airline#extensions#branch#enabled=1
let g:airline#extensions#whitespace#enabled = 1
let g:airline#extensions#hunks#non_zero_only = 1
" let g:airline#extensions#tabline#enabled = 2
" let g:airline#extensions#tabline#fnamemod = ':t'
" let g:airline#extensions#tabline#buffer_min_count = 1
" }}}
" Font {{{
set guifont=Droid\ Sans\ Mono\ for\ Powerline\ 11
" " }}}}
" Neomru {{{
let g:neomru#file_mru_path = $OH_MY_VIM.'/tmp/neomru/file'
let g:neomru#directory_mru_path = $OH_MY_VIM.'/tmp/neomru/directory'
" }}}
" Unite {{{
" files
nnoremap <silent><Leader>o :Unite -silent -start-insert file<CR>
nnoremap <silent><Leader>O :Unite -silent -start-insert file_rec/async<CR>
nnoremap <silent><Leader>m :Unite -silent file_mru<CR>
" buffers
nnoremap <silent><Leader>b :Unite -silent buffer<CR>
" tabs
nnoremap <silent><Leader>B :Unite -silent tab<CR>
" buffer search
nnoremap <silent><Leader>f :Unite -silent -no-split -start-insert -auto-preview
\ line<CR>
nnoremap <silent>[menu]8 :UniteWithCursorWord -silent -no-split -auto-preview
\ line<CR>
" yankring
nnoremap <silent><Leader>i :Unite -silent history/yank<CR>
" help
nnoremap <silent> g<C-h> :UniteWithCursorWord -silent help<CR>
" tasks
nnoremap <silent><Leader>; :Unite -silent -toggle
\ grep:%::FIXME\|TODO\|NOTE\|XXX\|COMBAK\|@todo<CR>
" outlines (also ctags)
nnoremap <silent><Leader>t :Unite -silent -vertical -winwidth=40
\ -direction=topleft -toggle outline<CR>
" }}}
call unite#filters#matcher_default#use(['matcher_fuzzy'])
call unite#filters#sorter_default#use(['sorter_rank'])
call unite#custom#source('file_mru,file_rec,file_rec/async,grep,locate',
\ 'ignore_pattern', join(['\.git/', 'tmp/', 'bundle/'], '\|'))
let g:unite_source_history_yank_enable = 1
let g:unite_enable_start_insert = 0
let g:unite_enable_short_source_mes = 0
let g:unite_force_overwrite_statusline = 0
let g:unite_prompt = '>>> '
let g:unite_marked_icon = '✓'
" let g:unite_candidate_icon = '∘'
let g:unite_winheight = 15
let g:unite_update_time = 200
let g:unite_split_rule = 'botright'
let g:unite_data_directory = $OH_MY_VIM.'/tmp/unite'
let g:unite_source_buffer_time_format = '(%d-%m-%Y %H:%M:%S) '
let g:unite_source_file_mru_time_format = '(%d-%m-%Y %H:%M:%S) '
let g:unite_source_directory_mru_time_format = '(%d-%m-%Y %H:%M:%S) '
" }}}
" END PLUGINS SETUP }}}
" Additional Configuration {{{
let s:after_vimrc = expand('~/.after.vimrc')
if filereadable(s:after_vimrc)
exec ':so ' . s:after_vimrc
endif
" }}}