1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 12:50:04 +08:00

feat(font): add key binding to reset guifont

This commit is contained in:
wsdjeg 2022-05-29 13:36:28 +08:00
parent 6e6fc71e81
commit 372e8e3026

View File

@ -643,6 +643,9 @@ function! SpaceVim#layers#ui#get_options() abort
endfunction
function! s:fonts_transient_state() abort
if !exists('s:guifont')
let s:guifont = &guifont
endif
let state = SpaceVim#api#import('transient_state')
call state.set_title('Fonts Transient State')
call state.defind_keys(
@ -656,6 +659,13 @@ function! s:fonts_transient_state() abort
\ 'exit' : 0,
\ 'cmd' : 'call call(' . string(s:_function('s:increase_font')) . ', [])',
\ },
\ {
\ 'key' : '0',
\ 'desc' : 'reset the font size',
\ 'func' : '',
\ 'exit' : 0,
\ 'cmd' : 'call call(' . string(s:_function('s:reset_font_size')) . ', [])',
\ },
\ ],
\ 'right' : [
\ {
@ -671,6 +681,11 @@ function! s:fonts_transient_state() abort
call state.open()
endfunction
function! s:reset_font_size() abort
let &guifont = s:guifont
sleep 100m
endfunction
function! s:increase_font() abort
let font_size = str2nr(matchstr(matchstr(&guifont, ':h\d\+'), '\d\+'))
let font_size += 1