... | ... |
@@ -139,12 +139,19 @@ function! LightlineSpellLanguage() |
139 | 139 |
endif |
140 | 140 |
endfunction |
141 | 141 |
|
142 |
+function! LightlineMark() |
|
143 |
+ if( line("'a") == 0) |
|
144 |
+ return "" |
|
145 |
+ endif |
|
146 |
+ return "Mark:" . line("'a") |
|
147 |
+endfunction |
|
148 |
+ |
|
142 | 149 |
let g:lightline = { |
143 | 150 |
\ 'colorscheme': 'wombat', |
144 | 151 |
\ 'active': { |
145 | 152 |
\ 'left': [ [ 'mode', 'paste' ], |
146 | 153 |
\ [ 'gitbranch', 'readonly', 'relativepath', 'modified' ], |
147 |
- \ [ 'vimsession' ] ], |
|
154 |
+ \ [ 'vimsession', 'markline' ] ], |
|
148 | 155 |
\ 'right': [ [ 'lineinfo' ], |
149 | 156 |
\ [ 'percent' ], |
150 | 157 |
\ [ 'spelllang', 'fileformat', 'fileencoding', 'filetype' ] ] |
... | ... |
@@ -152,7 +159,8 @@ let g:lightline = { |
152 | 159 |
\ 'component_function': { |
153 | 160 |
\ 'gitbranch': 'FugitiveHead', |
154 | 161 |
\ 'vimsession': 'LightlineSession', |
155 |
- \ 'spelllang' : 'LightlineSpellLanguage' |
|
162 |
+ \ 'spelllang' : 'LightlineSpellLanguage', |
|
163 |
+ \ 'markline' : 'LightlineMark' |
|
156 | 164 |
\ }, |
157 | 165 |
\ } |
158 | 166 |
|
... | ... |
@@ -126,16 +126,16 @@ set noshowmode |
126 | 126 |
|
127 | 127 |
function! LightlineSession() |
128 | 128 |
if v:this_session != "" |
129 |
- return '[Session: ' . fnamemodify(v:this_session, ':t') . ']' |
|
129 |
+ return '[' . fnamemodify(v:this_session, ':t') . ']' |
|
130 | 130 |
endif |
131 |
- return '[Session: -]' |
|
131 |
+ return "" |
|
132 | 132 |
endfunction |
133 | 133 |
|
134 | 134 |
function! LightlineSpellLanguage() |
135 | 135 |
if(&spell) |
136 |
- return "Spell: " . &spelllang |
|
136 |
+ return &spelllang |
|
137 | 137 |
else |
138 |
- return "(nospell)" |
|
138 |
+ return "" |
|
139 | 139 |
endif |
140 | 140 |
endfunction |
141 | 141 |
|
... | ... |
@@ -117,7 +117,7 @@ set ttyfast |
117 | 117 |
|
118 | 118 |
set background=dark |
119 | 119 |
colorscheme palenight |
120 |
-"let g:palenight_terminal_italics=1 |
|
120 |
+let g:palenight_terminal_italics=1 |
|
121 | 121 |
|
122 | 122 |
" Surligne la ligne en cours |
123 | 123 |
set cursorline |
... | ... |
@@ -203,7 +203,7 @@ nmap <C-f> ?{<CR>zf%za:noh<CR> |
203 | 203 |
nmap <leader><Down> /{<CR>zf%za:noh<CR> |
204 | 204 |
nnoremap <leader><Up> ?{<CR>zf%za:noh<CR> |
205 | 205 |
" Toggle le fold en cours |
206 |
-nmap <F9> za |
|
206 |
+nmap <F8> za |
|
207 | 207 |
" Ouvre tous les folds |
208 | 208 |
nnoremap <leader><PageDown> zR |
209 | 209 |
" Ferme tous les folds |
... | ... |
@@ -341,8 +341,7 @@ let g:syntastic_check_on_open = 1 |
341 | 341 |
let g:syntastic_check_on_wq = 0 |
342 | 342 |
|
343 | 343 |
" Infos de syntaxe |
344 |
-nmap <F7> :SyntasticInfo<CR> |
|
345 |
-nmap <F8> :Errors<CR> |
|
344 |
+nmap <F7> :Errors<CR> |
|
346 | 345 |
|
347 | 346 |
|
348 | 347 |
|
... | ... |
@@ -425,6 +424,11 @@ autocmd VimEnter *.sh noremap <leader><leader> 0i#<ESC> |
425 | 424 |
" Clear search highlighting |
426 | 425 |
nnoremap <Esc><Esc> :noh<CR> |
427 | 426 |
|
427 |
+" Marqeur |
|
428 |
+nmap <F9> ma |
|
429 |
+imap <F9> <C-O>ma |
|
430 |
+nmap <F10> 'a |
|
431 |
+nmap <F10> <C-O>'a |
|
428 | 432 |
|
429 | 433 |
|
430 | 434 |
|
... | ... |
@@ -30,7 +30,7 @@ Plug 'drewtempelmeyer/palenight.vim' |
30 | 30 |
Plug 'itchyny/lightline.vim' |
31 | 31 |
|
32 | 32 |
" Add syntax highlighting for a large range of filetypes |
33 |
-Plug 'sheerun/vim-polyglot' |
|
33 |
+"Plug 'sheerun/vim-polyglot' |
|
34 | 34 |
|
35 | 35 |
call plug#end() |
36 | 36 |
|
... | ... |
@@ -227,7 +227,14 @@ function! Smart_TabComplete() |
227 | 227 |
" Caractere juste avant le curseur |
228 | 228 |
let charBefore = strpart(line, col('.') -2, 1) |
229 | 229 |
|
230 |
- " CORRECTION : MODE ORTHOGRAPHE |
|
230 |
+ |
|
231 |
+ " PAS DE COMPLETION SI RIEN AVANT |
|
232 |
+ if(charBefore == " ") |
|
233 |
+ return "\<tab>" |
|
234 |
+ endif |
|
235 |
+ |
|
236 |
+ |
|
237 |
+ " COMPLETION ET CORRECTION : MODE ORTHOGRAPHE |
|
231 | 238 |
if(&spell) |
232 | 239 |
if( match(charBefore, "[a-zA-Z]") < 0 ) |
233 | 240 |
return "\<tab>" |
... | ... |
@@ -238,48 +245,42 @@ function! Smart_TabComplete() |
238 | 245 |
if charCursor == " " | return "\<C-N>" | endif |
239 | 246 |
return "\<c-o>z=" |
240 | 247 |
endif |
248 |
+ endif |
|
241 | 249 |
|
242 | 250 |
|
243 |
- " CORRECTION : MODE CODE |
|
244 |
- else |
|
245 |
- |
|
251 |
+ " COMPLETION : MODE CODE : HTML FERMETURE DE BALISE |
|
246 | 252 |
|
253 |
+ if(charBefore == ">") |
|
254 |
+ let substr = strpart(line, -1, col('.')) |
|
255 |
+ let substr = matchstr(substr, "<[^<]*$") |
|
256 |
+ if(substr == "") | return "\<tab>" | endif |
|
257 |
+ let substrPos = match(substr, "[ >]") |
|
258 |
+ let substr = strpart(substr, 1, substrPos - 1) |
|
259 |
+ if(strpart(line, col('.') - 1, 1) == "") | let substrPos = substrPos - 1 | endif |
|
260 |
+ return "</" . substr . ">\<c-o>" . (substrPos + 2) . "h" |
|
261 |
+ endif |
|
247 | 262 |
|
248 |
- " MODE CODE : HTML FERMETURE DE BALISE |
|
249 | 263 |
|
250 |
- if(charBefore == ">") |
|
251 |
- " from the start of the current line to the cursor |
|
252 |
- let substr = strpart(line, -1, col('.')) |
|
253 |
-echo "-" . substr . "-" |
|
254 |
- let substr = matchstr(substr, "<[^<]*$") |
|
255 |
- if(substr == "") | return "\<tab>" | endif |
|
256 |
- let substrPos = match(substr, "[ >]") |
|
257 |
- let substr = strpart(substr, 1, substrPos - 1) |
|
258 |
- if(strpart(line, col('.') - 1, 1) == "") | let substrPos = substrPos - 1 | endif |
|
259 |
- return "</" . substr . ">\<c-o>" . (substrPos + 2) . "h" |
|
264 |
+ " COMPLETION : MODE CODE : COMPLETION |
|
260 | 265 |
|
261 |
- " MODE CODE : COMPLETION |
|
262 |
- else |
|
266 |
+ " from the start of the current line to one character right of the cursor |
|
267 |
+ let substr = strpart(line, -1, col('.')) |
|
268 |
+ " word till cursor: |
|
269 |
+ let substr = matchstr(substr, "[^ \t]*$") |
|
270 |
+ " nothing to match on empty string |
|
271 |
+ if (strlen(substr) == 0) |
|
272 |
+ return "\<tab>" |
|
273 |
+ endif |
|
263 | 274 |
|
264 |
- " from the start of the current line to one character right of the cursor |
|
265 |
- let substr = strpart(line, -1, col('.')+1) |
|
266 |
- " word till cursor: |
|
267 |
- let substr = matchstr(substr, "[^ \t]*$") |
|
268 |
- " nothing to match on empty string |
|
269 |
- if (strlen(substr)==0) |
|
270 |
- return "\<tab>" |
|
271 |
- endif |
|
272 |
- |
|
273 |
- " position of slash, if any |
|
274 |
- let has_slash = match(substr, '\/') != -1 |
|
275 |
- if (has_slash) |
|
276 |
- " file matching |
|
277 |
- return "\<C-X>\<C-F>" |
|
278 |
- else |
|
279 |
- " plugin matching |
|
280 |
- return "\<C-X>\<C-O>" |
|
281 |
- endif |
|
282 |
- endif |
|
275 |
+ " position of slash, if any |
|
276 |
+ let has_slash = match(substr, '\/') != -1 |
|
277 |
+ if (has_slash) |
|
278 |
+ " file matching |
|
279 |
+ return "\<C-X>\<C-F>" |
|
280 |
+ else |
|
281 |
+ " plugin matching |
|
282 |
+"TODO: return "\<C-X>\<C-O>" |
|
283 |
+ return "\<C-N>" |
|
283 | 284 |
endif |
284 | 285 |
|
285 | 286 |
endfunction |
... | ... |
@@ -224,16 +224,18 @@ set completeopt=menuone |
224 | 224 |
function! Smart_TabComplete() |
225 | 225 |
" Current line |
226 | 226 |
let line = getline('.') |
227 |
+ " Caractere juste avant le curseur |
|
228 |
+ let charBefore = strpart(line, col('.') -2, 1) |
|
227 | 229 |
|
228 | 230 |
" CORRECTION : MODE ORTHOGRAPHE |
229 | 231 |
if(&spell) |
230 |
- let substr = strpart(line, col('.') -2, 1) |
|
231 |
- if( match(substr, "[a-zA-Z]") < 0 ) |
|
232 |
+ if( match(charBefore, "[a-zA-Z]") < 0 ) |
|
232 | 233 |
return "\<tab>" |
233 | 234 |
else |
234 |
- let substr = strpart(line, col('.') - 1, 1) |
|
235 |
- if substr == "" | return "\<C-N>" | endif |
|
236 |
- if substr == " " | return "\<C-N>" | endif |
|
235 |
+ " Caractere sous le curseur |
|
236 |
+ let charCursor = strpart(line, col('.') - 1, 1) |
|
237 |
+ if charCursor == "" | return "\<C-N>" | endif |
|
238 |
+ if charCursor == " " | return "\<C-N>" | endif |
|
237 | 239 |
return "\<c-o>z=" |
238 | 240 |
endif |
239 | 241 |
|
... | ... |
@@ -241,25 +243,43 @@ function! Smart_TabComplete() |
241 | 243 |
" CORRECTION : MODE CODE |
242 | 244 |
else |
243 | 245 |
|
244 |
- " from the start of the current line to one character right of the cursor |
|
245 |
- let substr = strpart(line, -1, col('.')+1) |
|
246 |
- " word till cursor: |
|
247 |
- let substr = matchstr(substr, "[^ \t]*$") |
|
248 |
- " nothing to match on empty string |
|
249 |
- if (strlen(substr)==0) |
|
250 |
- return "\<tab>" |
|
251 |
- endif |
|
252 | 246 |
|
253 |
- " position of slash, if any |
|
254 |
- let has_slash = match(substr, '\/') != -1 |
|
255 |
- if (has_slash) |
|
256 |
- " file matching |
|
257 |
- return "\<C-X>\<C-F>" |
|
247 |
+ |
|
248 |
+ " MODE CODE : HTML FERMETURE DE BALISE |
|
249 |
+ |
|
250 |
+ if(charBefore == ">") |
|
251 |
+ " from the start of the current line to the cursor |
|
252 |
+ let substr = strpart(line, -1, col('.')) |
|
253 |
+echo "-" . substr . "-" |
|
254 |
+ let substr = matchstr(substr, "<[^<]*$") |
|
255 |
+ if(substr == "") | return "\<tab>" | endif |
|
256 |
+ let substrPos = match(substr, "[ >]") |
|
257 |
+ let substr = strpart(substr, 1, substrPos - 1) |
|
258 |
+ if(strpart(line, col('.') - 1, 1) == "") | let substrPos = substrPos - 1 | endif |
|
259 |
+ return "</" . substr . ">\<c-o>" . (substrPos + 2) . "h" |
|
260 |
+ |
|
261 |
+ " MODE CODE : COMPLETION |
|
258 | 262 |
else |
259 |
- " plugin matching |
|
260 |
- return "\<C-X>\<C-O>" |
|
261 |
- endif |
|
262 | 263 |
|
264 |
+ " from the start of the current line to one character right of the cursor |
|
265 |
+ let substr = strpart(line, -1, col('.')+1) |
|
266 |
+ " word till cursor: |
|
267 |
+ let substr = matchstr(substr, "[^ \t]*$") |
|
268 |
+ " nothing to match on empty string |
|
269 |
+ if (strlen(substr)==0) |
|
270 |
+ return "\<tab>" |
|
271 |
+ endif |
|
272 |
+ |
|
273 |
+ " position of slash, if any |
|
274 |
+ let has_slash = match(substr, '\/') != -1 |
|
275 |
+ if (has_slash) |
|
276 |
+ " file matching |
|
277 |
+ return "\<C-X>\<C-F>" |
|
278 |
+ else |
|
279 |
+ " plugin matching |
|
280 |
+ return "\<C-X>\<C-O>" |
|
281 |
+ endif |
|
282 |
+ endif |
|
263 | 283 |
endif |
264 | 284 |
|
265 | 285 |
endfunction |
... | ... |
@@ -227,12 +227,15 @@ function! Smart_TabComplete() |
227 | 227 |
|
228 | 228 |
" CORRECTION : MODE ORTHOGRAPHE |
229 | 229 |
if(&spell) |
230 |
- |
|
231 |
- let substr = strpart(line, col('.') - 1, 1) |
|
232 |
- if substr == "" | return "\<C-N>" | endif |
|
233 |
- if substr == " " | return "\<C-N>" | endif |
|
234 |
- return "\<c-o>z=" |
|
235 |
- |
|
230 |
+ let substr = strpart(line, col('.') -2, 1) |
|
231 |
+ if( match(substr, "[a-zA-Z]") < 0 ) |
|
232 |
+ return "\<tab>" |
|
233 |
+ else |
|
234 |
+ let substr = strpart(line, col('.') - 1, 1) |
|
235 |
+ if substr == "" | return "\<C-N>" | endif |
|
236 |
+ if substr == " " | return "\<C-N>" | endif |
|
237 |
+ return "\<c-o>z=" |
|
238 |
+ endif |
|
236 | 239 |
|
237 | 240 |
|
238 | 241 |
" CORRECTION : MODE CODE |
... | ... |
@@ -57,10 +57,6 @@ set nocompatible |
57 | 57 |
" Encodage |
58 | 58 |
set encoding=UTF-8 |
59 | 59 |
|
60 |
-" Ouvre les fichiers sur plusieurs onglets au lieu de plusieurs buffers |
|
61 |
-if !&diff | silent tab all | tabfirst | endif |
|
62 |
- |
|
63 |
- |
|
64 | 60 |
" Affiche la barre d'info en bas |
65 | 61 |
set laststatus=2 |
66 | 62 |
" Largeur maxi : 0 = desactive |
... | ... |
@@ -80,10 +76,6 @@ set showmatch |
80 | 76 |
" Essaye de garder le curseur dans la même colonne quand on change de ligne |
81 | 77 |
set nostartofline |
82 | 78 |
|
83 |
-" Option de la complétion automatique |
|
84 |
-set wildmode=list:full |
|
85 |
-set wildignore+=*.o,*.obj,*.exe,*.so,*.dll,*.pyc,*.swp,*.jpg,*.png,*.gif,*.pdf,*.bak,.svn,.hg,.bzr,.git, |
|
86 |
- |
|
87 | 79 |
"find the next match as we type the search |
88 | 80 |
set incsearch |
89 | 81 |
"highlight searches by default |
... | ... |
@@ -107,7 +99,11 @@ set visualbell t_vb= |
107 | 99 |
" Active la souris |
108 | 100 |
set mouse=a |
109 | 101 |
|
102 |
+" Touche <leader> |
|
103 |
+let mapleader = " " |
|
110 | 104 |
|
105 |
+" Passer d'une ligne a l'autre avec les fleches |
|
106 |
+set whichwrap=<,>,[,] |
|
111 | 107 |
|
112 | 108 |
" Performances |
113 | 109 |
set hidden |
... | ... |
@@ -117,7 +113,7 @@ set ttyfast |
117 | 113 |
|
118 | 114 |
|
119 | 115 |
|
120 |
-" ------- THEME ------- |
|
116 |
+" ------- THEME & PLUGIN: Lightline ------- |
|
121 | 117 |
|
122 | 118 |
set background=dark |
123 | 119 |
colorscheme palenight |
... | ... |
@@ -128,17 +124,47 @@ set cursorline |
128 | 124 |
" N'affiche pas le mode en cours en bas, vu qu'il est sur la lightline |
129 | 125 |
set noshowmode |
130 | 126 |
|
127 |
+function! LightlineSession() |
|
128 |
+ if v:this_session != "" |
|
129 |
+ return '[Session: ' . fnamemodify(v:this_session, ':t') . ']' |
|
130 |
+ endif |
|
131 |
+ return '[Session: -]' |
|
132 |
+endfunction |
|
133 |
+ |
|
134 |
+function! LightlineSpellLanguage() |
|
135 |
+ if(&spell) |
|
136 |
+ return "Spell: " . &spelllang |
|
137 |
+ else |
|
138 |
+ return "(nospell)" |
|
139 |
+ endif |
|
140 |
+endfunction |
|
141 |
+ |
|
131 | 142 |
let g:lightline = { |
132 | 143 |
\ 'colorscheme': 'wombat', |
133 | 144 |
\ 'active': { |
134 | 145 |
\ 'left': [ [ 'mode', 'paste' ], |
135 |
- \ [ 'gitbranch', 'readonly', 'filename', 'modified' ] ] |
|
146 |
+ \ [ 'gitbranch', 'readonly', 'relativepath', 'modified' ], |
|
147 |
+ \ [ 'vimsession' ] ], |
|
148 |
+ \ 'right': [ [ 'lineinfo' ], |
|
149 |
+ \ [ 'percent' ], |
|
150 |
+ \ [ 'spelllang', 'fileformat', 'fileencoding', 'filetype' ] ] |
|
136 | 151 |
\ }, |
137 | 152 |
\ 'component_function': { |
138 |
- \ 'gitbranch': 'FugitiveHead' |
|
153 |
+ \ 'gitbranch': 'FugitiveHead', |
|
154 |
+ \ 'vimsession': 'LightlineSession', |
|
155 |
+ \ 'spelllang' : 'LightlineSpellLanguage' |
|
139 | 156 |
\ }, |
140 | 157 |
\ } |
141 | 158 |
|
159 |
+let g:lightline.tabline = { |
|
160 |
+ \ 'left': [ ['tabs'] ], |
|
161 |
+ \ 'right': [ ['close'] ] |
|
162 |
+ \ } |
|
163 |
+ |
|
164 |
+autocmd WinEnter,BufWinEnter,FileType,ColorScheme,SessionLoadPost,BufEnter,TabEnter,InsertEnter * call lightline#update() |
|
165 |
+ |
|
166 |
+set showtabline=2 |
|
167 |
+ |
|
142 | 168 |
|
143 | 169 |
|
144 | 170 |
|
... | ... |
@@ -164,8 +190,33 @@ vnoremap > >gv |
164 | 190 |
|
165 | 191 |
|
166 | 192 |
|
193 |
+" ------- FOLDS SETTINGS ------- |
|
194 |
+ |
|
195 |
+set foldcolumn=3 |
|
196 |
+set foldmethod=manual |
|
197 |
+set foldlevelstart=99 |
|
198 |
+autocmd BufWinLeave *.php,*.htm,*.html,*.css,*.c,*.cc,*.h,*.cpp,*.py,*.rb,*.js mkview |
|
199 |
+autocmd BufWinEnter *.php,*.htm,*.html,*.css,*.c,*.cc,*.h,*.cpp,*.py,*.rb,*.js silent loadview |
|
200 |
+ |
|
201 |
+" Cree un fold du prochain/precedent {, jusqu'au } de fermeture |
|
202 |
+nmap <C-f> ?{<CR>zf%za:noh<CR> |
|
203 |
+nmap <leader><Down> /{<CR>zf%za:noh<CR> |
|
204 |
+nnoremap <leader><Up> ?{<CR>zf%za:noh<CR> |
|
205 |
+" Toggle le fold en cours |
|
206 |
+nmap <F9> za |
|
207 |
+" Ouvre tous les folds |
|
208 |
+nnoremap <leader><PageDown> zR |
|
209 |
+" Ferme tous les folds |
|
210 |
+nnoremap <leader><PageUp> zM |
|
211 |
+ |
|
212 |
+ |
|
213 |
+ |
|
214 |
+ |
|
167 | 215 |
" ------- AUTOCOMPLETION ------- |
168 | 216 |
|
217 |
+set wildmode=list:full |
|
218 |
+set wildignore+=*.o,*.obj,*.exe,*.so,*.dll,*.pyc,*.swp,*.jpg,*.png,*.gif,*.pdf,*.bak,.svn,.hg,.bzr,.git, |
|
219 |
+ |
|
169 | 220 |
set omnifunc=syntaxcomplete#Complete |
170 | 221 |
set completeopt=menuone |
171 | 222 |
|
... | ... |
@@ -174,23 +225,40 @@ function! Smart_TabComplete() |
174 | 225 |
" Current line |
175 | 226 |
let line = getline('.') |
176 | 227 |
|
177 |
- " from the start of the current line to one character right of the cursor |
|
178 |
- let substr = strpart(line, -1, col('.')+1) |
|
179 |
- " word till cursor |
|
180 |
- let substr = matchstr(substr, "[^ \t]*$") |
|
181 |
- " nothing to match on empty string |
|
182 |
- if (strlen(substr)==0) |
|
183 |
- return "\<tab>" |
|
184 |
- endif |
|
185 |
- " position of slash, if any |
|
186 |
- let has_slash = match(substr, '\/') != -1 |
|
187 |
- if (has_slash) |
|
188 |
- " file matching |
|
189 |
- return "\<C-X>\<C-F>" |
|
228 |
+ " CORRECTION : MODE ORTHOGRAPHE |
|
229 |
+ if(&spell) |
|
230 |
+ |
|
231 |
+ let substr = strpart(line, col('.') - 1, 1) |
|
232 |
+ if substr == "" | return "\<C-N>" | endif |
|
233 |
+ if substr == " " | return "\<C-N>" | endif |
|
234 |
+ return "\<c-o>z=" |
|
235 |
+ |
|
236 |
+ |
|
237 |
+ |
|
238 |
+ " CORRECTION : MODE CODE |
|
190 | 239 |
else |
191 |
- " plugin matching |
|
192 |
- return "\<C-X>\<C-O>" |
|
240 |
+ |
|
241 |
+ " from the start of the current line to one character right of the cursor |
|
242 |
+ let substr = strpart(line, -1, col('.')+1) |
|
243 |
+ " word till cursor: |
|
244 |
+ let substr = matchstr(substr, "[^ \t]*$") |
|
245 |
+ " nothing to match on empty string |
|
246 |
+ if (strlen(substr)==0) |
|
247 |
+ return "\<tab>" |
|
248 |
+ endif |
|
249 |
+ |
|
250 |
+ " position of slash, if any |
|
251 |
+ let has_slash = match(substr, '\/') != -1 |
|
252 |
+ if (has_slash) |
|
253 |
+ " file matching |
|
254 |
+ return "\<C-X>\<C-F>" |
|
255 |
+ else |
|
256 |
+ " plugin matching |
|
257 |
+ return "\<C-X>\<C-O>" |
|
258 |
+ endif |
|
259 |
+ |
|
193 | 260 |
endif |
261 |
+ |
|
194 | 262 |
endfunction |
195 | 263 |
|
196 | 264 |
inoremap <tab> <c-r>=Smart_TabComplete()<CR> |
... | ... |
@@ -198,26 +266,36 @@ inoremap <tab> <c-r>=Smart_TabComplete()<CR> |
198 | 266 |
|
199 | 267 |
|
200 | 268 |
|
269 |
+" ------- SPELL ------- |
|
201 | 270 |
|
202 |
-" ------- FOLDS SETTINGS ------- |
|
271 |
+" Use word completion when spelling is enabled |
|
272 |
+set complete+=kspell |
|
203 | 273 |
|
204 |
-set foldcolumn=3 |
|
205 |
-set foldmethod=manual |
|
206 |
-set foldlevelstart=99 |
|
207 |
-autocmd BufWinLeave *.php,*.htm,*.html,*.css,*.c,*.cc,*.h,*.cpp,*.py,*.rb,*.js mkview |
|
208 |
-autocmd BufWinEnter *.php,*.htm,*.html,*.css,*.c,*.cc,*.h,*.cpp,*.py,*.rb,*.js silent loadview |
|
274 |
+"switch spellcheck languages |
|
275 |
+let g:myLangList=["nospell","fr","en_us"] |
|
209 | 276 |
|
210 |
-" Cree un fold du prochain/precedent {, jusqu'au } de fermeture |
|
211 |
-nmap <C-f> ?{<CR>zf%za:noh<CR> |
|
212 |
-nmap <leader><Down> /{<CR>zf%za:noh<CR> |
|
213 |
-nnoremap <leader><Up> ?{<CR>zf%za:noh<CR> |
|
214 |
-" Toggle le fold en cours |
|
215 |
-nmap <F9> za |
|
216 |
-" Ouvre tous les folds |
|
217 |
-nnoremap <leader><PageDown> zR |
|
218 |
-" Ferme tous les folds |
|
219 |
-nnoremap <leader><PageUp> zM |
|
277 |
+function! MySpellLang() |
|
278 |
+ if !exists("b:myLang") |
|
279 |
+ if &spell |
|
280 |
+ let b:myLang=index(g:myLangList, &spelllang) |
|
281 |
+ if b:myLang < 0 | b:myLang = 0 | endif |
|
282 |
+ else |
|
283 |
+ let b:myLang=0 |
|
284 |
+ endif |
|
285 |
+ endif |
|
220 | 286 |
|
287 |
+ "loop through languages |
|
288 |
+ let b:myLang = b:myLang + 1 |
|
289 |
+ if b:myLang >= len(g:myLangList) | let b:myLang = 0 | endif |
|
290 |
+ if b:myLang == 0 |
|
291 |
+ set nospell |
|
292 |
+ else |
|
293 |
+ execute "setlocal spell spelllang=".get(g:myLangList, b:myLang) |
|
294 |
+ endif |
|
295 |
+endf |
|
296 |
+ |
|
297 |
+map <silent> <F11> :call MySpellLang()<CR> |
|
298 |
+imap <silent> <F11> <C-o>:call MySpellLang()<CR> |
|
221 | 299 |
|
222 | 300 |
|
223 | 301 |
|
... | ... |
@@ -271,7 +349,7 @@ let g:startify_relative_path = 0 |
271 | 349 |
let g:startify_change_to_dir = 1 |
272 | 350 |
let g:startify_update_oldfiles = 1 |
273 | 351 |
let g:startify_session_autoload = 1 |
274 |
-let g:startify_custom_header = 'startify#pad([ " VIM - STARTIFY"] + [" [e] Empty file" ])' |
|
352 |
+let g:startify_custom_header = 'startify#pad([" VIM - STARTIFY"] + [""] + ["[e] Empty file"] + ["[q] Quit"] + ["[t] Tag file(s) to be opened in tabs"])' |
|
275 | 353 |
let g:startify_lists = [ |
276 | 354 |
\ { 'type': 'sessions', 'header': [' Sessions'] }, |
277 | 355 |
\ { 'type': 'files', 'header': [' MRU'] }, |
... | ... |
@@ -284,9 +362,18 @@ let g:startify_session_before_save = [ |
284 | 362 |
\ 'silent! NERDTreeTabsClose' |
285 | 363 |
\ ] |
286 | 364 |
|
365 |
+let g:startify_session_dir = $HOME . '/.vim/session' |
|
366 |
+ |
|
367 |
+function! EnsureDirExists (dir) |
|
368 |
+ if !isdirectory(a:dir) |
|
369 |
+ call mkdir(a:dir,'p') |
|
370 |
+ endif |
|
371 |
+endfunction |
|
372 |
+ |
|
287 | 373 |
function! SessionCreate() |
288 | 374 |
if empty(v:this_session) |
289 | 375 |
if tabpagenr("$") > 1 |
376 |
+ call EnsureDirExists(g:startify_session_dir) |
|
290 | 377 |
SSave! |
291 | 378 |
endif |
292 | 379 |
endif |
... | ... |
@@ -295,7 +382,7 @@ endfunction |
295 | 382 |
" Quitte quand plusieurs onglets sont ouverts, et cree une session si elle n'existe pas |
296 | 383 |
noremap <leader>q :call SessionCreate()<CR>:qa<CR> |
297 | 384 |
" Supprime la session en cours |
298 |
-noremap <leader>d :SDelete<CR> |
|
385 |
+noremap <leader>d :SDelete!<CR> |
|
299 | 386 |
|
300 | 387 |
|
301 | 388 |
|
... | ... |
@@ -319,6 +406,9 @@ nnoremap <Esc><Esc> :noh<CR> |
319 | 406 |
|
320 | 407 |
" ------- TABS ------- |
321 | 408 |
|
409 |
+" Ouvre les fichiers sur plusieurs onglets au lieu de plusieurs buffers |
|
410 |
+"if !&diff | silent tab all | tabfirst | endif |
|
411 |
+ |
|
322 | 412 |
" Creer un nouveau tab et ouvre l'explorateur NerdTree |
323 | 413 |
noremap <leader>t :$tabe<CR>:NERDTreeToggle<CR> |
324 | 414 |
noremap <F3> :$tabe<CR>:NERDTreeToggle<CR> |
... | ... |
@@ -332,4 +422,3 @@ inoremap <F4> <Esc>gt |
332 | 422 |
noremap <leader><F2> :tabm -1<CR> |
333 | 423 |
noremap <leader><F4> :tabm +1<CR> |
334 | 424 |
|
335 |
- |
... | ... |
@@ -1,332 +1,269 @@ |
1 |
-" |
|
2 |
-" VIMRC - Seb |
|
3 |
-" |
|
4 |
-" |
|
5 |
-" |
|
6 |
-" S'il y a probleme de couleurs, ajouter au .bashrc : |
|
7 |
-" export TERM=xterm-256color |
|
8 |
-" (verifier avec 'tput colors' que ca retourne bien 256) |
|
9 |
-" |
|
10 |
-" |
|
11 |
- |
|
12 |
-" |
|
13 |
-" Docs : |
|
14 |
-" |
|
15 |
-" https://l.messenger.com/l.php?u=https%3A%2F%2Fftp.traduc.org%2Fdoc-vf%2Fgazette-linux%2Fhtml%2F2008%2F152%2Flg152-C.html&h=AT0olcNyj2hovnCwhdEz4TzB0oStACDAEz4dTK6OO9nonvJHHwqrtYMCUeLMolVhdBQz_GN2ciUbAfquT9pgZnK9mi8CmaZTVaQSGzPg1Vv2NdEE-fdc4g07pzmLbxlfqfrvSSmpYMKknXLsLbw |
|
16 |
-" |
|
17 |
-" https://www.tictech.info/post/vim_basic |
|
18 |
-" https://www.tictech.info/post/vim_avance_p1 |
|
19 |
-" https://www.tictech.info/post/vim_avance_p2 |
|
20 |
-" |
|
21 |
-" https://arolla.developpez.com/tutoriels/programmation/editeurs-code/dompter-vim-en-trois-temps/ |
|
22 |
-" https://borntocode.fr/ameliorer-votre-productivite-avec-vim/ |
|
23 |
-" |
|
24 |
-" https://artisan.karma-lab.net/vim-plugins-indispensables |
|
25 |
-" https://vimawesome.com/ |
|
26 |
-" https://medium.com/@brunojorge11/vim-as-php-ide-83310dddbf03 |
|
27 |
-" |
|
28 |
-" https://github.com/ycm-core/YouCompleteMe |
|
29 |
-" |
|
30 |
-" https://github.com/mmozuras/vimfiles/blob/master/vimrc |
|
31 |
-" https://borntocode.fr/ameliorer-votre-productivite-avec-vim/ |
|
32 |
-" https://github.com/JakobGM/dotfiles/blob/master/config/nvim/init.vim |
|
33 |
-" https://gist.github.com/millermedeiros/1262085 |
|
34 |
-" |
|
35 |
-" https://www.youtube.com/watch?v=XA2WjJbmmoM |
|
36 |
-" |
|
37 |
-" |
|
38 |
- |
|
39 |
- |
|
40 |
-" |
|
41 |
-" Autres plugins interessants a regarder : |
|
42 |
-" |
|
43 |
-" ludovicchabant/vim-gutentags -- ctags |
|
44 |
-" majutsushi/tagbar -- Menu de ctags |
|
45 |
-" cohama/lexima.vim -- Clos auto les {([ ... |
|
46 |
-" honza/vim-snippets -- Gestion de snippets (template de bouts de code) |
|
47 |
-" Valloric/YouCompleteMe -- Autocompletion |
|
48 |
-" spell correction orthographe |
|
49 |
-" mbbill/undotree |
|
50 |
-" |
|
51 |
- |
|
52 |
- |
|
53 |
- |
|
54 |
- |
|
55 |
- |
|
56 |
- |
|
57 |
- |
|
58 |
- |
|
59 |
-" |
|
60 |
-" MEMO DES COMMANDES |
|
61 |
-" |
|
62 |
-" |
|
63 |
- |
|
64 |
-" ** Plugins |
|
65 |
-" :PlugInstall -- Installer les plugins ajoutes dans la liste ci-dessous |
|
66 |
-" :PlugClean -- Nettoyer les plugins supprimes de la liste |
|
67 |
-" :PlugUpdate -- Update les plugins installes |
|
68 |
- |
|
69 |
-" ** Souris |
|
70 |
-" <Shift><Mouse-Selection> -- Pour copier du texte |
|
71 |
-" <Shift><Mouse-Right> -- Coller du texte |
|
72 |
- |
|
73 |
-" ** Touches initiales |
|
74 |
-" i / a -- Passer en mode insertion |
|
75 |
-" A -- Passer en mode insertion a la fin de la ligne |
|
76 |
-" d / y / p -- Delete / Yank / Paste |
|
77 |
-" o / O -- Ajoute une ligne vide dessous/dessus |
|
78 |
-" w / W -- Se deplacer de mot/MOT en mot/MOT |
|
79 |
-" % -- Passer de l'ouverture a la fermeture d'un ({[ <=> ]}) |
|
80 |
-" :w/<filename> -- Enregistrer sous |
|
81 |
- |
|
82 |
-" ** Folds |
|
83 |
-" zf3j -- Creer un fold des 3 lignes en dessous |
|
84 |
-" za -- Toggle le fold |
|
85 |
-" zM / zR -- Ferme/Ouvre tous les folds |
|
86 |
-" zd / zE -- Supprime un/tous les fold(s) |
|
87 |
- |
|
88 |
-" ** Completion |
|
89 |
-" C-n / C-p -- Lister les completions possibles |
|
90 |
-" C-i C-o -- Omni-completion |
|
91 |
- |
|
92 |
-" ** Marques |
|
93 |
-" ma -- Poser le marqueur 'a' |
|
94 |
-" 'a -- Aller au marqueur 'a' |
|
95 |
-" :marks -- Lister les marqueurs |
|
96 |
- |
|
97 |
-" ** Persos |
|
98 |
-" ; -- Ajoute un ';' en fin de ligne |
|
99 |
-" |
|
100 |
-" C-f / <leader><Up> -- Cree un fold ?{ to %} |
|
101 |
-" <leader><Down> -- Cree un fold /{ to %} |
|
102 |
-" <F9> -- Toogle fold |
|
103 |
-" <leader><PageUp> -- Ferme tous les folds |
|
104 |
-" <leader><PageDown> -- Ouvre tous les folds |
|
105 |
-" |
|
106 |
-" <F7> -- Syntaxe : Infos |
|
107 |
-" <F8> -- Syntaxe : Errors |
|
108 |
-" |
|
109 |
-" <leader><Left>/<Right> -- Ajoute/Enleve 1 indentation |
|
110 |
-" |
|
111 |
-" <leader>q -- Quitte et cree une session |
|
112 |
-" <leader>d -- Supprime la session en cours |
|
113 |
-" <leader>w -- Enregistre tous les onglets |
|
114 |
-" |
|
115 |
-" <leader><leader> -- Commente la ligne |
|
116 |
-" |
|
117 |
-" <leader>e -- Toogle NerdTree |
|
118 |
-" |
|
119 |
-" <F3>/<leader>t -- Cree un nouvel onglet, et ouvre NerdTree |
|
120 |
-" <F2>/<F4> -- Navigue dans les tab |
|
121 |
-" <leader><F2>/<F4> -- Deplace le tab courant |
|
122 |
-" |
|
123 |
-" <F12> -- Paste Toggle : Desactive l'autoindent pour coller du code |
|
124 |
-" |
|
125 |
-" <ESC><ESC> -- Quitter le search highlighting |
|
126 |
-" |
|
127 |
-" <TAB> -- Autocompletion |
|
128 |
- |
|
129 |
-" ** Plugin : NerdTree |
|
130 |
-" m -- Affiche le menu pour creer/deplacer/suppimer des fichiers/repertoies |
|
131 |
- |
|
132 |
-" ** Plugin : Vimagit |
|
133 |
-" <F6>/:Magit -- Affiche l'interface. Puis commandes : |
|
134 |
-" S -- Pour staged une modif |
|
135 |
-" CC -- Commit (mettre le commentaire puis refaire CC) |
|
136 |
-" q -- Quitter Magit |
|
137 |
-" |
|
138 |
- |
|
139 |
-" ** Plugin : Gitgutter |
|
140 |
-" ]c / [c -- Aller a la suivante/precedente modification (map <MON SHORTCUT> <Plug>(GitGutterNextHunk) / PrevHunk) |
|
141 |
-" <leader>hs -- Stage la modif |
|
142 |
-" <leader>hu -- Annuler la modif |
|
143 |
- |
|
144 |
- |
|
145 |
- |
|
146 |
-" |
|
147 |
-" PLUGINS |
|
148 |
-" |
|
149 |
- |
|
150 |
- |
|
151 |
-"https://github.com/junegunn/vim-plug |
|
152 |
-"Deploie l'environnement vim avec installation des plugins, |
|
153 |
-" si c'est le premier lancement de ce vimrc |
|
1 |
+" ------- PLUGINS ------- |
|
2 |
+ |
|
3 |
+" First init : installation des plugins |
|
154 | 4 |
if empty(glob('~/.vim/autoload/plug.vim')) |
155 | 5 |
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs |
156 | 6 |
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim |
157 | 7 |
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC |
158 | 8 |
endif |
159 | 9 |
|
160 |
-call plug#begin('~/.vim/plugged') " Debut de chargement des plugins |
|
161 |
- |
|
162 |
-Plug 'scrooloose/syntastic' " Verif de la syntaxe du code |
|
163 |
-Plug 'preservim/nerdtree' " Navigateur de fichiers |
|
164 |
-"Plug 'majutsushi/tagbar' " Barre d'affichage des objets du code en cours |
|
165 |
-"Plug 'ycm-core/YouCompleteMe' " Autocompletion de code |
|
166 |
-Plug 'mhinz/vim-startify' " Gestion des sessions |
|
10 |
+" Debut de chargement des plugins |
|
11 |
+call plug#begin('~/.vim/plugged') |
|
167 | 12 |
|
168 |
-Plug 'tpope/vim-fugitive' " Git plugin with commands 'G<command>' |
|
169 |
-Plug 'jreybert/vimagit' " Modal git editing with <leader>g |
|
170 |
-Plug 'airblade/vim-gitgutter' " Affiche les symboles de modifs git dans la marge |
|
13 |
+" Verif de la syntaxe du code |
|
14 |
+Plug 'scrooloose/syntastic' |
|
15 |
+" Navigateur de fichiers |
|
16 |
+Plug 'preservim/nerdtree' |
|
17 |
+" Gestion des sessions |
|
18 |
+Plug 'mhinz/vim-startify' |
|
171 | 19 |
|
172 |
-Plug 'drewtempelmeyer/palenight.vim' " Theme |
|
173 |
-Plug 'itchyny/lightline.vim' " Theme de barre de statut en bas |
|
20 |
+" Git plugin with commands 'G<command>' |
|
21 |
+Plug 'tpope/vim-fugitive' |
|
22 |
+" Modal git editing with <leader>g |
|
23 |
+Plug 'jreybert/vimagit' |
|
24 |
+" Affiche les symboles de modifs git dans la marge |
|
25 |
+Plug 'airblade/vim-gitgutter' |
|
174 | 26 |
|
175 |
-"Plug 'ryanoasis/vim-devicons' " Lot d'icones pour NerdTree |
|
27 |
+" Theme |
|
28 |
+Plug 'drewtempelmeyer/palenight.vim' |
|
29 |
+" Theme de barre de statut en bas |
|
30 |
+Plug 'itchyny/lightline.vim' |
|
176 | 31 |
|
177 |
-Plug 'sheerun/vim-polyglot' " Add syntax highlighting for a large range of filetypes |
|
178 |
-"Plug 'cakebaker/scss-syntax.vim' |
|
179 |
-"Plug 'othree/html5.vim' |
|
32 |
+" Add syntax highlighting for a large range of filetypes |
|
33 |
+Plug 'sheerun/vim-polyglot' |
|
180 | 34 |
|
181 | 35 |
call plug#end() |
182 | 36 |
|
183 | 37 |
|
184 | 38 |
|
185 | 39 |
|
40 |
+" ------- TRUE COLORS ------- |
|
186 | 41 |
|
187 |
-" |
|
188 |
-" TRUE COLORS |
|
189 |
-" |
|
190 |
- |
|
191 |
-"il faut ajouter 'export TERM=xterm-256color' dans .bashrc |
|
192 |
-"(v�rifier avec 'tput colors' que �a retourne bien 256) |
|
193 | 42 |
if (has("nvim")) |
194 | 43 |
let $NVIM_TUI_ENABLE_TRUE_COLOR=1 |
195 | 44 |
endif |
196 | 45 |
if (has("termguicolors")) |
197 | 46 |
set termguicolors |
198 | 47 |
endif |
199 |
-"set t_8b=^[[48;2;%lu;%lu;%lum |
|
200 |
-"set t_8f=^[[38;2;%lu;%lu;%lum |
|
201 | 48 |
|
202 | 49 |
|
203 | 50 |
|
204 | 51 |
|
52 |
+" ------- CONF ------- |
|
205 | 53 |
|
206 |
-" |
|
207 |
-" CONFIGURATIONS |
|
208 |
-" |
|
54 |
+" Use Vim settings, rather than Vi |
|
55 |
+set nocompatible |
|
209 | 56 |
|
57 |
+" Encodage |
|
58 |
+set encoding=UTF-8 |
|
210 | 59 |
|
211 | 60 |
" Ouvre les fichiers sur plusieurs onglets au lieu de plusieurs buffers |
212 | 61 |
if !&diff | silent tab all | tabfirst | endif |
213 | 62 |
|
214 |
-set encoding=UTF-8 |
|
215 | 63 |
|
216 |
-set laststatus=2 " Affiche une barre de status en bas de l'�cran |
|
217 |
-set textwidth=0 " Largeur maxi du texte ins�r� : '0' d�sactive la fonction |
|
218 |
-set history=50 " Nombre de commandes dans l'historique |
|
219 |
-set viminfo='20,\"50 " Options du fichier ~/.viminfo |
|
220 |
-set backspace=2 " Active la touche Backspace |
|
221 |
-set scrolloff=5 " Garde toujours X ligne(s) visible(s) � l'�cran au dessus du curseur |
|
222 |
-set showcmd " Affiche les commandes dans la barre de status |
|
223 |
-set showmatch " Affiche la paire de parenth�ses |
|
224 |
-set nostartofline " Essaye de garder le curseur dans la m�me colonne quand on change de ligne |
|
225 |
- |
|
226 |
-set wildmode=list:full " Option de la compl�tion automatique |
|
227 |
-"set wildmode=list:longest " Option de la compl�tion automatique |
|
64 |
+" Affiche la barre d'info en bas |
|
65 |
+set laststatus=2 |
|
66 |
+" Largeur maxi : 0 = desactive |
|
67 |
+set textwidth=0 |
|
68 |
+" Nombre de cmd dans l'historique |
|
69 |
+set history=50 |
|
70 |
+" Options du fichier ~/.viminfo |
|
71 |
+set viminfo='20,\"50 |
|
72 |
+" Active la touche Backspace |
|
73 |
+set backspace=2 |
|
74 |
+" Garde toujours X ligne(s) visible(s) à l'écran au dessus du curseur |
|
75 |
+set scrolloff=5 |
|
76 |
+" Affiche les commandes dans la barre de status |
|
77 |
+set showcmd |
|
78 |
+" Affiche la paire de parenthèses |
|
79 |
+set showmatch |
|
80 |
+" Essaye de garder le curseur dans la même colonne quand on change de ligne |
|
81 |
+set nostartofline |
|
82 |
+ |
|
83 |
+" Option de la complétion automatique |
|
84 |
+set wildmode=list:full |
|
228 | 85 |
set wildignore+=*.o,*.obj,*.exe,*.so,*.dll,*.pyc,*.swp,*.jpg,*.png,*.gif,*.pdf,*.bak,.svn,.hg,.bzr,.git, |
229 | 86 |
|
230 |
-set nocompatible "use Vim settings, rather than Vi |
|
231 |
- |
|
232 |
-set incsearch "find the next match as we type the search |
|
233 |
-set hlsearch "highlight searches by default |
|
87 |
+"find the next match as we type the search |
|
88 |
+set incsearch |
|
89 |
+"highlight searches by default |
|
90 |
+set hlsearch |
|
234 | 91 |
|
235 |
-set ignorecase "set search to be case insensitive |
|
236 |
-set smartcase "unless you typed uppercase letters in your query |
|
92 |
+"set search to be case insensitive |
|
93 |
+set ignorecase |
|
94 |
+"unless you typed uppercase letters in your query |
|
95 |
+set smartcase |
|
237 | 96 |
|
238 |
-set number "add line numbers |
|
97 |
+"add line numbers |
|
98 |
+set number |
|
239 | 99 |
|
240 |
-syntax on "turn on syntax highlighting |
|
100 |
+"turn on syntax highlighting |
|
101 |
+syntax on |
|
102 |
+filetype plugin on |
|
241 | 103 |
|
242 |
-set visualbell t_vb= " Desactive le visualbell |
|
104 |
+" Desactive le visualbell |
|
105 |
+set visualbell t_vb= |
|
243 | 106 |
|
107 |
+" Active la souris |
|
244 | 108 |
set mouse=a |
245 | 109 |
|
246 |
-"Performances |
|
247 |
-set hidden " can put buffer to the background without writing |
|
248 |
- " to disk, will remember history/marks. |
|
249 |
-set lazyredraw " don't update the display while executing macros |
|
250 |
-set ttyfast " Send more characters at a given time. |
|
251 | 110 |
|
252 | 111 |
|
112 |
+" Performances |
|
113 |
+set hidden |
|
114 |
+set lazyredraw |
|
115 |
+set ttyfast |
|
253 | 116 |
|
254 |
-" |
|
255 |
-" THEME |
|
256 |
-" |
|
257 | 117 |
|
258 |
-set background=dark |
|
259 | 118 |
|
260 |
-colorscheme palenight |
|
261 |
-"let g:lightline = { 'colorscheme': 'palenight' } |
|
262 |
-"let g:airline_theme = "palenight" |
|
263 |
-let g:palenight_terminal_italics=1 |
|
264 | 119 |
|
265 |
-set cursorline " Surligne la ligne en cours |
|
266 |
-set noshowmode " N'affiche pas le mode en cours en bas, vu qu'il est sur la lightline |
|
120 |
+" ------- THEME ------- |
|
267 | 121 |
|
122 |
+set background=dark |
|
123 |
+colorscheme palenight |
|
124 |
+"let g:palenight_terminal_italics=1 |
|
125 |
+ |
|
126 |
+" Surligne la ligne en cours |
|
127 |
+set cursorline |
|
128 |
+" N'affiche pas le mode en cours en bas, vu qu'il est sur la lightline |
|
129 |
+set noshowmode |
|
268 | 130 |
|
269 |
-"let g:lightline = { 'colorscheme': 'powerline' } |
|
270 | 131 |
let g:lightline = { |
271 |
- \ 'colorscheme': 'wombat', |
|
272 |
- \ 'active': { |
|
273 |
- \ 'left': [ [ 'mode', 'paste' ], |
|
274 |
- \ [ 'gitbranch', 'readonly', 'filename', 'modified' ] ] |
|
275 |
- \ }, |
|
276 |
- \ 'component_function': { |
|
277 |
- \ 'gitbranch': 'FugitiveHead' |
|
278 |
- \ }, |
|
279 |
- \ } |
|
280 |
- |
|
281 |
- |
|
282 |
-" |
|
283 |
-" INDENTATION & AUTOCOMPLETION |
|
284 |
-" |
|
285 |
- |
|
286 |
-"indent settings |
|
132 |
+ \ 'colorscheme': 'wombat', |
|
133 |
+ \ 'active': { |
|
134 |
+ \ 'left': [ [ 'mode', 'paste' ], |
|
135 |
+ \ [ 'gitbranch', 'readonly', 'filename', 'modified' ] ] |
|
136 |
+ \ }, |
|
137 |
+ \ 'component_function': { |
|
138 |
+ \ 'gitbranch': 'FugitiveHead' |
|
139 |
+ \ }, |
|
140 |
+ \ } |
|
141 |
+ |
|
142 |
+ |
|
143 |
+ |
|
144 |
+ |
|
145 |
+" ------- INDENTATION ------- |
|
146 |
+ |
|
287 | 147 |
set shiftwidth=2 |
288 | 148 |
set tabstop=2 |
289 | 149 |
set softtabstop=2 |
290 | 150 |
set expandtab |
291 |
-set autoindent |
|
292 |
-"set noautoindent |
|
293 |
-"set nocindent |
|
294 |
-"set nosmartindent |
|
295 |
-"set indentexpr= |
|
296 |
-"filetype indent plugin off |
|
151 |
+filetype indent plugin on |
|
297 | 152 |
|
153 |
+" Desactive l'autoindent le temps d'un copier-coller |
|
154 |
+set pastetoggle=<F12> |
|
155 |
+ |
|
156 |
+" Change l'indentation |
|
157 |
+nnoremap <leader><Right> >> |
|
158 |
+vnoremap <leader><Right> >gv |
|
159 |
+nnoremap <leader><Left> << |
|
160 |
+vnoremap <leader><Left> <gv |
|
161 |
+vnoremap < <gv |
|
162 |
+vnoremap > >gv |
|
163 |
+ |
|
164 |
+ |
|
165 |
+ |
|
166 |
+ |
|
167 |
+" ------- AUTOCOMPLETION ------- |
|
298 | 168 |
|
299 |
-filetype plugin on |
|
300 | 169 |
set omnifunc=syntaxcomplete#Complete |
301 | 170 |
set completeopt=menuone |
302 |
-"set completeopt=longest,menu,preview |
|
303 | 171 |
|
172 |
+" Autocompletion avec la touche <TAB> |
|
173 |
+function! Smart_TabComplete() |
|
174 |
+ " Current line |
|
175 |
+ let line = getline('.') |
|
176 |
+ |
|
177 |
+ " from the start of the current line to one character right of the cursor |
|
178 |
+ let substr = strpart(line, -1, col('.')+1) |
|
179 |
+ " word till cursor |
|
180 |
+ let substr = matchstr(substr, "[^ \t]*$") |
|
181 |
+ " nothing to match on empty string |
|
182 |
+ if (strlen(substr)==0) |
|
183 |
+ return "\<tab>" |
|
184 |
+ endif |
|
185 |
+ " position of slash, if any |
|
186 |
+ let has_slash = match(substr, '\/') != -1 |
|
187 |
+ if (has_slash) |
|
188 |
+ " file matching |
|
189 |
+ return "\<C-X>\<C-F>" |
|
190 |
+ else |
|
191 |
+ " plugin matching |
|
192 |
+ return "\<C-X>\<C-O>" |
|
193 |
+ endif |
|
194 |
+endfunction |
|
195 |
+ |
|
196 |
+inoremap <tab> <c-r>=Smart_TabComplete()<CR> |
|
304 | 197 |
|
305 | 198 |
|
306 |
-"fold settings |
|
199 |
+ |
|
200 |
+ |
|
201 |
+ |
|
202 |
+" ------- FOLDS SETTINGS ------- |
|
203 |
+ |
|
307 | 204 |
set foldcolumn=3 |
308 | 205 |
set foldmethod=manual |
309 |
-"set foldlevel=99 |
|
310 | 206 |
set foldlevelstart=99 |
311 | 207 |
autocmd BufWinLeave *.php,*.htm,*.html,*.css,*.c,*.cc,*.h,*.cpp,*.py,*.rb,*.js mkview |
312 | 208 |
autocmd BufWinEnter *.php,*.htm,*.html,*.css,*.c,*.cc,*.h,*.cpp,*.py,*.rb,*.js silent loadview |
313 | 209 |
|
210 |
+" Cree un fold du prochain/precedent {, jusqu'au } de fermeture |
|
211 |
+nmap <C-f> ?{<CR>zf%za:noh<CR> |
|
212 |
+nmap <leader><Down> /{<CR>zf%za:noh<CR> |
|
213 |
+nnoremap <leader><Up> ?{<CR>zf%za:noh<CR> |
|
214 |
+" Toggle le fold en cours |
|
215 |
+nmap <F9> za |
|
216 |
+" Ouvre tous les folds |
|
217 |
+nnoremap <leader><PageDown> zR |
|
218 |
+" Ferme tous les folds |
|
219 |
+nnoremap <leader><PageUp> zM |
|
314 | 220 |
|
315 | 221 |
|
316 | 222 |
|
317 | 223 |
|
318 |
- |
|
319 |
-" |
|
320 |
-" CONF DES PLUGINS |
|
321 |
-" |
|
224 |
+" ------- PLUGIN: NerdTree ------- |
|
322 | 225 |
|
323 | 226 |
let NERDTreeQuitOnOpen=1 |
324 | 227 |
let NERDTreeShowHidden=1 |
325 | 228 |
|
229 |
+" Affiche/Cache l'explorateur NerdTree |
|
230 |
+noremap <leader>e :NERDTreeToggle<CR> |
|
231 |
+ |
|
232 |
+ |
|
233 |
+ |
|
234 |
+ |
|
235 |
+" ------- PLUGIN: Syntastic ------- |
|
236 |
+ |
|
326 | 237 |
let g:syntastic_always_populate_loc_list = 1 |
327 | 238 |
let g:syntastic_check_on_open = 1 |
328 | 239 |
let g:syntastic_check_on_wq = 0 |
329 | 240 |
|
241 |
+" Infos de syntaxe |
|
242 |
+nmap <F7> :SyntasticInfo<CR> |
|
243 |
+nmap <F8> :Errors<CR> |
|
244 |
+ |
|
245 |
+ |
|
246 |
+ |
|
247 |
+ |
|
248 |
+" ------- PLUGIN: GitGutter ------- |
|
249 |
+ |
|
250 |
+let g:gitgutter_terminal_reports_focus = 0 |
|
251 |
+let g:gitgutter_async = 0 |
|
252 |
+autocmd BufWritePost * GitGutter |
|
253 |
+ |
|
254 |
+ |
|
255 |
+ |
|
256 |
+ |
|
257 |
+" ------- PLUGIN: Magit ------- |
|
258 |
+ |
|
259 |
+map <F6> :Magit<CR> |
|
260 |
+imap <F6> <Esc>:Magit<CR> |
|
261 |
+ |
|
262 |
+ |
|
263 |
+ |
|
264 |
+ |
|
265 |
+" ------- PLUGIN: Startify (sessions) ------- |
|
266 |
+ |
|
330 | 267 |
let g:startify_session_persistence = 1 |
331 | 268 |
let g:startify_enable_special = 0 |
332 | 269 |
let g:startify_files_number = 10 |
... | ... |
@@ -347,7 +284,6 @@ let g:startify_session_before_save = [ |
347 | 284 |
\ 'silent! NERDTreeTabsClose' |
348 | 285 |
\ ] |
349 | 286 |
|
350 |
- |
|
351 | 287 |
function! SessionCreate() |
352 | 288 |
if empty(v:this_session) |
353 | 289 |
if tabpagenr("$") > 1 |
... | ... |
@@ -356,63 +292,18 @@ function! SessionCreate() |
356 | 292 |
endif |
357 | 293 |
endfunction |
358 | 294 |
|
295 |
+" Quitte quand plusieurs onglets sont ouverts, et cree une session si elle n'existe pas |
|
296 |
+noremap <leader>q :call SessionCreate()<CR>:qa<CR> |
|
297 |
+" Supprime la session en cours |
|
298 |
+noremap <leader>d :SDelete<CR> |
|
359 | 299 |
|
360 |
-let g:gitgutter_terminal_reports_focus = 0 |
|
361 |
-let g:gitgutter_async = 0 |
|
362 |
-autocmd BufWritePost * GitGutter |
|
363 |
- |
|
364 |
- |
|
365 |
- |
|
366 |
-"let g:tagbar_autofocus=1 |
|
367 |
- |
|
368 |
- |
|
369 |
- |
|
370 |
-" |
|
371 |
-" RACCOURCIS CLAVIER |
|
372 |
-" |
|
373 |
- |
|
374 |
-set whichwrap=<,>,[,] " Autorise le passage d'une ligne � l'autre avec les fl�ches gauche et droite |
|
375 |
- |
|
376 |
-" Definition de la touche <leader> |
|
377 |
-let g:mapleader = " " |
|
378 | 300 |
|
379 | 301 |
|
380 | 302 |
|
381 |
-"map <C-x> :TagbarToggle<CR> |
|
303 |
+" ------- CLAVIER ------- |
|
382 | 304 |
|
383 | 305 |
map ; A;<ESC> |
384 | 306 |
|
385 |
-" Cree un fold du prochain/precedent {, jusqu'au } de fermeture |
|
386 |
-"map <C-f> f{zf%za |
|
387 |
-nmap <C-f> ?{<CR>zf%za:noh<CR> |
|
388 |
-nmap <leader><Down> /{<CR>zf%za:noh<CR> |
|
389 |
-nnoremap <leader><Up> ?{<CR>zf%za:noh<CR> |
|
390 |
-" Toggle le fold en cours |
|
391 |
-nmap <F9> za |
|
392 |
-" Ouvre tous les folds |
|
393 |
-nnoremap <leader><PageDown> zR |
|
394 |
-" Ferme tous les folds |
|
395 |
-nnoremap <leader><PageUp> zM |
|
396 |
- |
|
397 |
-" Infos de syntaxe |
|
398 |
-nmap <F7> :SyntasticInfo<CR> |
|
399 |
-nmap <F8> :Errors<CR> |
|
400 |
- |
|
401 |
- |
|
402 |
- |
|
403 |
-" Change l'indentation |
|
404 |
-nnoremap <leader><Right> >> |
|
405 |
-vnoremap <leader><Right> >gv |
|
406 |
-nnoremap <leader><Left> << |
|
407 |
-vnoremap <leader><Left> <gv |
|
408 |
-vnoremap < <gv |
|
409 |
-vnoremap > >gv |
|
410 |
- |
|
411 |
-" Quitte quand plusieurs onglets sont ouverts, et cree une session si elle n'existe pas |
|
412 |
-noremap <leader>q :call SessionCreate()<CR>:qa<CR> |
|
413 |
-" Supprime la session en cours |
|
414 |
-noremap <leader>d :SDelete<CR> |
|
415 |
- |
|
416 | 307 |
" Enregistre tous les onglets en meme temps |
417 | 308 |
noremap <leader>w :wa<CR> |
418 | 309 |
|
... | ... |
@@ -420,9 +311,13 @@ noremap <leader>w :wa<CR> |
420 | 311 |
autocmd VimEnter *.php,*.js,*.c,*.cc,*.h,*.cpp noremap <leader><leader> 0i//<ESC> |
421 | 312 |
autocmd VimEnter *.sh noremap <leader><leader> 0i#<ESC> |
422 | 313 |
|
423 |
-" Affiche/Cache l'explorateur NerdTree |
|
424 |
-noremap <leader>e :NERDTreeToggle<CR> |
|
314 |
+" Clear search highlighting |
|
315 |
+nnoremap <Esc><Esc> :noh<CR> |
|
316 |
+ |
|
317 |
+ |
|
318 |
+ |
|
425 | 319 |
|
320 |
+" ------- TABS ------- |
|
426 | 321 |
|
427 | 322 |
" Creer un nouveau tab et ouvre l'explorateur NerdTree |
428 | 323 |
noremap <leader>t :$tabe<CR>:NERDTreeToggle<CR> |
... | ... |
@@ -437,39 +332,4 @@ inoremap <F4> <Esc>gt |
437 | 332 |
noremap <leader><F2> :tabm -1<CR> |
438 | 333 |
noremap <leader><F4> :tabm +1<CR> |
439 | 334 |
|
440 |
-imap <F10> <C-x><C-o> |
|
441 |
- |
|
442 |
-" Desactive l'autoindent le temps d'un copier-coller |
|
443 |
-set pastetoggle=<F12> |
|
444 |
- |
|
445 |
-" Clear search highlighting |
|
446 |
-nnoremap <Esc><Esc> :noh<CR> |
|
447 |
- |
|
448 |
- |
|
449 |
-map <F6> :Magit<CR> |
|
450 |
-imap <F6> <Esc>:Magit<CR> |
|
451 |
- |
|
452 |
- |
|
453 |
- |
|
454 |
-" Autocompletion avec la touche <TAB> |
|
455 |
-function! Smart_TabComplete() |
|
456 |
- let line = getline('.') " current line |
|
457 |
- |
|
458 |
- let substr = strpart(line, -1, col('.')+1) " from the start of the current |
|
459 |
- " line to one character right |
|
460 |
- " of the cursor |
|
461 |
- let substr = matchstr(substr, "[^ \t]*$") " word till cursor |
|
462 |
- if (strlen(substr)==0) " nothing to match on empty string |
|
463 |
- return "\<tab>" |
|
464 |
- endif |
|
465 |
- let has_slash = match(substr, '\/') != -1 " position of slash, if any |
|
466 |
- if (has_slash) |
|
467 |
- return "\<C-X>\<C-F>" " file matching |
|
468 |
- else |
|
469 |
- return "\<C-X>\<C-O>" " plugin matching |
|
470 |
- endif |
|
471 |
-endfunction |
|
472 |
-inoremap <tab> <c-r>=Smart_TabComplete()<CR> |
|
473 |
- |
|
474 |
- |
|
475 | 335 |
|
1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,475 @@ |
1 |
+" |
|
2 |
+" VIMRC - Seb |
|
3 |
+" |
|
4 |
+" |
|
5 |
+" |
|
6 |
+" S'il y a probleme de couleurs, ajouter au .bashrc : |
|
7 |
+" export TERM=xterm-256color |
|
8 |
+" (v�rifier avec 'tput colors' que �a retourne bien 256) |
|
9 |
+" |
|
10 |
+" |
|
11 |
+ |
|
12 |
+" |
|
13 |
+" Docs : |
|
14 |
+" |
|
15 |
+" https://l.messenger.com/l.php?u=https%3A%2F%2Fftp.traduc.org%2Fdoc-vf%2Fgazette-linux%2Fhtml%2F2008%2F152%2Flg152-C.html&h=AT0olcNyj2hovnCwhdEz4TzB0oStACDAEz4dTK6OO9nonvJHHwqrtYMCUeLMolVhdBQz_GN2ciUbAfquT9pgZnK9mi8CmaZTVaQSGzPg1Vv2NdEE-fdc4g07pzmLbxlfqfrvSSmpYMKknXLsLbw |
|
16 |
+" |
|
17 |
+" https://www.tictech.info/post/vim_basic |
|
18 |
+" https://www.tictech.info/post/vim_avance_p1 |
|
19 |
+" https://www.tictech.info/post/vim_avance_p2 |
|
20 |
+" |
|
21 |
+" https://arolla.developpez.com/tutoriels/programmation/editeurs-code/dompter-vim-en-trois-temps/ |
|
22 |
+" https://borntocode.fr/ameliorer-votre-productivite-avec-vim/ |
|
23 |
+" |
|
24 |
+" https://artisan.karma-lab.net/vim-plugins-indispensables |
|
25 |
+" https://vimawesome.com/ |
|
26 |
+" https://medium.com/@brunojorge11/vim-as-php-ide-83310dddbf03 |
|
27 |
+" |
|
28 |
+" https://github.com/ycm-core/YouCompleteMe |
|
29 |
+" |
|
30 |
+" https://github.com/mmozuras/vimfiles/blob/master/vimrc |
|
31 |
+" https://borntocode.fr/ameliorer-votre-productivite-avec-vim/ |
|
32 |
+" https://github.com/JakobGM/dotfiles/blob/master/config/nvim/init.vim |
|
33 |
+" https://gist.github.com/millermedeiros/1262085 |
|
34 |
+" |
|
35 |
+" https://www.youtube.com/watch?v=XA2WjJbmmoM |
|
36 |
+" |
|
37 |
+" |
|
38 |
+ |
|
39 |
+ |
|
40 |
+" |
|
41 |
+" Autres plugins interessants a regarder : |
|
42 |
+" |
|
43 |
+" ludovicchabant/vim-gutentags -- ctags |
|
44 |
+" majutsushi/tagbar -- Menu de ctags |
|
45 |
+" cohama/lexima.vim -- Clos auto les {([ ... |
|
46 |
+" honza/vim-snippets -- Gestion de snippets (template de bouts de code) |
|
47 |
+" Valloric/YouCompleteMe -- Autocompletion |
|
48 |
+" spell correction orthographe |
|
49 |
+" mbbill/undotree |
|
50 |
+" |
|
51 |
+ |
|
52 |
+ |
|
53 |
+ |
|
54 |
+ |
|
55 |
+ |
|
56 |
+ |
|
57 |
+ |
|
58 |
+ |
|
59 |
+" |
|
60 |
+" MEMO DES COMMANDES |
|
61 |
+" |
|
62 |
+" |
|
63 |
+ |
|
64 |
+" ** Plugins |
|
65 |
+" :PlugInstall -- Installer les plugins ajoutes dans la liste ci-dessous |
|
66 |
+" :PlugClean -- Nettoyer les plugins supprimes de la liste |
|
67 |
+" :PlugUpdate -- Update les plugins installes |
|
68 |
+ |
|
69 |
+" ** Souris |
|
70 |
+" <Shift><Mouse-Selection> -- Pour copier du texte |
|
71 |
+" <Shift><Mouse-Right> -- Coller du texte |
|
72 |
+ |
|
73 |
+" ** Touches initiales |
|
74 |
+" i / a -- Passer en mode insertion |
|
75 |
+" A -- Passer en mode insertion a la fin de la ligne |
|
76 |
+" d / y / p -- Delete / Yank / Paste |
|
77 |
+" o / O -- Ajoute une ligne vide dessous/dessus |
|
78 |
+" w / W -- Se deplacer de mot/MOT en mot/MOT |
|
79 |
+" % -- Passer de l'ouverture a la fermeture d'un ({[ <=> ]}) |
|
80 |
+" :w/<filename> -- Enregistrer sous |
|
81 |
+ |
|
82 |
+" ** Folds |
|
83 |
+" zf3j -- Creer un fold des 3 lignes en dessous |
|
84 |
+" za -- Toggle le fold |
|
85 |
+" zM / zR -- Ferme/Ouvre tous les folds |
|
86 |
+" zd / zE -- Supprime un/tous les fold(s) |
|
87 |
+ |
|
88 |
+" ** Completion |
|
89 |
+" C-n / C-p -- Lister les completions possibles |
|
90 |
+" C-i C-o -- Omni-completion |
|
91 |
+ |
|
92 |
+" ** Marques |
|
93 |
+" ma -- Poser le marqueur 'a' |
|
94 |
+" 'a -- Aller au marqueur 'a' |
|
95 |
+" :marks -- Lister les marqueurs |
|
96 |
+ |
|
97 |
+" ** Persos |
|
98 |
+" ; -- Ajoute un ';' en fin de ligne |
|
99 |
+" |
|
100 |
+" C-f / <leader><Up> -- Cree un fold ?{ to %} |
|
101 |
+" <leader><Down> -- Cree un fold /{ to %} |
|
102 |
+" <F9> -- Toogle fold |
|
103 |
+" <leader><PageUp> -- Ferme tous les folds |
|
104 |
+" <leader><PageDown> -- Ouvre tous les folds |
|
105 |
+" |
|
106 |
+" <F7> -- Syntaxe : Infos |
|
107 |
+" <F8> -- Syntaxe : Errors |
|
108 |
+" |
|
109 |
+" <leader><Left>/<Right> -- Ajoute/Enleve 1 indentation |
|
110 |
+" |
|
111 |
+" <leader>q -- Quitte et cree une session |
|
112 |
+" <leader>d -- Supprime la session en cours |
|
113 |
+" <leader>w -- Enregistre tous les onglets |
|
114 |
+" |
|
115 |
+" <leader><leader> -- Commente la ligne |
|
116 |
+" |
|
117 |
+" <leader>e -- Toogle NerdTree |
|
118 |
+" |
|
119 |
+" <F3>/<leader>t -- Cree un nouvel onglet, et ouvre NerdTree |
|
120 |
+" <F2>/<F4> -- Navigue dans les tab |
|
121 |
+" <leader><F2>/<F4> -- Deplace le tab courant |
|
122 |
+" |
|
123 |
+" <F12> -- Paste Toggle : Desactive l'autoindent pour coller du code |
|
124 |
+" |
|
125 |
+" <ESC><ESC> -- Quitter le search highlighting |
|
126 |
+" |
|
127 |
+" <TAB> -- Autocompletion |
|
128 |
+ |
|
129 |
+" ** Plugin : NerdTree |
|
130 |
+" m -- Affiche le menu pour creer/deplacer/suppimer des fichiers/repertoies |
|
131 |
+ |
|
132 |
+" ** Plugin : Vimagit |
|
133 |
+" <F6>/:Magit -- Affiche l'interface. Puis commandes : |
|
134 |
+" S -- Pour staged une modif |
|
135 |
+" CC -- Commit (mettre le commentaire puis refaire CC) |
|
136 |
+" q -- Quitter Magit |
|
137 |
+" |
|
138 |
+ |
|
139 |
+" ** Plugin : Gitgutter |
|
140 |
+" ]c / [c -- Aller a la suivante/precedente modification (map <MON SHORTCUT> <Plug>(GitGutterNextHunk) / PrevHunk) |
|
141 |
+" <leader>hs -- Stage la modif |
|
142 |
+" <leader>hu -- Annuler la modif |
|
143 |
+ |
|
144 |
+ |
|
145 |
+ |
|
146 |
+" |
|
147 |
+" PLUGINS |
|
148 |
+" |
|
149 |
+ |
|
150 |
+ |
|
151 |
+"https://github.com/junegunn/vim-plug |
|
152 |
+"Deploie l'environnement vim avec installation des plugins, |
|
153 |
+" si c'est le premier lancement de ce vimrc |
|
154 |
+if empty(glob('~/.vim/autoload/plug.vim')) |
|
155 |
+ silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs |
|
156 |
+ \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim |
|
157 |
+ autocmd VimEnter * PlugInstall --sync | source $MYVIMRC |
|
158 |
+endif |
|
159 |
+ |
|
160 |
+call plug#begin('~/.vim/plugged') " Debut de chargement des plugins |
|
161 |
+ |
|
162 |
+Plug 'scrooloose/syntastic' " Verif de la syntaxe du code |
|
163 |
+Plug 'preservim/nerdtree' " Navigateur de fichiers |
|
164 |
+"Plug 'majutsushi/tagbar' " Barre d'affichage des objets du code en cours |
|
165 |
+"Plug 'ycm-core/YouCompleteMe' " Autocompletion de code |
|
166 |
+Plug 'mhinz/vim-startify' " Gestion des sessions |
|
167 |
+ |
|
168 |
+Plug 'tpope/vim-fugitive' " Git plugin with commands 'G<command>' |
|
169 |
+Plug 'jreybert/vimagit' " Modal git editing with <leader>g |
|
170 |
+Plug 'airblade/vim-gitgutter' " Affiche les symboles de modifs git dans la marge |
|
171 |
+ |
|
172 |
+Plug 'drewtempelmeyer/palenight.vim' " Theme |
|
173 |
+Plug 'itchyny/lightline.vim' " Theme de barre de statut en bas |
|
174 |
+ |
|
175 |
+"Plug 'ryanoasis/vim-devicons' " Lot d'icones pour NerdTree |
|
176 |
+ |
|
177 |
+Plug 'sheerun/vim-polyglot' " Add syntax highlighting for a large range of filetypes |
|
178 |
+"Plug 'cakebaker/scss-syntax.vim' |
|
179 |
+"Plug 'othree/html5.vim' |
|
180 |
+ |
|
181 |
+call plug#end() |
|
182 |
+ |
|
183 |
+ |
|
184 |
+ |
|
185 |
+ |
|
186 |
+ |
|
187 |
+" |
|
188 |
+" TRUE COLORS |
|
189 |
+" |
|
190 |
+ |
|
191 |
+"il faut ajouter 'export TERM=xterm-256color' dans .bashrc |
|
192 |
+"(v�rifier avec 'tput colors' que �a retourne bien 256) |
|
193 |
+if (has("nvim")) |
|
194 |
+ let $NVIM_TUI_ENABLE_TRUE_COLOR=1 |
|
195 |
+endif |
|
196 |
+if (has("termguicolors")) |
|
197 |
+ set termguicolors |
|
198 |
+endif |
|
199 |
+"set t_8b=^[[48;2;%lu;%lu;%lum |
|
200 |
+"set t_8f=^[[38;2;%lu;%lu;%lum |
|
201 |
+ |
|
202 |
+ |
|
203 |
+ |
|
204 |
+ |
|
205 |
+ |
|
206 |
+" |
|
207 |
+" CONFIGURATIONS |
|
208 |
+" |
|
209 |
+ |
|
210 |
+ |
|
211 |
+" Ouvre les fichiers sur plusieurs onglets au lieu de plusieurs buffers |
|
212 |
+if !&diff | silent tab all | tabfirst | endif |
|
213 |
+ |
|
214 |
+set encoding=UTF-8 |
|
215 |
+ |
|
216 |
+set laststatus=2 " Affiche une barre de status en bas de l'�cran |
|
217 |
+set textwidth=0 " Largeur maxi du texte ins�r� : '0' d�sactive la fonction |
|
218 |
+set history=50 " Nombre de commandes dans l'historique |
|
219 |
+set viminfo='20,\"50 " Options du fichier ~/.viminfo |
|
220 |
+set backspace=2 " Active la touche Backspace |
|
221 |
+set scrolloff=5 " Garde toujours X ligne(s) visible(s) � l'�cran au dessus du curseur |
|
222 |
+set showcmd " Affiche les commandes dans la barre de status |
|
223 |
+set showmatch " Affiche la paire de parenth�ses |
|
224 |
+set nostartofline " Essaye de garder le curseur dans la m�me colonne quand on change de ligne |
|
225 |
+ |
|
226 |
+set wildmode=list:full " Option de la compl�tion automatique |
|
227 |
+"set wildmode=list:longest " Option de la compl�tion automatique |
|
228 |
+set wildignore+=*.o,*.obj,*.exe,*.so,*.dll,*.pyc,*.swp,*.jpg,*.png,*.gif,*.pdf,*.bak,.svn,.hg,.bzr,.git, |
|
229 |
+ |
|
230 |
+set nocompatible "use Vim settings, rather than Vi |
|
231 |
+ |
|
232 |
+set incsearch "find the next match as we type the search |
|
233 |
+set hlsearch "highlight searches by default |
|
234 |
+ |
|
235 |
+set ignorecase "set search to be case insensitive |
|
236 |
+set smartcase "unless you typed uppercase letters in your query |
|
237 |
+ |
|
238 |
+set number "add line numbers |
|
239 |
+ |
|
240 |
+syntax on "turn on syntax highlighting |
|
241 |
+ |
|
242 |
+set visualbell t_vb= " Desactive le visualbell |
|
243 |
+ |
|
244 |
+set mouse=a |
|
245 |
+ |
|
246 |
+"Performances |
|
247 |
+set hidden " can put buffer to the background without writing |
|
248 |
+ " to disk, will remember history/marks. |
|
249 |
+set lazyredraw " don't update the display while executing macros |
|
250 |
+set ttyfast " Send more characters at a given time. |
|
251 |
+ |
|
252 |
+ |
|
253 |
+ |
|
254 |
+" |
|
255 |
+" THEME |
|
256 |
+" |
|
257 |
+ |
|
258 |
+set background=dark |
|
259 |
+ |
|
260 |
+colorscheme palenight |
|
261 |
+"let g:lightline = { 'colorscheme': 'palenight' } |
|
262 |
+"let g:airline_theme = "palenight" |
|
263 |
+let g:palenight_terminal_italics=1 |
|
264 |
+ |
|
265 |
+set cursorline " Surligne la ligne en cours |
|
266 |
+set noshowmode " N'affiche pas le mode en cours en bas, vu qu'il est sur la lightline |
|
267 |
+ |
|
268 |
+ |
|
269 |
+"let g:lightline = { 'colorscheme': 'powerline' } |
|
270 |
+let g:lightline = { |
|
271 |
+ \ 'colorscheme': 'wombat', |
|
272 |
+ \ 'active': { |
|
273 |
+ \ 'left': [ [ 'mode', 'paste' ], |
|
274 |
+ \ [ 'gitbranch', 'readonly', 'filename', 'modified' ] ] |
|
275 |
+ \ }, |
|
276 |
+ \ 'component_function': { |
|
277 |
+ \ 'gitbranch': 'FugitiveHead' |
|
278 |
+ \ }, |
|
279 |
+ \ } |
|
280 |
+ |
|
281 |
+ |
|
282 |
+" |
|
283 |
+" INDENTATION & AUTOCOMPLETION |
|
284 |
+" |
|
285 |
+ |
|
286 |
+"indent settings |
|
287 |
+set shiftwidth=2 |
|
288 |
+set tabstop=2 |
|
289 |
+set softtabstop=2 |
|
290 |
+set expandtab |
|
291 |
+set autoindent |
|
292 |
+"set noautoindent |
|
293 |
+"set nocindent |
|
294 |
+"set nosmartindent |
|
295 |
+"set indentexpr= |
|
296 |
+"filetype indent plugin off |
|
297 |
+ |
|
298 |
+ |
|
299 |
+filetype plugin on |
|
300 |
+set omnifunc=syntaxcomplete#Complete |
|
301 |
+set completeopt=menuone |
|
302 |
+"set completeopt=longest,menu,preview |
|
303 |
+ |
|
304 |
+ |
|
305 |
+ |
|
306 |
+"fold settings |
|
307 |
+set foldcolumn=3 |
|
308 |
+set foldmethod=manual |
|
309 |
+"set foldlevel=99 |
|
310 |
+set foldlevelstart=99 |
|
311 |
+autocmd BufWinLeave *.php,*.htm,*.html,*.css,*.c,*.cc,*.h,*.cpp,*.py,*.rb,*.js mkview |
|
312 |
+autocmd BufWinEnter *.php,*.htm,*.html,*.css,*.c,*.cc,*.h,*.cpp,*.py,*.rb,*.js silent loadview |
|
313 |
+ |
|
314 |
+ |
|
315 |
+ |
|
316 |
+ |
|
317 |
+ |
|
318 |
+ |
|
319 |
+" |
|
320 |
+" CONF DES PLUGINS |
|
321 |
+" |
|
322 |
+ |
|
323 |
+let NERDTreeQuitOnOpen=1 |
|
324 |
+let NERDTreeShowHidden=1 |
|
325 |
+ |
|
326 |
+let g:syntastic_always_populate_loc_list = 1 |
|
327 |
+let g:syntastic_check_on_open = 1 |
|
328 |
+let g:syntastic_check_on_wq = 0 |
|
329 |
+ |
|
330 |
+let g:startify_session_persistence = 1 |
|
331 |
+let g:startify_enable_special = 0 |
|
332 |
+let g:startify_files_number = 10 |
|
333 |
+let g:startify_relative_path = 0 |
|
334 |
+let g:startify_change_to_dir = 1 |
|
335 |
+let g:startify_update_oldfiles = 1 |
|
336 |
+let g:startify_session_autoload = 1 |
|
337 |
+let g:startify_custom_header = 'startify#pad([ " VIM - STARTIFY"] + [" [e] Empty file" ])' |
|
338 |
+let g:startify_lists = [ |
|
339 |
+ \ { 'type': 'sessions', 'header': [' Sessions'] }, |
|
340 |
+ \ { 'type': 'files', 'header': [' MRU'] }, |
|
341 |
+ \ { 'type': 'dir', 'header': [' MRU '. getcwd()] }, |
|
342 |
+ \ { 'type': 'bookmarks', 'header': [' Bookmarks'] }, |
|
343 |
+ \ { 'type': 'commands', 'header': [' Commands'] }, |
|
344 |
+ \ ] |
|
345 |
+let g:startify_session_before_save = [ |
|
346 |
+ \ 'echo "Cleaning up before saving.."', |
|
347 |
+ \ 'silent! NERDTreeTabsClose' |
|
348 |
+ \ ] |
|
349 |
+ |
|
350 |
+ |
|
351 |
+function! SessionCreate() |
|
352 |
+ if empty(v:this_session) |
|
353 |
+ if tabpagenr("$") > 1 |
|
354 |
+ SSave! |
|
355 |
+ endif |
|
356 |
+ endif |
|
357 |
+endfunction |
|
358 |
+ |
|
359 |
+ |
|
360 |
+let g:gitgutter_terminal_reports_focus = 0 |
|
361 |
+let g:gitgutter_async = 0 |
|
362 |
+autocmd BufWritePost * GitGutter |
|
363 |
+ |
|
364 |
+ |
|
365 |
+ |
|
366 |
+"let g:tagbar_autofocus=1 |
|
367 |
+ |
|
368 |
+ |
|
369 |
+ |
|
370 |
+" |
|
371 |
+" RACCOURCIS CLAVIER |
|
372 |
+" |
|
373 |
+ |
|
374 |
+set whichwrap=<,>,[,] " Autorise le passage d'une ligne � l'autre avec les fl�ches gauche et droite |
|
375 |
+ |
|
376 |
+" Definition de la touche <leader> |
|
377 |
+let g:mapleader = " " |
|
378 |
+ |
|
379 |
+ |
|
380 |
+ |
|
381 |
+"map <C-x> :TagbarToggle<CR> |
|
382 |
+ |
|
383 |
+map ; A;<ESC> |
|
384 |
+ |
|
385 |
+" Cree un fold du prochain/precedent {, jusqu'au } de fermeture |
|
386 |
+"map <C-f> f{zf%za |
|
387 |
+nmap <C-f> ?{<CR>zf%za:noh<CR> |
|
388 |
+nmap <leader><Down> /{<CR>zf%za:noh<CR> |
|
389 |
+nnoremap <leader><Up> ?{<CR>zf%za:noh<CR> |
|
390 |
+" Toggle le fold en cours |
|
391 |
+nmap <F9> za |
|
392 |
+" Ouvre tous les folds |
|
393 |
+nnoremap <leader><PageDown> zR |
|
394 |
+" Ferme tous les folds |
|
395 |
+nnoremap <leader><PageUp> zM |
|
396 |
+ |
|
397 |
+" Infos de syntaxe |
|
398 |
+nmap <F7> :SyntasticInfo<CR> |
|
399 |
+nmap <F8> :Errors<CR> |
|
400 |
+ |
|
401 |
+ |
|
402 |
+ |
|
403 |
+" Change l'indentation |
|
404 |
+nnoremap <leader><Right> >> |
|
405 |
+vnoremap <leader><Right> >gv |
|
406 |
+nnoremap <leader><Left> << |
|
407 |
+vnoremap <leader><Left> <gv |
|
408 |
+vnoremap < <gv |
|
409 |
+vnoremap > >gv |
|
410 |
+ |
|
411 |
+" Quitte quand plusieurs onglets sont ouverts, et cree une session si elle n'existe pas |
|
412 |
+noremap <leader>q :call SessionCreate()<CR>:qa<CR> |
|
413 |
+" Supprime la session en cours |
|
414 |
+noremap <leader>d :SDelete<CR> |
|
415 |
+ |
|
416 |
+" Enregistre tous les onglets en meme temps |
|
417 |
+noremap <leader>w :wa<CR> |
|
418 |
+ |
|
419 |
+" Commente la ligne courante |
|
420 |
+autocmd VimEnter *.php,*.js,*.c,*.cc,*.h,*.cpp noremap <leader><leader> 0i//<ESC> |
|
421 |
+autocmd VimEnter *.sh noremap <leader><leader> 0i#<ESC> |
|
422 |
+ |
|
423 |
+" Affiche/Cache l'explorateur NerdTree |
|
424 |
+noremap <leader>e :NERDTreeToggle<CR> |
|
425 |
+ |
|
426 |
+ |
|
427 |
+" Creer un nouveau tab et ouvre l'explorateur NerdTree |
|
428 |
+noremap <leader>t :$tabe<CR>:NERDTreeToggle<CR> |
|
429 |
+noremap <F3> :$tabe<CR>:NERDTreeToggle<CR> |
|
430 |
+inoremap <F3> <ESC>:$tabe<CR>:NERDTreeToggle<CR> |
|
431 |
+" Passer au precedent/suivant tab |
|
432 |
+noremap <F2> gT |
|
433 |
+inoremap <F2> <Esc>gT |
|
434 |
+noremap <F4> gt |
|
435 |
+inoremap <F4> <Esc>gt |
|
436 |
+" Deplacer le tab courant vers la gauche/droite |
|
437 |
+noremap <leader><F2> :tabm -1<CR> |
|
438 |
+noremap <leader><F4> :tabm +1<CR> |
|
439 |
+ |
|
440 |
+imap <F10> <C-x><C-o> |
|
441 |
+ |
|
442 |
+" Desactive l'autoindent le temps d'un copier-coller |
|
443 |
+set pastetoggle=<F12> |
|
444 |
+ |
|
445 |
+" Clear search highlighting |
|
446 |
+nnoremap <Esc><Esc> :noh<CR> |
|
447 |
+ |
|
448 |
+ |
|
449 |
+map <F6> :Magit<CR> |
|
450 |
+imap <F6> <Esc>:Magit<CR> |
|
451 |
+ |
|
452 |
+ |
|
453 |
+ |
|
454 |
+" Autocompletion avec la touche <TAB> |
|
455 |
+function! Smart_TabComplete() |
|
456 |
+ let line = getline('.') " current line |
|
457 |
+ |
|
458 |
+ let substr = strpart(line, -1, col('.')+1) " from the start of the current |
|
459 |
+ " line to one character right |
|
460 |
+ " of the cursor |
|
461 |
+ let substr = matchstr(substr, "[^ \t]*$") " word till cursor |
|
462 |
+ if (strlen(substr)==0) " nothing to match on empty string |
|
463 |
+ return "\<tab>" |
|
464 |
+ endif |
|
465 |
+ let has_slash = match(substr, '\/') != -1 " position of slash, if any |
|
466 |
+ if (has_slash) |
|
467 |
+ return "\<C-X>\<C-F>" " file matching |
|
468 |
+ else |
|
469 |
+ return "\<C-X>\<C-O>" " plugin matching |
|
470 |
+ endif |
|
471 |
+endfunction |
|
472 |
+inoremap <tab> <c-r>=Smart_TabComplete()<CR> |
|
473 |
+ |
|
474 |
+ |
|
475 |
+ |