NeoVim vim设备图标未加载到Windows终端(PowerShell)中

cclgggtu  于 2022-12-04  发布在  Shell
关注(0)|答案(2)|浏览(229)

我在经营Neovim(nvim),最近通过vim插件安装了一个vim设备图标。我注意到图标没有显示。在我的Windows终端配置中,我使用Cascadia代码PL一种必需的字体来显示Oh-my-posh和posh-my-git,然而,即使有明显的能力字体neovim不显示它。然而,如果我打开nvim-qt,它确实工作(也许它不包括自己的终端模拟器)。有没有办法调整配置在neovim正确显示vim-devicons在windows终端?
这是我的个人资料。json:

{
      // Make changes here to the powershell.exe profile
      "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
      "name": "Windows PowerShell",
      "commandline": "powershell.exe",
      "fontFace": "Cascadia Code PL",
      "fontSize": 9,
      "useAcrylic": true,
      "acrylicOpacity": 0.7,
      "backgroundImage": "ms-appdata:///roaming/midnight_smuggler_1280x720.jpg",
      "backgroundImageOpacity": 0.4,
      "colorScheme": "cyberpunk",
      "hidden": false
    },

和我的本地nvim配置:

"Plugin Section
call plug#begin('~/.vim/plugged')
   Plug 'scrooloose/nerdtree'
   Plug 'ryanoasis/vim-devicons'
call plug#end()

"Config
set encoding=UTF-8
"set guifont=
let g:NERDTreeShowHidden = 1
let g:NERDTreeMinimalUI = 1
let g:NERDTreeIgnore = []
let g:NERDTreeStatusline = ''
" Automaticaly close nvim if NERDTree is only thing left open
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
" Toggle
 nnoremap <silent> <C-b> :NERDTreeToggle<CR>
zzoitvuj

zzoitvuj1#

这是很多用户在第一次安装 vim-airlineNERDTree 插件后经常遇到的问题。因此,您必须执行以下几个步骤来查看vim-airline和NERDTree插件中的图标。

步骤1

使用任何插件管理器安装vim-devicons https://github.com/ryanoasis/vim-devicons(我更喜欢vim-plug. https://github.com/junegunn/vim-plug),并将其放在call plug#end()命令之前,或者尝试在所有其他插件的末尾加载此插件(如果您使用任何其他方法安装插件),并在下一行粘贴set encoding=UTF-8示例:

call plug#begin()
.
.
.
Plug 'https://github.com/ryanoasis/vim-devicons'
set encoding=UTF-8
call plug#end()

步骤2

将以下代码粘贴到上一个循环之后

let g:NERDTreeDirArrowExpandable="+"
let g:NERDTreeDirArrowCollapsible="~"

" air-line
let g:airline_powerline_fonts = 1

if !exists('g:airline_symbols')
    let g:airline_symbols = {}
endif

" unicode symbols
let g:airline_left_sep = '»'
let g:airline_left_sep = '▶'
let g:airline_right_sep = '«'
let g:airline_right_sep = '◀'
let g:airline_symbols.linenr = '␊'
let g:airline_symbols.linenr = '␤'
let g:airline_symbols.linenr = '¶'
let g:airline_symbols.branch = '⎇'
let g:airline_symbols.paste = 'ρ'
let g:airline_symbols.paste = 'Þ'
let g:airline_symbols.paste = '∥'
let g:airline_symbols.whitespace = 'Ξ'
" airline symbols                                                                                                                              
let g:airline_left_sep = ''
let g:airline_left_alt_sep = ''
let g:airline_right_sep = ''
let g:airline_right_alt_sep = ''
let g:airline_symbols.branch = ''
let g:airline_symbols.readonly = ''
let g:airline_symbols.linenr = ''

let g:WebDevIconsUnicodeDecorateFolderNodes = 1
let g:WebDevIconsUnicodeDecorateFolderNodeDefaultSymbol = ''

let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols = {}
let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['nerdtree'] = ''

步骤3

https://www.nerdfonts.com/font-downloads下载任何字体。我更喜欢 *DejaVuSansMono Nerd字体 *。

步骤4

unzip DejaVuSansMono.zip和执行mv ~/.fontscd ~/.fonts

步骤5

最后你必须运行fc-cache -fv来手动重建字体缓存。现在重新打开vim或nvim,现在你会发现图标是正确可见的。请投票给我的答案。

oaxa6hgo

oaxa6hgo2#

只是认为我使用的是一个卡斯卡迪亚代码PL,只是有足够的字形哦,我的豪华,只是配置了德卢贾书呆子字体,而不是和Windows终端显示图标。

相关问题