mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-23 10:20:05 +08:00
feat(font): add SPC z .
key binding
This commit is contained in:
parent
cd1bab21fc
commit
214ca3c3e2
@ -283,6 +283,10 @@ function! SpaceVim#layers#ui#config() abort
|
||||
\ 'toggle-highlight-tail-spaces', 1)
|
||||
|
||||
nnoremap <silent> <F11> :call <SID>toggle_full_screen()<Cr>
|
||||
let g:_spacevim_mappings_space.z = get(g:_spacevim_mappings_space, 'z', {'name' : '+Fonts'})
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['z', '.'], 'call call('
|
||||
\ . string(s:_function('s:fonts_transient_state')) . ', [])',
|
||||
\ 'font-transient-state', 1)
|
||||
endfunction
|
||||
|
||||
let s:fullscreen_flag = 0
|
||||
@ -637,3 +641,44 @@ function! SpaceVim#layers#ui#get_options() abort
|
||||
\ 'cursorword_exclude_filetypes']
|
||||
|
||||
endfunction
|
||||
|
||||
function! s:fonts_transient_state() abort
|
||||
let state = SpaceVim#api#import('transient_state')
|
||||
call state.set_title('Fonts Transient State')
|
||||
call state.defind_keys(
|
||||
\ {
|
||||
\ 'layout' : 'vertical split',
|
||||
\ 'left' : [
|
||||
\ {
|
||||
\ 'key' : '+',
|
||||
\ 'desc' : 'increase the font',
|
||||
\ 'func' : '',
|
||||
\ 'exit' : 0,
|
||||
\ 'cmd' : 'call call(' . string(s:_function('s:increase_font')) . ', [])',
|
||||
\ },
|
||||
\ ],
|
||||
\ 'right' : [
|
||||
\ {
|
||||
\ 'key' : '-',
|
||||
\ 'desc' : 'reduce the font',
|
||||
\ 'func' : '',
|
||||
\ 'exit' : 0,
|
||||
\ 'cmd' : 'call call(' . string(s:_function('s:reduce_font')) . ', [])',
|
||||
\ },
|
||||
\ ],
|
||||
\ }
|
||||
\ )
|
||||
call state.open()
|
||||
endfunction
|
||||
|
||||
function! s:increase_font() abort
|
||||
let font_size = str2nr(matchstr(matchstr(&guifont, ':h\d\+'), '\d\+'))
|
||||
let font_size += 1
|
||||
let &guifont = substitute(&guifont, ':h\d\+', ':h' . font_size, '')
|
||||
endfunction
|
||||
|
||||
function! s:reduce_font() abort
|
||||
let font_size = str2nr(matchstr(matchstr(&guifont, ':h\d\+'), '\d\+'))
|
||||
let font_size -= 1
|
||||
let &guifont = substitute(&guifont, ':h\d\+', ':h' . font_size, '')
|
||||
endfunction
|
||||
|
@ -555,6 +555,20 @@ guifont = "SourceCodePro Nerd Font Mono:h11"
|
||||
If the specified font is not found, the fallback one will be used (depends on your system).
|
||||
Also note that changing this value has no effect if you are running Vim/Neovim in terminal.
|
||||
|
||||
**Increase/Decrease fonts**
|
||||
|
||||
| Key Bindings | Descriptions |
|
||||
| ------------ | ------------------------- |
|
||||
| `SPC z .` | open font transient state |
|
||||
|
||||
In font transient state:
|
||||
|
||||
| Key Bindings | Descriptions |
|
||||
| ------------- | ------------------------- |
|
||||
| `+` | increase the font size |
|
||||
| `-` | decrease the font size |
|
||||
| Any other key | leave the transient state |
|
||||
|
||||
### Mouse
|
||||
|
||||
Mouse support is enabled in Normal mode and Visual mode by default.
|
||||
|
Loading…
Reference in New Issue
Block a user