diff --git a/.github/workflows/buildtest.yml b/.github/workflows/buildtest.yml index b094c4895..3f0a550da 100644 --- a/.github/workflows/buildtest.yml +++ b/.github/workflows/buildtest.yml @@ -10,25 +10,21 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-latest] - vim: [v8.2.0020, v9.0.0107, head] + vim: [v9.0.0107, v9.1.0100 ,head] type: [vim, macvim] download: [available] exclude: - os: ubuntu-latest # linux only vim/ macvim run as mac os type: macvim - - os: macos-latest - type: vim - # v8.2.1310 or later is required to build on macos-latest - vim: v8.2.0020 - os: macos-latest type: macvim # macvim only head - vim: v8.2.0020 + vim: v9.0.0107 - os: macos-latest type: macvim # macvim only head - vim: v9.0.0107 + vim: v9.1.0100 runs-on: ${{ matrix.os }} name: ${{ matrix.type }} ${{ matrix.vim }}/${{ matrix.os }} test env: @@ -139,7 +135,7 @@ jobs: fail-fast: false matrix: os: [windows-latest] - vim: [v8.2.0020, v9.0.0107, head] + vim: [v9.0.0107, v9.1.0100 ,head] type: [vim] download: [available] runs-on: ${{ matrix.os }} diff --git a/README.md b/README.md index 0000aedbc..820467bd2 100644 --- a/README.md +++ b/README.md @@ -6,10 +6,10 @@ A comprehensive Vim utility functions for Vim plugins. ## Requirements -Modules in vital.vim basically support Vim 8.2 or later. +Modules in vital.vim basically support Vim 9.0 or later. We guarantee that the following versions of Vim are supported: -* The latest major version (9.0.\*) -* The previous major version (8.2.\*) +* The latest major version (9.1.\*) +* The previous major version (9.0.\*) And some modules have stricter requirements and additional dependencies. Please read the docs of each module before using them. diff --git a/autoload/vital/__vital__/Bitwise.vim b/autoload/vital/__vital__/Bitwise.vim index 487deb567..feee04448 100644 --- a/autoload/vital/__vital__/Bitwise.vim +++ b/autoload/vital/__vital__/Bitwise.vim @@ -24,34 +24,13 @@ function! s:compare(a, b) abort endif endfunction -if has("patch-8.2.5003") - function! s:lshift(a, n) abort - return a:a << and(a:n, s:mask) - endfunction - - function! s:rshift(a, n) abort - return a:a >> and(a:n, s:mask) - endfunction -else - let s:pow2 = [1] - for s:i in range(s:mask) - call add(s:pow2, s:pow2[-1] * 2) - endfor - unlet s:i - - let s:min = s:pow2[-1] - - function! s:lshift(a, n) abort - return a:a * s:pow2[and(a:n, s:mask)] - endfunction +function! s:lshift(a, n) abort + return a:a << and(a:n, s:mask) +endfunction - function! s:rshift(a, n) abort - let n = and(a:n, s:mask) - return n == 0 ? a:a : - \ a:a < 0 ? (a:a - s:min) / s:pow2[n] + s:pow2[-2] / s:pow2[n - 1] - \ : a:a / s:pow2[n] - endfunction -endif +function! s:rshift(a, n) abort + return a:a >> and(a:n, s:mask) +endfunction " 32bit or 64bit specific method " define sign_extension @@ -60,11 +39,7 @@ if has('num64') " NOTE: " An int literal larger than or equal to 0x8000000000000000 will be rounded " to 0x7FFFFFFFFFFFFFFF after Vim 8.0.0219, so create it without literal - if has("patch-8.2.5003") - let s:xFFFFFFFF00000000 = 0xFFFFFFFF << and(32, s:mask) - else - let s:xFFFFFFFF00000000 = 0xFFFFFFFF * s:pow2[and(32, s:mask)] - endif + let s:xFFFFFFFF00000000 = 0xFFFFFFFF << and(32, s:mask) function! s:sign_extension(n) abort if and(a:n, 0x80000000) return or(a:n, s:xFFFFFFFF00000000) diff --git a/autoload/vital/__vital__/Color.vim b/autoload/vital/__vital__/Color.vim index 216ff17ae..f3f8c3644 100644 --- a/autoload/vital/__vital__/Color.vim +++ b/autoload/vital/__vital__/Color.vim @@ -60,7 +60,6 @@ endfunction let s:RGB_HEX_RE = '\v^#(\x{3}(\x{3})?)$' let s:RGB_RE = '\v^rgb\((\d+\%?),\s*(\d+\%?),\s*(\d+\%?)\)$' let s:HSL_RE = '\v^hsl\((\d+),\s*(\d+)\%,\s*(\d+)\%\)$' -let s:VIM_RGB_FILE = expand('$VIMRUNTIME/rgb.txt') function! s:parse(str) abort if type(a:str) !=# type('') throw 'vital: Color: parse(): invalid value type: ' . string(a:str) @@ -89,20 +88,11 @@ function! s:parse(str) abort return s:hsl(h, s, l) endif " e.g. DarkGray - if exists('v:colornames') " after patch 8.2.3562 - let name = s:_normalize_color_name(a:str) - if has_key(v:colornames, name) - let m = matchlist(v:colornames[name], s:RGB_HEX_RE) - let [r, g, b] = [str2float('0x' . m[1][0:1]), str2float('0x' . m[1][2:3]), str2float('0x' . m[1][4:5])] - return s:rgb(r, g, b) - endif - elseif filereadable(s:VIM_RGB_FILE) - let color_map = s:_parse_rgb_file(s:VIM_RGB_FILE) - let name = s:_normalize_color_name(a:str) - if has_key(color_map, name) - let [r, g, b] = color_map[name] - return s:rgb(r, g, b) - endif + let name = s:_normalize_color_name(a:str) + if has_key(v:colornames, name) + let m = matchlist(v:colornames[name], s:RGB_HEX_RE) + let [r, g, b] = [str2float('0x' . m[1][0:1]), str2float('0x' . m[1][2:3]), str2float('0x' . m[1][4:5])] + return s:rgb(r, g, b) endif throw 'vital: Color: parse(): invalid format: ' . a:str endfunction diff --git a/autoload/vital/__vital__/Data/List/Byte.vim b/autoload/vital/__vital__/Data/List/Byte.vim index 3c05d7b32..ba847cbd9 100644 --- a/autoload/vital/__vital__/Data/List/Byte.vim +++ b/autoload/vital/__vital__/Data/List/Byte.vim @@ -27,19 +27,11 @@ function! s:validate(data) abort endfunction function! s:from_blob(blob) abort - if exists('*blob2list') " add 8.2.3438 - return blob2list(a:blob) - else - return s:List.new(len(a:blob), {i -> a:blob[i]}) - endif + return blob2list(a:blob) endfunction function! s:to_blob(bytes) abort - if exists('*list2blob') " add 8.2.3438 - return list2blob(a:bytes) - else - return eval('0z' . s:to_hexstring(a:bytes)) - endif + return list2blob(a:bytes) endfunction function! s:from_string(str) abort diff --git a/autoload/vital/__vital__/Deprecated/Text/Sexp.vim b/autoload/vital/__vital__/Deprecated/Text/Sexp.vim index 1b5daf1df..55d876e78 100644 --- a/autoload/vital/__vital__/Deprecated/Text/Sexp.vim +++ b/autoload/vital/__vital__/Deprecated/Text/Sexp.vim @@ -25,11 +25,8 @@ function! s:_vital_depends() abort endfunction " lua array index as 0 based. -let s:_base = 0 -if has('patch-8.2.1066') - " fix lua array index as 1 based. - let s:_base = 1 -endif +" after patch-8.2.1066, fix lua array index as 1 based. +let s:_base = 1 function! s:_index(idx) abort return printf('%d', s:_base + a:idx) endfunction diff --git a/autoload/vital/__vital__/System/Filepath.vim b/autoload/vital/__vital__/System/Filepath.vim index fa1254f9b..2e26a1a06 100644 --- a/autoload/vital/__vital__/System/Filepath.vim +++ b/autoload/vital/__vital__/System/Filepath.vim @@ -280,22 +280,9 @@ function! s:contains(path, base) abort return pathlist[: baselistlen - 1] ==# baselist endfunction -if exists('+completeslash') - " completeslash bug in Windows and specific version range (Vim 8.1.1769 - Vim 8.2.1746) - function! s:expand(path) abort - let backup_completeslash = &completeslash - try - set completeslash& - return expand(a:path) - finally - let &completeslash = backup_completeslash - endtry - endfunction -else - function! s:expand(path) abort - return expand(a:path) - endfunction -endif +function! s:expand(path) abort + return expand(a:path) +endfunction let &cpo = s:save_cpo unlet s:save_cpo diff --git a/doc/vital.txt b/doc/vital.txt index f130f77f5..be4faa3bb 100644 --- a/doc/vital.txt +++ b/doc/vital.txt @@ -25,10 +25,10 @@ jQuery at the same time. If you are a Vim user who doesn't make Vim plugins, please ignore this page. If you are a Vim plugin author, please check this out. -Modules in vital.vim basically support Vim 8.2 or later. +Modules in vital.vim basically support Vim 9.0 or later. We guarantee that the following versions of Vim are supported: -* The latest major version (9.0.*) -* The previous major version (8.2.*) +* The latest major version (9.1.*) +* The previous major version (9.0.*) And some modules have stricter requirements and additional dependencies. Please read the docs of each module before using them. diff --git a/test/Data/String/Interpolation.vimspec b/test/Data/String/Interpolation.vimspec index 556e11094..a2ba589aa 100644 --- a/test/Data/String/Interpolation.vimspec +++ b/test/Data/String/Interpolation.vimspec @@ -51,11 +51,7 @@ Describe Data.String.Interpolation End It handle reassignment different type Assert Equals(g:I.interpolate('${a} ${b}', {'a': 1, 'b': '1'}), '1 1') - if !has('patch-8.2.2948') - Throws /Vim(let):E806:/ g:I.interpolate('${a} ${b}', {'a': 1, 'b': 1.0E-6}) - else - Assert Equals(g:I.interpolate('${a} ${b}', {'a': 1, 'b': 1.0E-6}), '1 1.0e-6') - endif + Assert Equals(g:I.interpolate('${a} ${b}', {'a': 1, 'b': 1.0E-6}), '1 1.0e-6') End It doesn't raise Vim(let):E704: Funcref variable name must start with a capital Throws /Vim(let):E729:/ g:I.interpolate('${Funcref}', {'Funcref': function('InterpolationFunc')}) diff --git a/test/Deprecated/Text/Sexp.vim b/test/Deprecated/Text/Sexp.vim index 6f7923925..30db45443 100644 --- a/test/Deprecated/Text/Sexp.vim +++ b/test/Deprecated/Text/Sexp.vim @@ -19,13 +19,7 @@ function! s:suite.parse() if !s:has_lua call s:assert.skip('Vital.Deprecated.Text.Sexp: any function call needs if_lua') endif - if has('patch-8.2.0775') - call s:assert.equals( - \ s:S.parse('(a b c)'), - \ [[{'label': 'identifier', 'col': 2, 'matched_text': 'a'}, {'label': 'whitespace', 'col': 3, 'matched_text': ' '}, {'label': 'identifier', 'col': 4, 'matched_text': 'b'}, {'label': 'whitespace', 'col': 5, 'matched_text': ' '}, {'label': 'identifier', 'col': 6, 'matched_text': 'c'}]]) - else - call s:assert.equals( - \ s:S.parse('(a b c)'), - \ [[{'label': 'identifier', 'col': 2.0, 'matched_text': 'a'}, {'label': 'whitespace', 'col': 3.0, 'matched_text': ' '}, {'label': 'identifier', 'col': 4.0, 'matched_text': 'b'}, {'label': 'whitespace', 'col': 5.0, 'matched_text': ' '}, {'label': 'identifier', 'col': 6.0, 'matched_text': 'c'}]]) - endif + call s:assert.equals( + \ s:S.parse('(a b c)'), + \ [[{'label': 'identifier', 'col': 2, 'matched_text': 'a'}, {'label': 'whitespace', 'col': 3, 'matched_text': ' '}, {'label': 'identifier', 'col': 4, 'matched_text': 'b'}, {'label': 'whitespace', 'col': 5, 'matched_text': ' '}, {'label': 'identifier', 'col': 6, 'matched_text': 'c'}]]) endfunction