Compare commits

...

3 Commits

Author SHA1 Message Date
itchyny
e358557e1a optimize evaluating expanding components
Some checks failed
CI / Test (v7.3) (push) Has been cancelled
CI / Test (v7.4) (push) Has been cancelled
CI / Test (v8.0.0000) (push) Has been cancelled
CI / Test (v8.1.0000) (push) Has been cancelled
CI / Test (v8.2.0000) (push) Has been cancelled
CI / Test (v9.0.0000) (push) Has been cancelled
CI / Test (v9.1.0000) (push) Has been cancelled
2024-12-30 22:13:52 +09:00
itchyny
d6a07ea376 Merge pull request #685 from harrypotterIUP/patch-2
Some checks failed
CI / Test (v7.3) (push) Has been cancelled
CI / Test (v7.4) (push) Has been cancelled
CI / Test (v8.0.0000) (push) Has been cancelled
CI / Test (v8.1.0000) (push) Has been cancelled
CI / Test (v8.2.0000) (push) Has been cancelled
CI / Test (v9.0.0000) (push) Has been cancelled
CI / Test (v9.1.0000) (push) Has been cancelled
Mention up-to-date powerline font alternatives
2024-09-28 09:48:06 +09:00
harrypotterIUP
7e3f26781f Mention up-to-date powerline font alternatives 2024-09-27 19:58:44 +02:00
2 changed files with 14 additions and 23 deletions

View File

@@ -2,7 +2,7 @@
" Filename: autoload/lightline.vim
" Author: itchyny
" License: MIT License
" Last Change: 2021/11/21 22:54:46.
" Last Change: 2024/12/30 21:33:02.
" =============================================================================
let s:save_cpo = &cpo
@@ -317,26 +317,13 @@ function! lightline#statusline(inactive) abort
return s:line(0, a:inactive)
endfunction
function! s:normalize(result) abort
if type(a:result) == 3
return map(a:result, 'type(v:val) == 1 ? v:val : string(v:val)')
elseif type(a:result) == 1
return [a:result]
else
return [string(a:result)]
endif
endfunction
function! s:evaluate_expand(component) abort
try
let result = eval(a:component . '()')
if type(result) == 1 && result ==# ''
return []
endif
catch
return []
endtry
return map(type(result) == 3 ? (result + [[], [], []])[:2] : [[], [result], []], 'filter(s:normalize(v:val), "v:val !=# ''''")')
try | let value = eval(a:component . '()') | catch | return [] | endtry
return value is '' ? [] :
\ map(type(value) == 3 ? value : [[], [value], []],
\ 'filter(map(type(v:val) == 3 ? v:val : [v:val],
\ "type(v:val) == 1 ? v:val : string(v:val)"),
\ "v:val !=# ''''")')
endfunction
function! s:convert(name, index) abort
@@ -346,7 +333,8 @@ function! s:convert(name, index) abort
let type = get(s:lightline.component_type, a:name, a:index)
let is_raw = get(s:lightline.component_raw, a:name) || type ==# 'raw'
return filter(map(s:evaluate_expand(s:lightline.component_expand[a:name]),
\ '[v:val, 1 + ' . is_raw . ', v:key == 1 && ' . (type !=# 'raw') . ' ? "' . type . '" : "' . a:index . '", "' . a:index . '"]'), 'v:val[0] != []')
\ '[v:val, 1 + ' . is_raw . ', v:key == 1 && ' . (type !=# 'raw') .
\ ' ? "' . type . '" : "' . a:index . '", "' . a:index . '"]'), 'v:val[0] != []')
endif
endfunction

View File

@@ -963,8 +963,11 @@ Problem 6: *lightline-problem-6*
How to use a powerline font and the triangles for separators.
Using a patched font is not recommended due to less
portability. Also the powerline fonts project is not actively
maintained (https://github.com/powerline/fonts).
portability. Also the original powerline fonts project is
not actively maintained (https://github.com/powerline/fonts).
However, there are alternatives which offer both patching of
local fonts as well as downloads of already patched fonts,
e.g. Nerd Fonts (https://github.com/ryanoasis/nerd-fonts).
If you still want to use a patched font, you can configure
>