簡體   English   中英

NeoVim vim-devicons 未加載到 Windows 終端 (PowerShell)

[英]NeoVim vim-devicons are not loaded in Windows Terminal (PowerShell)

我從 Windows 終端 Powershell 運行 Neovim (nvim),最近通過 vim-plug 安裝了一個 vim-devicons。 我注意到沒有顯示圖標。 在我的 Windows 終端配置中,我使用 Cascadia Code PL 顯示 Oh-my-posh 和 posh-my-git 所需的字體,但是即使具有明顯功能的字體 neovim 也不會顯示它。 但是,如果我打開 nvim-qt 它確實可以工作(也許它不包括自己的終端仿真器)。 有什么方法可以調整 neovim 中的配置以在 windows 終端中正確顯示 vim-devicons?

這是我的個人資料。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>

剛剛發現我使用的 Cascadia Code PL 剛好有足夠的字形用於 Oh-my-posh,只是配置了 Delugia Nerd 字體和 Windows 終端顯示圖標。

這是許多用戶在首次安裝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 字體

第四步

unzip DejaVuSansMono.zip並執行mv ~/.fontscd ~/.fonts

步驟 5

最后你必須運行fc-cache -fv來手動重建字體緩存。 現在重新打開vim或者nvim,現在你會發現圖標可以正確顯示了。 請投票給我的答案。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM