1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 13:00: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 endfunction
function! s:fonts_transient_state() abort function! s:fonts_transient_state() abort
if !exists('s:guifont')
let s:guifont = &guifont
endif
let state = SpaceVim#api#import('transient_state') let state = SpaceVim#api#import('transient_state')
call state.set_title('Fonts Transient State') call state.set_title('Fonts Transient State')
call state.defind_keys( call state.defind_keys(
@ -656,6 +659,13 @@ function! s:fonts_transient_state() abort
\ 'exit' : 0, \ 'exit' : 0,
\ 'cmd' : 'call call(' . string(s:_function('s:increase_font')) . ', [])', \ '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' : [ \ 'right' : [
\ { \ {
@ -671,6 +681,11 @@ function! s:fonts_transient_state() abort
call state.open() call state.open()
endfunction endfunction
function! s:reset_font_size() abort
let &guifont = s:guifont
sleep 100m
endfunction
function! s:increase_font() abort function! s:increase_font() abort
let font_size = str2nr(matchstr(matchstr(&guifont, ':h\d\+'), '\d\+')) let font_size = str2nr(matchstr(matchstr(&guifont, ':h\d\+'), '\d\+'))
let font_size += 1 let font_size += 1