Mercurial > vim
comparison runtime/menu.vim @ 2325:f177a6431514 vim73
Better implementation of creating the Color Scheme menu. (Juergen Kraemer)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Sat, 17 Jul 2010 15:20:30 +0200 |
parents | e0fabd886db6 |
children | 12f838be9c59 |
comparison
equal
deleted
inserted
replaced
2324:0a258a67051d | 2325:f177a6431514 |
---|---|
335 elseif n == 3 | 335 elseif n == 3 |
336 set ff=mac | 336 set ff=mac |
337 endif | 337 endif |
338 endfun | 338 endfun |
339 | 339 |
340 | |
340 " Setup the Edit.Color Scheme submenu | 341 " Setup the Edit.Color Scheme submenu |
342 | |
343 " get NL separated string with file names | |
341 let s:n = globpath(&runtimepath, "colors/*.vim") | 344 let s:n = globpath(&runtimepath, "colors/*.vim") |
345 | |
346 " split at NL, Ignore case for VMS and windows, sort on name | |
347 let s:names = sort(map(split(s:n, "\n"), 'substitute(v:val, "\\c.*[/\\\\:\\]]\\([^/\\\\:]*\\)\\.vim", "\\1", "")'), 1) | |
348 | |
349 " define all the submenu entries | |
342 let s:idx = 100 | 350 let s:idx = 100 |
343 while strlen(s:n) > 0 | 351 for s:name in s:names |
344 let s:i = stridx(s:n, "\n") | |
345 if s:i < 0 | |
346 let s:name = s:n | |
347 let s:n = "" | |
348 else | |
349 let s:name = strpart(s:n, 0, s:i) | |
350 let s:n = strpart(s:n, s:i + 1, 19999) | |
351 endif | |
352 " Ignore case for VMS and windows | |
353 let s:name = substitute(s:name, '\c.*[/\\:\]]\([^/\\:]*\)\.vim', '\1', '') | |
354 exe "an 20.450." . s:idx . ' &Edit.C&olor\ Scheme.' . s:name . " :colors " . s:name . "<CR>" | 352 exe "an 20.450." . s:idx . ' &Edit.C&olor\ Scheme.' . s:name . " :colors " . s:name . "<CR>" |
355 unlet s:name | |
356 unlet s:i | |
357 let s:idx = s:idx + 10 | 353 let s:idx = s:idx + 10 |
358 endwhile | 354 endfor |
359 unlet s:n | 355 unlet s:name s:names s:n s:idx |
360 unlet s:idx | 356 |
361 | 357 |
362 " Setup the Edit.Keymap submenu | 358 " Setup the Edit.Keymap submenu |
363 if has("keymap") | 359 if has("keymap") |
364 let s:n = globpath(&runtimepath, "keymap/*.vim") | 360 let s:n = globpath(&runtimepath, "keymap/*.vim") |
365 if s:n != "" | 361 if s:n != "" |