Some checks failed
		
		
	
	Detach Plugins / check (FlyGrep.vim) (push) Has been cancelled
				
			Detach Plugins / check (GitHub.vim) (push) Has been cancelled
				
			Detach Plugins / check (JavaUnit.vim) (push) Has been cancelled
				
			Detach Plugins / check (SourceCounter.vim) (push) Has been cancelled
				
			Detach Plugins / check (cpicker.nvim) (push) Has been cancelled
				
			Detach Plugins / check (dein-ui.vim) (push) Has been cancelled
				
			Detach Plugins / check (git.vim) (push) Has been cancelled
				
			Detach Plugins / check (iedit.vim) (push) Has been cancelled
				
			Detach Plugins / check (scrollbar.vim) (push) Has been cancelled
				
			Detach Plugins / check (vim-chat) (push) Has been cancelled
				
			Detach Plugins / check (vim-cheat) (push) Has been cancelled
				
			Detach Plugins / check (vim-todo) (push) Has been cancelled
				
			Detach Plugins / check (xmake.vim) (push) Has been cancelled
				
			test / Linux (nvim, nightly) (push) Has been cancelled
				
			test / Linux (nvim, v0.3.8) (push) Has been cancelled
				
			test / Linux (nvim, v0.4.0) (push) Has been cancelled
				
			test / Linux (nvim, v0.4.2) (push) Has been cancelled
				
			test / Linux (nvim, v0.4.3) (push) Has been cancelled
				
			test / Linux (nvim, v0.4.4) (push) Has been cancelled
				
			test / Linux (nvim, v0.5.0) (push) Has been cancelled
				
			test / Linux (nvim, v0.5.1) (push) Has been cancelled
				
			test / Linux (nvim, v0.6.0) (push) Has been cancelled
				
			test / Linux (nvim, v0.6.1) (push) Has been cancelled
				
			test / Linux (nvim, v0.7.0) (push) Has been cancelled
				
			test / Linux (nvim, v0.7.2) (push) Has been cancelled
				
			test / Linux (nvim, v0.8.0) (push) Has been cancelled
				
			test / Linux (nvim, v0.8.1) (push) Has been cancelled
				
			test / Linux (nvim, v0.8.2) (push) Has been cancelled
				
			test / Linux (nvim, v0.8.3) (push) Has been cancelled
				
			test / Linux (nvim, v0.9.0) (push) Has been cancelled
				
			test / Linux (nvim, v0.9.1) (push) Has been cancelled
				
			test / Linux (true, vim, v7.4.052) (push) Has been cancelled
				
			test / Linux (true, vim, v7.4.1689) (push) Has been cancelled
				
			test / Linux (true, vim, v7.4.629) (push) Has been cancelled
				
			test / Linux (true, vim, v8.0.0027) (push) Has been cancelled
				
			test / Linux (true, vim, v8.0.0183) (push) Has been cancelled
				
			test / Linux (vim, nightly) (push) Has been cancelled
				
			test / Linux (vim, v8.0.0184) (push) Has been cancelled
				
			test / Linux (vim, v8.0.1453) (push) Has been cancelled
				
			test / Linux (vim, v8.1.2269) (push) Has been cancelled
				
			test / Linux (vim, v8.2.2434) (push) Has been cancelled
				
			test / Linux (vim, v8.2.3995) (push) Has been cancelled
				
			test / Windows (nvim, nightly) (push) Has been cancelled
				
			test / Windows (nvim, v0.3.8) (push) Has been cancelled
				
			test / Windows (nvim, v0.4.2) (push) Has been cancelled
				
			test / Windows (nvim, v0.4.3) (push) Has been cancelled
				
			test / Windows (nvim, v0.4.4) (push) Has been cancelled
				
			test / Windows (nvim, v0.5.0) (push) Has been cancelled
				
			test / Windows (nvim, v0.5.1) (push) Has been cancelled
				
			test / Windows (nvim, v0.6.0) (push) Has been cancelled
				
			test / Windows (nvim, v0.6.1) (push) Has been cancelled
				
			test / Windows (nvim, v0.7.0) (push) Has been cancelled
				
			test / Windows (nvim, v0.7.2) (push) Has been cancelled
				
			test / Windows (nvim, v0.8.0) (push) Has been cancelled
				
			test / Windows (nvim, v0.8.1) (push) Has been cancelled
				
			test / Windows (nvim, v0.8.2) (push) Has been cancelled
				
			test / Windows (nvim, v0.8.3) (push) Has been cancelled
				
			test / Windows (nvim, v0.9.0) (push) Has been cancelled
				
			test / Windows (nvim, v0.9.1) (push) Has been cancelled
				
			test / Windows (vim, nightly) (push) Has been cancelled
				
			test / Windows (vim, v7.4.1185) (push) Has been cancelled
				
			test / Windows (vim, v7.4.1689) (push) Has been cancelled
				
			test / Windows (vim, v8.0.0027) (push) Has been cancelled
				
			test / Windows (vim, v8.0.1453) (push) Has been cancelled
				
			test / Windows (vim, v8.1.2269) (push) Has been cancelled
				
			test / Windows (vim, v8.2.2434) (push) Has been cancelled
				
			test / Windows (vim, v8.2.3995) (push) Has been cancelled
				
			docker / docker (push) Has been cancelled
				
			mirror / check (coding) (push) Has been cancelled
				
			mirror / check (gitee) (push) Has been cancelled
				
			mirror / check (gitlab) (push) Has been cancelled
				
			
		
			
				
	
	
		
			160 lines
		
	
	
		
			3.8 KiB
		
	
	
	
		
			VimL
		
	
	
	
	
	
			
		
		
	
	
			160 lines
		
	
	
		
			3.8 KiB
		
	
	
	
		
			VimL
		
	
	
	
	
	
