mirror of
https://github.com/itchyny/lightline.vim.git
synced 2025-11-15 06:53:51 -05:00
improve s:map: precisely detect the version
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
" Filename: autoload/lightline.vim
|
" Filename: autoload/lightline.vim
|
||||||
" Author: itchyny
|
" Author: itchyny
|
||||||
" License: MIT License
|
" License: MIT License
|
||||||
" Last Change: 2016/04/08 09:00:37.
|
" Last Change: 2016/04/08 09:23:19.
|
||||||
" =============================================================================
|
" =============================================================================
|
||||||
|
|
||||||
let s:save_cpo = &cpo
|
let s:save_cpo = &cpo
|
||||||
@@ -401,14 +401,13 @@ function! s:flatten_twice(xss) abort
|
|||||||
return ys
|
return ys
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
if v:version >= 703
|
if v:version > 702 || v:version == 702 && has('patch295')
|
||||||
let s:map = function('map')
|
let s:map = function('map')
|
||||||
else
|
else
|
||||||
function! s:map(xs, f) abort
|
function! s:map(xs, f) abort
|
||||||
let ys = []
|
let ys = []
|
||||||
for i in range(len(a:xs))
|
for i in range(len(a:xs))
|
||||||
let g = substitute(a:f, 'v:key', i, 'g')
|
call extend(ys, map(a:xs[i:i], substitute(a:f, 'v:key', i, 'g')))
|
||||||
call extend(ys, map(a:xs[i:i], g))
|
|
||||||
endfor
|
endfor
|
||||||
return ys
|
return ys
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
Reference in New Issue
Block a user