Skip to content
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
24 changes: 10 additions & 14 deletions .github/workflows/buildtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,29 @@ 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:
OS: ${{ matrix.os }}
VIMVER: ${{ matrix.type }}-${{ matrix.vim }}
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Setup env
run: |
cat ENVFILE >> $GITHUB_ENV
Expand Down Expand Up @@ -94,13 +90,13 @@ jobs:
run: |
echo "set luadll=$(brew --prefix lua)/lib/liblua.dylib" > ${GITHUB_WORKSPACE}/.themisrc
- name: Setup vim-themis
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
repository: thinca/vim-themis
ref: ${{ env.THEMIS_VERSION }}
path: ${{ github.workspace }}/vim-themis
- name: Setup vimproc
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
repository: Shougo/vimproc.vim
path: ${{ github.workspace }}/vimproc
Expand Down Expand Up @@ -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 }}
Expand All @@ -153,7 +149,7 @@ jobs:
run: |
git config --global core.autocrlf input
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Setup env
shell: bash
run: |
Expand Down Expand Up @@ -227,13 +223,13 @@ jobs:
vim_type: '${{ matrix.type }}'
download: '${{ matrix.vim_download || matrix.download }}'
- name: Setup vim-themis
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
repository: thinca/vim-themis
ref: ${{ env.THEMIS_VERSION }}
path: ${{ github.workspace }}/vim-themis
- name: Setup vimproc
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
repository: Shougo/vimproc.vim
ref: ${{ env.VIMPROC_VERSION }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/depup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
submodules: true

Expand All @@ -26,7 +26,7 @@ jobs:
version_name: REVIEWDOG_VERSION
repo: reviewdog/reviewdog

- uses: actions/create-github-app-token@v1
- uses: actions/create-github-app-token@v2
id: app-token
with:
app-id: ${{ vars.VIM_JP_BOT_APP_ID }}
Expand All @@ -49,7 +49,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
submodules: true

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/reviewdog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code.
uses: actions/checkout@v4
uses: actions/checkout@v5
- uses: haya14busa/action-cond@v1
id: reporter
with:
Expand All @@ -30,7 +30,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code.
uses: actions/checkout@v4
uses: actions/checkout@v5
- uses: haya14busa/action-cond@v1
id: reporter
with:
Expand All @@ -47,7 +47,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code.
uses: actions/checkout@v4
uses: actions/checkout@v5
- uses: haya14busa/action-cond@v1
id: reporter
with:
Expand All @@ -65,7 +65,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code.
uses: actions/checkout@v4
uses: actions/checkout@v5
- uses: haya14busa/action-cond@v1
id: reporter
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/vimhelptagcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: help tag check
uses: tsuyoshicho/action-vimhelp-tagname-check@v1
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 @@ 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
Expand All @@ -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)
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
2 changes: 1 addition & 1 deletion autoload/vital/__vital__/Data/Dict.vim
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ endfunction

function! s:_max_by(dict, expr) abort
let dict = s:swap(map(copy(a:dict), a:expr))
let key = dict[max(keys(dict))]
let key = dict[max(map(keys(dict), 'v:val + 0'))]
return [key, a:dict[key]]
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