Hi,
I have a lot of color schemes below ~/.vim/colors and ~ expands to
C:\Dokumente und Einstellungen\jkr.HABEL, so the execution of
let s:n = globpath(&runtimepath, "colors/*.vim")
in $VIMRUNTIME/menu.vim returns a really long string (22881 chars, to be
exact). Currenty the loop which constructs the Edit.Color Scheme submenu
extracts the chars up to the first new line in s:n and then overwrites
s:n with the next 19999 characters of its original value. For long paths
and many color schemes this can result in missing entries in the Color
Scheme submenu; in the worst case the loop constructs an illegal
:execute-command and the execution of menu.vim is aborted.
Possible solution: Use a higher value instead of 19999, say 64 * 1024.
This should be sufficient, but there is a second thing I didn't like:
personal color schemes and the ones in $VIMRUNTIME/colors are sorted
independently, so Vim's "blue" color scheme is close to the end of the
sub menu.
The solution I implemented now uses a list that holds the sorted color
scheme names, and the loop that constructs the submenu iterates through
this list.
Regards,
Jürgen
--
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---
*** runtime\menu.vim.orig 2008-08-20 09:36:56.765625000 +0200
--- runtime\menu.vim 2008-08-20 10:12:17.062500000 +0200
***************
*** 338,361 ****
" Setup the Edit.Color Scheme submenu
let s:n = globpath(&runtimepath, "colors/*.vim")
let s:idx = 100
! while strlen(s:n) > 0
! let s:i = stridx(s:n, "\n")
! if s:i < 0
! let s:name = s:n
! let s:n = ""
! else
! let s:name = strpart(s:n, 0, s:i)
! let s:n = strpart(s:n, s:i + 1, 19999)
! endif
! " Ignore case for VMS and windows
! let s:name = substitute(s:name, '\c.*[/\\:\]]\([^/\\:]*\)\.vim', '\1', '')
exe "an 20.450." . s:idx . ' &Edit.C&olor\ Scheme.' . s:name . " :colors "
. s:name . "<CR>"
- unlet s:name
- unlet s:i
let s:idx = s:idx + 10
! endwhile
unlet s:n
unlet s:idx
" Setup the Edit.Keymap submenu
--- 338,353 ----
" Setup the Edit.Color Scheme submenu
let s:n = globpath(&runtimepath, "colors/*.vim")
+ " Ignore case for VMS and windows
+ let s:names = sort(map(split(s:n, "\n"), 'substitute(v:val,
"\\c.*[/\\\\:\\]]\\([^/\\\\:]*\\)\\.vim", "\\1", "")'), 1)
let s:idx = 100
! for s:name in ( s:names )
exe "an 20.450." . s:idx . ' &Edit.C&olor\ Scheme.' . s:name . " :colors "
. s:name . "<CR>"
let s:idx = s:idx + 10
! endfor
unlet s:n
+ unlet s:name
+ unlet s:names
unlet s:idx
" Setup the Edit.Keymap submenu