... | ... |
@@ -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 |