Browse code

Correction d'erreurs du vimrc

schardon authored on 21/04/2020 19:53:35
Showing 2 changed files
... ...
@@ -8,6 +8,7 @@ https://learngitbranching.js.org/?locale=fr_FR
8 8
 mkdir <projet>
9 9
 cd <projet>
10 10
 git init
11
+vim .git/description
11 12
 
12 13
 ** EVOLUTION **
13 14
 git add
... ...
@@ -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