"=============================================================================
 | 
						|
" list.vim --- SpaceVim list API
 | 
						|
" Copyright (c) 2016-2023 Wang Shidong & Contributors
 | 
						|
" Author: Wang Shidong < wsdjeg@outlook.com >
 | 
						|
" URL: https://spacevim.org
 | 
						|
" License: GPLv3
 | 
						|
"=============================================================================
 | 
						|
function! SpaceVim#api#data#list#get() abort
 | 
						|
    return map({'pop' : '',
 | 
						|
                \ 'push' : '',
 | 
						|
                \ 'shift' : '',
 | 
						|
                \ 'unshift' : '',
 | 
						|
                \ 'uniq' : '',
 | 
						|
                \ 'uniq_by' : '',
 | 
						|
                \ 'uniq_by_func' : '',
 | 
						|
                \ 'clear' : '',
 | 
						|
                \ 'char_range' : '',
 | 
						|
                \ 'has' : '',
 | 
						|
                \ 'has_index' : '',
 | 
						|
                \ 'listpart' : '',
 | 
						|
                \ 'replace' : '',
 | 
						|
                \ },
 | 
						|
                \ "function('s:' . v:key)"
 | 
						|
                \ )
 | 
						|
endfunction
 | 
						|
 | 
						|
""
 | 
						|
" @section data#list, api-data-list
 | 
						|
" @parentsection api
 | 
						|
" provides some functions to manipulate a list.
 | 
						|
"
 | 
						|
" pop({list})
 | 
						|
" 
 | 
						|
"   Removes the last element from {list} and returns the element,
 | 
						|
" as if the {list} is a stack.
 | 
						|
"
 | 
						|
" push({list})
 | 
						|
"
 | 
						|
"   Appends {val} to the end of {list} and returns the list itself,
 | 
						|
" as if the {list} is a stack.
 | 
						|
"
 | 
						|
" listpart({list}, {start}[, {len}])
 | 
						|
" 
 | 
						|
"   The result is a List, which is part of {list}, starting from
 | 
						|
" index {start}, with the length {len}
 | 
						|
"
 | 
						|
" replace(list, begin, end, re_list)
 | 
						|
"
 | 
						|
"   replace {list} from {begin} to {end} with {re_list}
 | 
						|
"
 | 
						|
" shift({list})
 | 
						|
"
 | 
						|
"   remove first item in a {list}, and return the item
 | 
						|
"
 | 
						|
" unshift({list})
 | 
						|
"
 | 
						|
"  insert an item to the begin of the {list} 
 | 
						|
"
 | 
						|
