Hi,

Tony Mechelynck wrote:
> On 20/08/08 10:56, Jürgen Krämer wrote:
>> 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.
> 
> IIUC, it's because the colorschemes are listed in the order encountered, 
> i.e., the order of the trees in 'runtimepath'. (The same applies to the 
> keymap menu.)

yes, globpath() returns the result grouped by the directories in its
first argument. For each directory they seem to be sorted, but that
might depend on the underlying run-time functions, API routines, or file
systems.

> This means that on an installation like mine, with only a 
> few owncoded colorschemes and keymaps, they will occupy a prominent 
> location at the top of the list, with the default ones (distributed with 
> Vim) afterwards. I like that.

The sort() used in the patch is not really necessary; I just thought the
result looked cleaner, but that depends on what somebody is used to. I
haven't used the menu for selecting a color scheme till now and I doubt
I will ever do so -- with 336 entries it's just to full and cumbersome
to use if I want to set a color scheme starting with "D" or higher.

The patch was mainly intended to solve the problem of incorrect
amenu-commands if the list of file names got split at an unsuitable
position. Rewriting it to use a list was just to make the code look
cleaner and sorting the list was only a minor additional step.

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
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui