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
|
set showcmd
set backspace=indent,eol,start
set clipboard=unnamed
set ruler
set t_Co=256
"map <leader>j <C-W>j
"map <leader>k <C-W>k
"map <leader>h <C-W>h
"map <leader>l <C-W>l
inoremap <C-N> <C-P>
inoremap <C-P> <C-N>
filetype plugin indent on
" Color :
autocmd ColorScheme * highlight ExtraWhitespace ctermbg=darkred guibg=darkred
colo jellybeans
set cursorline
hi CursorLine term=bold cterm=bold ctermbg=black
match ExtraWhitespace /\s\+$/
" Completion related options
" wildcard char = <TAB>
set wildmenu
set wildmode=list:longest:full
nnoremap <silent><A-o> :set paste<CR>m`o<Esc>``:set nopaste<CR>
nnoremap <silent><A-O> :set paste<CR>m`O<Esc>``:set nopaste<CR>
inoremap <c-e> <Esc>A
inoremap <c-a> <Esc>0i
"Perso C définition"
inoremap prt printf
inoremap swf printf
inoremap #in< #include <><left>
inoremap #in" #include ""<left>
inoremap #def #define
inoremap #un #undef
inoremap #ifn #ifndef
inoremap #ifd #ifdef
inoremap #std #include <stdlib.h>
inoremap #io #include <stdio.h>
inoremap #main int main(void) {<CR>}<Esc><Up>A
inoremap ##main int main(int argc, char* argv[]) {<CR>}<Esc><Up>A
" Personal shortcurts
ca tn tabnew
ca tc tabc
map <F5> :setlocal spell! spelllang=fr<CR>
map <F6> :setlocal spell! spelllang=en_us<CR>
inoremap <F7> <C-r>=strftime('%F')<CR>
inoremap <F8> <C-r>=strftime('%c')<CR>
" Personal compil shortcurts
map <F9> :make<CR>:cw<CR><CR>
noremap <silent> [q :copen<CR>
noremap <silent> ]q :cclose<CR>
noremap <silent> [Q :cfirst<CR>
noremap <silent> ]Q :clast<CR>
noremap <silent> [[ :cprev<CR>
noremap <silent> ]] :cnext<CR>
"Allow vim clipboad <-> host clipboard to share data
set clipboard=unnamed
" Quick Comment :
autocmd FileType c,cpp,java,go,scala,js let b:comment_leader = '//'
autocmd FileType sh,ruby,python let b:comment_leader = '#'
autocmd FileType conf,fstab let b:comment_leader = '#'
autocmd FileType tex let b:comment_leader = '%'
autocmd FileType mail let b:comment_leader = '>'
autocmd FileType vim let b:comment_leader = '"'
autocmd FileType haskell let b:comment_leader = '--'
autocmd FileType c,cpp,java,go,scala set foldmethod=syntax
noremap <silent> ,cc :<C-B>silent <C-E>s/^/<C-R>=escape(b:comment_leader,'\/')<CR>/<CR>:nohlsearch<CR>
noremap <silent> ,cu :<C-B>silent <C-E>s/^\V<C-R>=escape(b:comment_leader,'\/')<CR>//e<CR>:nohlsearch<CR>
noremap <silent> <c-c><c-c> :<C-B>silent <C-E>s/^/<C-R>=escape(b:comment_leader,'\/')<CR>/<CR>:nohlsearch<CR>
noremap <silent> <c-c>c :<C-B>silent <C-E>s/^\V<C-R>=escape(b:comment_leader,'\/')<CR>//e<CR>:nohlsearch<CR>
nnoremap cd :cd %:p:h<CR>
nnoremap <silent> // :nohls<CR>
" Compil option
autocmd Filetype c call SetCCompiler()
function SetCCompiler()
if !(filereadable("makefile") || filereadable("Makefile"))
set makeprg=gcc\ %
endif
endfunction
autocmd Filetype python call SetPythonCompiler()
function SetPythonCompiler()
if executable("flake8")
set makeprg=flake8\ --ignore=E111,E303,E201,E231,E391,E225,E203,E226,W391\ %
endif
endfunction
noremap <silent> zv :!markdown % \| w3m -I utf-8 -T text/html
set colorcolumn=80
set cursorcolumn
highlight CursorColumn ctermbg=Red
set hls
set incsearch
let $VIMHOME=expand('<sfile>:p:h:h')
au BufNewFile *.c 0r $VIMHOME/template/skel.c
let g:deoplete#enable_at_startup = 1
" Plugin key-mappings.
" Note: It must be "imap" and "smap". It uses <Plug> mappings.
imap <C-k> <Plug>(neosnippet_expand_or_jump)
smap <C-k> <Plug>(neosnippet_expand_or_jump)
xmap <C-k> <Plug>(neosnippet_expand_target)
" SuperTab like snippets behavior.
" Note: It must be "imap" and "smap". It uses <Plug> mappings.
"imap <expr><TAB>
" \ pumvisible() ? "\<C-n>" :
" \ neosnippet#expandable_or_jumpable() ?
" \ "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
smap <expr><TAB> neosnippet#expandable_or_jumpable() ?
\ "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
" For conceal markers.
if has('conceal')
set conceallevel=2 concealcursor=niv
endif
map <C-l> :exec &conceallevel ? "set conceallevel=0" : "set conceallevel=2"<CR>
" Start interactive EasyAlign in visual mode (e.g. vipga)
xmap ga <Plug>(EasyAlign)
" Start interactive EasyAlign for a motion/text object (e.g. gaip)
nmap ga <Plug>(EasyAlign)
" Ale message config :
let g:ale_echo_msg_error_str = 'E'
let g:ale_echo_msg_warning_str = 'W'
let g:ale_echo_msg_format = '[%linter%] %s [%severity%]'
" Ale only on save
let g:ale_lint_on_text_changed = 'never'
let g:ale_lint_on_enter = 0
|