gpt4 book ai didi

neovim - 如何更改 Neovim 字体?

转载 作者:行者123 更新时间:2023-12-04 06:56:38 92 4
gpt4 key购买 nike

VIM 包含一个 'set guifont' 选项来改变字体。 Neovim does not support this option ,所以我想知道是否可以更改 Neovim 在终端中使用的字体?

最佳答案

这不适用于终端,但它仍然可能对某人有用。

对于 Neovim-Qt GUI 客户端,如果您将以下内容放入 ginit.vim,您可以通过 Ctrl + 鼠标滚动来更改字体。 :

let s:fontsize = 12
function! AdjustFontSize(amount)
let s:fontsize = s:fontsize+a:amount
:execute "GuiFont! Consolas:h" . s:fontsize
endfunction

noremap <C-ScrollWheelUp> :call AdjustFontSize(1)<CR>
noremap <C-ScrollWheelDown> :call AdjustFontSize(-1)<CR>
inoremap <C-ScrollWheelUp> <Esc>:call AdjustFontSize(1)<CR>a
inoremap <C-ScrollWheelDown> <Esc>:call AdjustFontSize(-1)<CR>a

对于那些喜欢使用键盘的人来说,有一个很好的方法来使用小键盘的 + ( kPlus ) 和 - ( kMinus )
" In normal mode, pressing numpad's+ increases the font
noremap <kPlus> :call AdjustFontSize(1)<CR>
noremap <kMinus> :call AdjustFontSize(-1)<CR>

" In insert mode, pressing ctrl + numpad's+ increases the font
inoremap <C-kPlus> <Esc>:call AdjustFontSize(1)<CR>a
inoremap <C-kMinus> <Esc>:call AdjustFontSize(-1)<CR>a

显然你可以替换 Consolas使用您喜欢的字体。

关于neovim - 如何更改 Neovim 字体?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35285300/

92 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com