... | ... |
@@ -49,7 +49,6 @@ majutsushi/tagbar -- Menu de ctags |
49 | 49 |
cohama/lexima.vim -- Clos auto les {([ ... |
50 | 50 |
honza/vim-snippets -- Gestion de snippets (template de bouts de code) |
51 | 51 |
Valloric/YouCompleteMe -- Autocompletion |
52 |
-spell correction orthographe |
|
53 | 52 |
mbbill/undotree |
54 | 53 |
|
55 | 54 |
|
... | ... |
@@ -145,4 +144,8 @@ mbbill/undotree |
145 | 144 |
<leader>hs -- Stage la modif |
146 | 145 |
<leader>hu -- Annuler la modif |
147 | 146 |
|
147 |
+** Spell : Correction orth |
|
148 |
+ <F11> -- Active/Desactive/Switch entre les langues |
|
149 |
+ <TAB> -- Completer/Corriger un mot |
|
150 |
+ |
|
148 | 151 |
|
... | ... |
@@ -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 |
- |