On 26-Feb-09 22:40, Tony Mechelynck wrote:
> On 26/02/09 14:55, Ingo Karkat wrote:
> [...]
>> I respect your opinion, but I think the policy that Tony has outlined is 
>> worth
>> considering, as it simplifies the source code and eases maintenance and 
>> testing
>> (if that is done at all for older versions ;-). Being an avid vimscript 
>> writer
>> myself, I know how difficult it is to balance backwards compatibility (up to 
>> VIM
>> 7.0? or even 6.4 or 6.0?) with use of the latest features. We're all 
>> interested
>> in a stable runtime, and that is best achieved with a simple and 
>> straightforward
>> implementation.
>>
>> -- regards, ingo
>>
> 
> I am _not_ advocating support of only the latest version in scripts not 
> distributed together with Vim. If you write plugins for public use, I 
> recommend that you make them as portable as you can, be it for platforms 
> other than yours, for smaller featuresets than what you're usually 
> running, and for earlier versions of Vim. There are several tools to do 
> that, namely has() for OSes and featuresets, exists() for individual 
> commands, functions and options, v:version (or, more portable, just 
> version) for major and minor version, has() (again) for patchlevel 
> within a given minor version, and, not to be forgotten, ":if 1" actually 
> tests for +eval.
> 
> The helpfiles version4.txt to version7.txt will help you find out at 
> which point a given feature or capability (not necessarily covered by 
> has() and exists() ) was introduced.
> 
> I'm attaching a small plugin which I wrote some time ago to try to make 
> the "Vim splash screen" appear even in some circumstances where 
> plain-vanilla Vim doesn't display it: you'll notice to what lengths I 
> went to avoid errors in any (even far obsolete) versions where you might 
> try to use it. If you want to run it, I recommend that you drop it into 
> ~/.vim/after/plugin (Unix) or ~/vimfiles/after/plugin (Windows) so that 
> it can run after all other global plugins. (Its name begins with zz so 
> that, in Linux at least, it will be listed last in its directory.)

Yep, Tony, I'm in violent agreement with you :-) I only propose that the VIM 
_runtime_ doesn't need to support outdated VIM versions, since the runtime can 
be tightly bound to the particular VIM version. OTOH, _plugins_ are only 
loosely 
associated with the VIM version; I myself share my $HOME/.vim directory among a 
handful of Windows and Linux boxes, not all of which have the latest VIM 
version 
available.

So in the spirit of sharing and learning from each other that you've so 
graciously started, let me reciprocate with one of my scripts that I use to 
detect old VIM versions and then source archived plugin versions that still 
support that VIM version. (It seems that you're going out of your way to 
support 
old versions; not all plugin authors are so diligent.)

-- best regards, ingo

-- 
   -- Ingo Karkat -- /^-- /^-- /^-- /^-- /^-- /^-- http://ingo-karkat.de/ --

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

" 00oldvimsupport.vim: uses older plugin versions for outdated VIM versions. 
"
" Outdated script versions have a different file extension, so that they aren't
" loaded during VIM startup, only on demand by this script: 
"   runtime plugin/<pluginname>.vim<oldest supported version number>
" That doesn't work for autoload scripts, where the name must match the autoload
" name, and (apparently) the file extension must be '.vim'. So for autoload
" scripts we use
"   runtime autoload/<oldest supported version number>/<pluginname>.vim
"
" Maintainer:   Ingo Karkat <[email protected]>

" Avoid installing twice or when in compatible mode
if exists('g:loaded_00oldvimsupport')
    finish
endif
let g:loaded_00oldvimsupport = 1

let s:latestVimVersion = 702

function! s:EchoWarning( message )
    execute 'autocmd VimEnter * echohl WarningMsg | let v:warningmsg = "' . 
a:message . '"| echomsg v:warningmsg | echohl None'
endfunction

if v:version < s:latestVimVersion
    call s:EchoWarning("This is an outdated VIM version " . v:version . ".")
elseif v:version > s:latestVimVersion
    call s:EchoWarning(expand('<sfile>:t') . " doesn't know about this new VIM 
version " . v:version . "; please update it!")
endif


if v:version < 600
    " VIM 5.x
elseif v:version < 700
    " VIM 6.x
    let g:autoclose_loaded = 1
    let g:loaded_autocomplpop = 1
    runtime plugin/a.vim600
    let g:loaded_fuzzyfinder = 1
    runtime plugin/javabrowser.vim600
    let g:loaded_loremipsum = 1
    runtime plugin/MruMenu.vim600
    runtime plugin/mswin.vim600
    let g:loaded_multiselect = 1
    runtime plugin/NERD_commenter.vim600
    let g:loaded_netrwPlugin = 1
    let g:loaded_swapit = 1
    let g:loaded_ZoomWinPlugin = 1

    if v:version < 602
        " VIM 6.0, 6.1
        let g:loaded_align = 1
        let g:loaded_alignmaps = 1
        runtime plugin/genutils.vim600
        let g:loaded_foldutil = 1 " This one has a dependency to genutils.vim
        let g:loaded_greputils = 1
        runtime plugin/mru.vim600
        let g:loaded_netrw = 1
        let g:loaded_NetrwFileHandlers = 1
        let g:loaded_NetrwSettings = 1
        let g:loaded_ZoomWin = 1
    elseif v:version < 603
        " VIM 6.2
        runtime plugin/genutils.vim602
        let g:loaded_foldutil = 1 " This one has a dependency to genutils.vim
        let g:loaded_greputils = 1
        runtime plugin/mru.vim602
        let g:loaded_netrw = 1
        let g:loaded_NetrwFileHandlers = 1
        let g:loaded_NetrwSettings = 1
        runtime plugin/redocommand.vim602
        runtime plugin/writebackup.vim602
        runtime plugin/ZoomWin.vim602
    else
        " VIM 6.3
        runtime plugin/genutils.vim603
        runtime plugin/foldutil.vim603 " This one has a dependency to 
genutils.vim
        runtime plugin/greputils.vim603
        runtime plugin/mru.vim602
        runtime plugin/netrw.vim603
        runtime plugin/NetrwFileHandlers.vim603
        runtime plugin/NetrwSettings.vim603
        runtime plugin/writebackup.vim602
        runtime plugin/ZoomWin.vim602
    endif
else
    " VIM 7.x
    if v:version < 701
        " VIM 7.0
        let g:loaded_fuzzyfinder = 1
        let g:loaded_autocomplpop = 1
        runtime plugin/netrwPlugin.vim700
        runtime autoload/700/netrw.vim
        runtime autoload/700/netrwFileHandlers.vim
        runtime autoload/700/netrwSettings.vim
        runtime autoload/700/vimball.vim
        runtime plugin/vimballPlugin.vim700
        runtime autoload/700/vimball.vim
        runtime plugin/ZoomWin.vim602
        let g:loaded_ZoomWinPlugin = 1
    elseif v:version < 702
        " VIM 7.1
        runtime plugin/netrwPlugin.vim700
        runtime autoload/700/netrw.vim
        runtime autoload/700/netrwFileHandlers.vim
        runtime autoload/700/netrwSettings.vim
        runtime autoload/700/vimball.vim
        runtime plugin/vimballPlugin.vim700
        runtime autoload/700/vimball.vim
        runtime plugin/ZoomWin.vim602
        let g:loaded_ZoomWinPlugin = 1
    endif
endif

Raspunde prin e-mail lui