-
Notifications
You must be signed in to change notification settings - Fork 1
/
_vimrc
428 lines (346 loc) · 10.9 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
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
" ~/.vimrc
" vim:set ft=vim et sw=2 foldmethod=marker:
silent! execute pathogen#infect()
" Section: Options {{{1
" --------------------
"Show menu with possible tab completions
set wildmenu
"set wildmode=list:longest,full " command <Tab> completion, list matches, then longest common part, then all.
set wildmode=list:longest " command <Tab> completion, list matches, then longest common part, then all.
set incsearch
set ignorecase
set smartcase
set list
set listchars=tab:>·,trail:·,extends:#,nbsp:· " Highlight problematic whitespace
set ruler
set tabstop=4
set shiftwidth=4
set expandtab " Majority of files I edit use spaces...
set bg=dark
set hls
set modeline
"r insert * in comments
"o insert * automaticaly continue comment on a new line
"c cut text in comments according to textwidth
set fo+=cro
set laststatus=1 "show the status bar on bottom of the screen
set diffopt=filler,vertical
set bs=2 "alow the suppression of everything in insert mode
"Toggle minibufferExplorer
"map <F3> :TMiniBufExplorer<cr>
set pastetoggle=<F3>
set nu
set ls=2 " Always shows the statusbar
set ttymouse=xterm2 " Allow the mouse to work on tmux
set mouse=nv
" set '=' as a file delimiter
set isfname-==
" Expend the main content: eg: headers in vimwiki or taskpaper
set foldlevel=5
set cryptmethod=blowfish
set printoptions=paper:A4
" SubSection: Plugin {{{2
" -----------------------
let g:load_doxygen_syntax=1
let g:pyflakes_use_quickfix = 0
source $VIMRUNTIME/macros/matchit.vim
" Plugin: vim-pathogen {{{3
" --------------------------------
" copie of the pathogen plugin
" plugin isolation
" /vim-pathogen }}}3
" Plugin: vim-fugitive {{{3
" --------------------------------
" Out of the box from github bundle/vim-fugitive
" Git support in git
" /vim-fugitive/ }}}3
" Plugin: vim-solarized {{{3
" --------------------------------
" Out of the box from github bundle/vim-colors-solarized
" solarized colorscheme for git
" /vim-solarized/ }}}3
" Plugin: vim-project {{{3
" --------------------------------
" Copy of http://www.vim.org/scripts/script.php?script_id=69 v1.4.1
" Manage vim project in a .vimproject file
let g:proj_window_width = 35
" /vim-project/ }}}3
" Plugin: taskpaper {{{3
" --------------------------------
" clone of git://github.com/davidoc/taskpaper.vim.git
" Manage todo_list the taskpaper way + taskpaper filetype management
" /taskpaper/ }}}3
" Plugin: vim-startify {{{3
" --------------------------------
" clone git://github.com/mhinz/vim-startify
" Allow to have a startup screen within vim
" /vim-startify/ }}}3
" Plugin: vim-easymotion {{{3
" --------------------------------
" clone git://github.com/Lokaltog/vim-easymotion
" allow to move faster within vim buffer
let g:EasyMotion_keys = 'asdghklqwertyuiopzxcvbnmfj,'
" /vim-easymotion/ }}}3
" Plugin: buffer-explorer {{{3
" --------------------------------
" clone git://github.com/widox/vim-buffer-explorer-plugin
" Visualize opened buffer
" /buffer-explorer/ }}}3
" Plugin: javacomplete {{{3
" --------------------------------
" clone git://github.com/vim-scripts/javacomplete
" Add code basic java code completion
" /javacomplete/ }}}3
" Plugin: taglist {{{3
" --------------------------------
" clone git://github.com/vim-scripts/taglist.vim
" Create a Tag menu context of the current buffer
" /taglist/ }}}3
" Plugin: wikipedia {{{3
" --------------------------------
" source TBD
" filetype + syntax for the mediawiki filetype
" /wikipedia/ }}}3
" Plugin: jedi-vim {{{3
" --------------------------------
" clone of https://github.com/davidhalter/jedi-vim
" python code completion for vim
" to initialize the module, jump in and
" git submodule update --init
"
" That command will clone the jedi library as a submodule
" /jedi-vim/ }}}3
" Plugin: nerdtree {{{3
" --------------------------------
" clone of https://github.com/scrooloose/nerdtree
" alternative file explorer for vim
" /nerdtree/ }}}3
" Plugin: tagbar {{{3
" --------------------------------
" clone of https://github.com/majutsushi/tagbar
" Same as taglist but different
" /tagbar/ }}}3
" Plugin: logcat {{{3
" --------------------------------
" add Color syntax to logcat log + MVP session.log files
" add folding support for MVP session.log files
" /logcat/ }}}3
" Plugin: vimux {{{3
" --------------------------------
" integrate vim with tmux
" clone of the github repo https://github.com/benmills/vimux
" /vimux/ }}}3
" Plugin: Syntastic {{{3
" --------------------------------
" Syntax error checking
" clone of the github repo https://github.com/scrooloose/syntastic.git
let g:syntastic_python_flake8_args='--ignore=E501'
let g:syntastic_python_checkers=['flake8']
" /Syntastic/ }}}3
" Plugin: vimwiki {{{3
" --------------------------------
" personal vim wiki organiser
" clone of the github repo https://github.com/vimwiki
"
" See also the google group page: code.google.com/p/vimwiki/
" This vimwiki plugin as a strong integration with calendar-vim plugin.
" Thus I installed them together
let vmw_wiki = {}
let vmw_wiki.path = '~/wiki/'
let vmw_wiki.path_html = '~/wres/html/'
let vmw_wiki.diary_rel_path = 'perso/diary/'
let vmw_wiki.auto_export = 0 " auto generate html when wiki page is saved
" let vmw_wiki.css_name = 'styles/style.css'
let g:vimwiki_list = [vmw_wiki]
" allow folding in vimwiki files:
let g:vimwiki_folding = 'expr'
let g:vimwiki_hl_headers = 1
" highlight checked checkbox with comment color
let g:vimwiki_hl_cb_checked = 1
function! VimwikiLinkHandler(link) "{{{ Use Vim to open links with the
" 'vlocal:' or 'vfile:' schemes. E.g.:
" 1) [[vfile:///~/Code/PythonProject/abc123.py]], and
" 2) [[vlocal:./|Wiki Home]]
let link = a:link
if link =~ "vlocal:" || link =~ "vfile:"
let link = link[1:]
else
return 0
endif
let [idx, scheme, path, subdir, lnk, ext, url] =
\ vimwiki#base#resolve_scheme(link, 0)
if g:vimwiki_debug
echom 'LinkHandler: idx='.idx.', scheme=[v]'.scheme.', path='.path.
\ ', subdir='.subdir.', lnk='.lnk.', ext='.ext.', url='.url
endif
if url == ''
echom 'Vimwiki Error: Unable to resolve link!'
return 0
else
call vimwiki#base#edit_file('tabnew', url, [], 0)
return 1
endif
endfunction " }}}
" /vimwiki/ }}}3
" Plugin: calendar {{{3
" --------------------------------
" Calendar plugin for vim: display a calendar with \cal
" clone of the github repo https://github.com/mattn/calendar-vim
"
" Use vimwiki calendar integration
let g:vimwiki_use_calendar = 1
function! Diary()
exec "VimwikiMakeDiaryNote"
call append(line('$'), '')
call append(line('$'), "----")
call append(line('$'), "_" . strftime("%Hh%M") . "_:")
endfunction
command! Diary call Diary()
" /calendar/ }}}3
" Plugin: surround {{{3
" --------------------------------
" vim surround plugin
" clone of the github repo https://github.com/tpope/vim-surround
" allow to surround and modify tag efficiently
" /surround/ }}}3
" Plugin: ultisnip {{{3
" --------------------------------
" Snippet plugin utility
" clone of the github repo https://github.com/SirVer/ultisnips.git
" The trigger used to expand a snippet.
" NOTE: expansion and forward jumping can, but needn't be the same trigger
let g:UltiSnipsExpandTrigger = "<tab>"
" The trigger used to display all triggers that could possible
" match in the current position.
" let g:UltiSnipsListSnippets = "<leader><tab>"
" The trigger used to jump forward to the next placeholder.
" NOTE: expansion and forward jumping can, but needn't be the same trigger
let g:UltiSnipsJumpForwardTrigger = "<c-j>"
" The trigger to jump backward inside a snippet
let g:UltiSnipsJumpBackwardTrigger = "<c-k>"
" /ultisnip/ }}}3
" Plugin: supertTab {{{3
" --------------------------------
" Tab completion
" clone of the github repo https://github.com/ervandew/supertab.git
" /supertTab/ }}}3
" Plugin: ctrlp {{{3
" --------------------------------
" Find file on the filesystem with a prompt.
" clone of https://github.com/kien/ctrlp.vim
"
" /ctrlp/ }}}3
" Plugin: clang_complete {{{3
" --------------------------------
" Clone of clang complete https://github.com/Rip-Rip/clang_complete.git
let g:clang_library_path='/usr/lib/llvm-3.2/lib'
let g:clang_snippets = 1
let g:clang_snippets_engine = 'ultisnips'
" /clang_complete/ }}}3
" Plugin: vim-bookmarks {{{3
" --------------------------------
" Clone of the github https://github.com/MattesGroeger/vim-bookmarks
" /vim-bookmarks/ }}}3
" /Plugins/ }}}2
" Plugin: minibufexpl {{{3
" --------------------------------
" clone of https://github.com/fholgado/minibufexpl.vim
" Allow to visualize opened buffers
" /minibufexpl/ }}}3
" Only open MBE manually when needed
let g:miniBufExplorerAutoStart = 0
" /Options/ }}}1
" Section: Commands {{{1
" ---------------------
" /Commands/ }}}1
" Section: Mappings {{{1
" ---------------------
" Toggle mouse on/off
function! ToggleMouse()
if &mouse != ""
exe "set mouse="
echo "Mouse is off"
else
exe "set mouse=a"
echo "Mouse is on"
endif
endfunction
map <F12> :call ToggleMouse()
function! ToggleList()
if &list
exe "set nolist"
echo "do not display list"
else
exe "set list"
echo "display list"
endif
endfunction
map <F11> :call ToggleList()
" let mapleader = "ù"
map <SPACE>
map <BS>
" Cycle over number relativenumber and no number option
function! NumberCycle()
if (&number == 1)
if (&relativenumber == 0)
set relativenumber
else
set nonumber
set norelativenumber
endif
else
set number
endif
endfunction
map <F2> :call NumberCycle()
"map <F11> :!ctags -R .
"map <leader>T :TagbarToggle<CR>
"map <leader>t :TlistToggle<CR>
nmap <C-h> <C-W>h
nmap <C-j> <C-W>j
nmap <C-k> <C-W>k
nmap <C-l> <C-W>l
nmap <leader>/ :let @/=""
" Map <F1> to esc
map <F1> <Esc>
imap <F1> <Esc>
"Allow saving during edition: Must be disable in the bashrc: stty -ixon
imap <C-S> <C-O>:write
nmap <C-S> :write
" /Mappings/ }}}1
" Section: Autocommands {{{1
" --------------------------
if has("autocmd")
filetype on
filetype plugin on
filetype plugin indent on
"setup SyntaxComplete for every filetype that does not already have a
"language specific OMNI script
set omnifunc=syntaxcomplete#Complete
" Python omni completion -- desactivate to leverage of jedi-vim
" autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd BufReadPost fugitive://* set bufhidden=delete
autocmd BufRead,BufNewFile session*.log set filetype=logcat
autocmd BufRead,BufNewFile */configs/* set filetype=configs
autocmd BufRead,BufNewFile *.aidl set filetype=java
autocmd BufRead,BufNewFile *.S set ts=8 filetype=armasm
autocmd BufRead,BufNewFile *.md set filetype=markdown
endif " has("autocmd")
" /Autocommands/ }}}1
" Section: Visual {{{1
" --------------------
syntax on
if &term == "screen-256color"
set t_Co=256
endif
if &term == "tmux-terminfo"
" tmux will send xterm-style keys when its xterm-keys option is on
map [1;5A <C-Up>
map [1;5B <C-Down>
map [1;5C <C-Right>
map [1;5D <C-Left>
endif
colorscheme solarized
set guifont=Terminus\ 8
set guioptions=""
" /Visual/ }}}1