Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support version up to Vim 9.1 and drop Vim 8.2. #828

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions .github/workflows/buildtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Copy link
Contributor Author

@tsuyoshicho tsuyoshicho Jan 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

9.1.0000 は linux で色データのマッチが不正になってしまうので、9.1.0100 としました

  • 現在 runtime/colors/lists/default.vim に色データはあります(lowercase)
  • Color.vim は検索時にlowercaseに整理してして行います
  • データとしてYellow(yellow)は常にありますが、失敗しています

問題が修正されたパッチを見付けれられなかったので、ほどほど後のバージョンをとりあえずで決めて入れています

see link

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:
Expand Down Expand Up @@ -123,7 +119,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 }}
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
39 changes: 7 additions & 32 deletions autoload/vital/__vital__/Bitwise.vim
Original file line number Diff line number Diff line change
Expand Up @@ -24,34 +24,13 @@
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)

Check failure on line 28 in autoload/vital/__vital__/Bitwise.vim

View workflow job for this annotation

GitHub Actions / runner / vimlint

[vimlint] reported by reviewdog 🐶 EVP_0: unexpected token: < Raw Output: autoload/vital/__vital__/Bitwise.vim:28:15:Error: EVP_0: unexpected token: <

Check warning on line 28 in autoload/vital/__vital__/Bitwise.vim

View check run for this annotation

Codecov / codecov/patch

autoload/vital/__vital__/Bitwise.vim#L28

Added line #L28 was not covered by tests
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)

Check warning on line 32 in autoload/vital/__vital__/Bitwise.vim

View check run for this annotation

Codecov / codecov/patch

autoload/vital/__vital__/Bitwise.vim#L32

Added line #L32 was not covered by tests
endfunction

" 32bit or 64bit specific method
" define sign_extension
Expand All @@ -60,11 +39,7 @@
" 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)
Expand Down
20 changes: 5 additions & 15 deletions autoload/vital/__vital__/Color.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
12 changes: 2 additions & 10 deletions autoload/vital/__vital__/Data/List/Byte.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 2 additions & 5 deletions autoload/vital/__vital__/Deprecated/Text/Sexp.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 3 additions & 16 deletions autoload/vital/__vital__/System/Filepath.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions doc/vital.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 1 addition & 5 deletions test/Data/String/Interpolation.vimspec
Original file line number Diff line number Diff line change
Expand Up @@ -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')})
Expand Down
12 changes: 3 additions & 9 deletions test/Deprecated/Text/Sexp.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading