yegappan / fileselect

File Selector Vim Plugin
BSD 2-Clause "Simplified" License
18 stars 2 forks source link

Prevent vim9script errors in older vim versions #20

Closed mvarelaf closed 2 years ago

mvarelaf commented 2 years ago

Using the plugin with an older version of vim, 8.2 without patches in my case, gives these errors:

line 1: E683: File name missing or invalid pattern line 3: E488: Trailing characters: # File: fileselect.vim line 4: E488: Trailing characters: # Author: Yegappan Lakshmanan (yegappan AT yahoo DOT com) line 5: E488: Trailing characters: # Version: 1.2 line 6: E488: Trailing characters: # Last Modified: Jan 4, 2021 etc...

Moving this check to the top of plugin\fileselect.vim fixes the issue:

" Need Vim 8.2.2261 and higher
if !has('patch-8.2.2261')
  finish
endif

Standard documentation (:help vim9-mix) suggest to use:

if !has('vim9script')
   finish
endif

But this was included in patch 8.2.2529 and would bump up the minimal required version mentioned in README.

yegappan commented 2 years ago

Thanks for reporting the issue. Committed d20310d043fd37e7eb1721953c9fec7cb11015f8 to address this.