Answers:
基本想法可能是这样的:
" Define a list of the fonts you want to use, and the index in the
" list of the default font. See :help Lists
let g:fc_list = [
\ "DejaVu Sans Mono 9",
\ "Source Code Pro 12",
\ "GohuFont 11"
\ ]
let g:fc_current = 0
" Set default font
let &guifont = g:fc_list[g:fc_current]
function! FontCycle()
" Increment circular list. See :help expr-%
let g:fc_current = (g:fc_current + 1) % len(g:fc_list)
let &guifont = g:fc_list[g:fc_current]
endfunction
noremap <leader>fc :call FontCycle()<cr>
我的.vimrc文件中定义了以下内容。
set guifont=DejaVu\ Sans\ Mono\ for\ Powerline\ 10
因此,您可以将其设置为这样的映射...
nmap <Leader>f :set guifont=DejaVu\ Sans\ Mono\ for\ Powerline\ 10<CR>
为其他字体添加其他映射。