nvim: add support for “nerdfonts”

This commit is contained in:
tastytea 2022-08-19 00:11:15 +02:00
parent d03d96a9fb
commit 8094dd8c18
Signed by: tastytea
SSH Key Fingerprint: SHA256:FBkvrOlhq5use1XEttyUGT4bUTDVA1ar9SgIc9P03cM
3 changed files with 29 additions and 8 deletions

View File

@ -106,4 +106,12 @@ function M.get_hl_hex(hl_group)
return hl_hex
end
-- return true if 'Symbols Nerd Font' is known to fontconfig
function M.nerdfont_installed()
if os.execute([[fc-list -q 'Symbols Nerd Font']]) == 0 then
return true
end
return false
end
return M

View File

@ -83,9 +83,19 @@ require('packer').startup(function(use)
}
use {
'https://github.com/kyazdani42/nvim-tree.lua',
tag = '*'
tag = '*',
requires = {
'https://github.com/ryanoasis/vim-devicons',
opt = true
}
}
use {
'https://github.com/nvim-lualine/lualine.nvim',
requires = {
'https://github.com/ryanoasis/vim-devicons',
opt = true
}
}
use { 'https://github.com/nvim-lualine/lualine.nvim' }
-- coding
use {

View File

@ -36,6 +36,8 @@ map('n', '<Leader>tm', t_builtin.man_pages, 'Man pages')
map('n', '<Leader>tr', t_builtin.registers, 'Registers')
map('n', '<Leader>tp', telescope.extensions.projects.projects, 'Projects')
local nerdfont_installed = require('my.functions').nerdfont_installed()
require("nvim-tree").setup({
filters = {
dotfiles = false
@ -49,10 +51,10 @@ require("nvim-tree").setup({
renderer = {
icons = {
show = {
file = false,
folder = false,
folder_arrow = false,
git = false
file = nerdfont_installed,
folder = nerdfont_installed,
folder_arrow = nerdfont_installed,
git = nerdfont_installed
}
}
}
@ -70,9 +72,10 @@ require('lualine').setup({
},
sections = {
lualine_a = { 'mode' },
lualine_b = { 'branch', { 'diagnostics', icons_enabled = false } },
lualine_b = { 'branch',
{ 'diagnostics', icons_enabled = nerdfont_installed } },
lualine_c = { { 'filename', path = 1 } },
lualine_x = { { 'filetype', icons_enabled = false } },
lualine_x = { { 'filetype', icons_enabled = nerdfont_installed } },
lualine_y = { 'progress' },
lualine_z = { 'location' }
},