" clear({list})
 | 
						|
"
 | 
						|
"  clear items in the {list}
 | 
						|
"
 | 
						|
" char_range({from}, {to})
 | 
						|
"
 | 
						|
"  return a characters list based on the ascii number range.
 | 
						|
 | 
						|
function! s:pop(list) abort
 | 
						|
    return remove(a:list, -1)
 | 
						|
endfunction
 | 
						|
 | 
						|
function! s:listpart(list, start, ...) abort
 | 
						|
  let idx = range(a:start, a:start + get(a:000, 0, 0))
 | 
						|
  let rst = []
 | 
						|
  for i in idx
 | 
						|
    call add(rst, get(a:list, i))
 | 
						|
  endfor
 | 
						|
  return rst
 | 
						|
endfunction
 | 
						|
 | 
						|
function! s:push(list, val) abort
 | 
						|
  call add(a:list, a:val)
 | 
						|
  return a:list
 | 
						|
endfunction
 | 
						|
 | 
						|
function! s:shift(list) abort
 | 
						|
    return remove(a:list, 0)
 | 
						|
endfunction
 | 
						|
 | 
						|
function! s:unshift(list, val) abort
 | 
						|
    return insert(a:list, a:val)
 | 
						|
endfunction
 | 
						|
 | 
						|
function! s:uniq(list) abort
 | 
						|
    return s:uniq_by(a:list, 'v:val')
 | 
						|
endfunction
 | 
						|
 | 
						|
function! s:uniq_by_func(list, func) abort
 | 
						|
    let list = map(copy(a:list), '[v:val, call(a:func, [v:val])]')
 | 
						|
    let i = 0
 | 
						|
    let seen = {}
 | 
						|
    while i < len(list)
 | 
						|
        let key = string(list[i][1])
 | 
						|
        if has_key(seen, key)
 | 
						|
            call remove(list, i)
 | 
						|
        else
 | 
						|
            let seen[key] = 1
 | 
						|
            let i += 1
 | 
						|
        endif
 | 
						|
    endwhile
 | 
						|
    return map(list, 'v:val[0]')
 | 
						|
endfunction
 | 
						|
 | 
						|
function! s:uniq_by(list, f) abort
 | 
						|
    let list = map(copy(a:list), printf('[v:val, %s]', a:f))
 | 
						|
    let i = 0
 | 
						|
    let seen = {}
 | 
						|
    while i < len(list)
 | 
						|
        let key = string(list[i][1])
 | 
						|
        if has_key(seen, key)
 | 
						|
            call remove(list, i)
 | 
						|
        else
 | 
						|
            let seen[key] = 1
 | 
						|
            let i += 1
 | 
						|
        endif
 | 
						|
    endwhile
 | 
						|
    return map(list, 'v:val[0]')
 | 
						|
endfunction
 | 
						|
 | 
						|
function! s:clear(list) abort
 | 
						|
  if !empty(a:list)
 | 
						|
    unlet! a:list[0 : len(a:list) - 1]
 | 
						|
  endif
 | 
						|
  return a:list
 | 
						|
endfunction
 | 
						|
 | 
						|
function! s:char_range(from, to) abort
 | 
						|
  return map(
 | 
						|
  \   range(char2nr(a:from), char2nr(a:to)),
 | 
						|
  \   'nr2char(v:val)'
 | 
						|
  \)
 | 
						|
endfunction
 | 
						|
 | 
						|
function! s:has(list, val) abort
 | 
						|
    return index(a:list, a:val) != -1
 | 
						|
endfunction
 | 
						|
 | 
						|
function! s:has_index(list, index) abort
 | 
						|
    return 0 <= a:index && a:index < len(a:list)
 | 
						|
endfunction
 | 
						|
 | 
						|
function! s:replace(list, begin, end, re_list) abort
 | 
						|
  if a:begin <= a:end && a:begin >= 0 && a:end < len(a:list)
 | 
						|
    return a:list[:a:begin - 1] + a:re_list + a:list[a:end + 1:]
 | 
						|
  else
 | 
						|
    return a:list
 | 
						|
  endif
 | 
						|
endf
 | 
						|
 | 
						|
" vim:set et sw=2 cc=80:
 |