mirror of
https://github.com/LunarVim/LunarVim.git
synced 2025-09-01 08:15:20 +02:00
feat(icons): make it possible to disable icons (#2529)
This commit is contained in:
parent
dd65e28565
commit
6a66e39f29
11 changed files with 46 additions and 18 deletions
|
@ -10,6 +10,8 @@ return {
|
||||||
},
|
},
|
||||||
keys = {},
|
keys = {},
|
||||||
|
|
||||||
|
use_icons = true,
|
||||||
|
|
||||||
builtin = {},
|
builtin = {},
|
||||||
|
|
||||||
plugins = {
|
plugins = {
|
||||||
|
|
|
@ -4,9 +4,12 @@ local function is_ft(b, ft)
|
||||||
return vim.bo[b].filetype == ft
|
return vim.bo[b].filetype == ft
|
||||||
end
|
end
|
||||||
|
|
||||||
local function diagnostics_indicator(_, _, diagnostics)
|
local function diagnostics_indicator(num, _, diagnostics, _)
|
||||||
local result = {}
|
local result = {}
|
||||||
local symbols = { error = "", warning = "", info = "" }
|
local symbols = { error = "", warning = "", info = "" }
|
||||||
|
if not lvim.use_icons then
|
||||||
|
return "(" .. num .. ")"
|
||||||
|
end
|
||||||
for name, count in pairs(diagnostics) do
|
for name, count in pairs(diagnostics) do
|
||||||
if symbols[name] and count > 0 then
|
if symbols[name] and count > 0 then
|
||||||
table.insert(result, symbols[name] .. " " .. count)
|
table.insert(result, symbols[name] .. " " .. count)
|
||||||
|
@ -112,8 +115,8 @@ M.config = function()
|
||||||
padding = 1,
|
padding = 1,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
show_buffer_icons = true, -- disable filetype icons for buffers
|
show_buffer_icons = lvim.use_icons, -- disable filetype icons for buffers
|
||||||
show_buffer_close_icons = true,
|
show_buffer_close_icons = lvim.use_icons,
|
||||||
show_close_icon = false,
|
show_close_icon = false,
|
||||||
show_tab_indicators = true,
|
show_tab_indicators = true,
|
||||||
persist_buffer_sort = true, -- whether or not custom sorted buffers should persist
|
persist_buffer_sort = true, -- whether or not custom sorted buffers should persist
|
||||||
|
|
|
@ -220,7 +220,9 @@ M.config = function()
|
||||||
if max_width ~= 0 and #vim_item.abbr > max_width then
|
if max_width ~= 0 and #vim_item.abbr > max_width then
|
||||||
vim_item.abbr = string.sub(vim_item.abbr, 1, max_width - 1) .. "…"
|
vim_item.abbr = string.sub(vim_item.abbr, 1, max_width - 1) .. "…"
|
||||||
end
|
end
|
||||||
vim_item.kind = lvim.builtin.cmp.formatting.kind_icons[vim_item.kind]
|
if lvim.use_icons then
|
||||||
|
vim_item.kind = lvim.builtin.cmp.formatting.kind_icons[vim_item.kind]
|
||||||
|
end
|
||||||
vim_item.menu = lvim.builtin.cmp.formatting.source_names[entry.source.name]
|
vim_item.menu = lvim.builtin.cmp.formatting.source_names[entry.source.name]
|
||||||
vim_item.dup = lvim.builtin.cmp.formatting.duplicates[entry.source.name]
|
vim_item.dup = lvim.builtin.cmp.formatting.duplicates[entry.source.name]
|
||||||
or lvim.builtin.cmp.formatting.duplicates_default
|
or lvim.builtin.cmp.formatting.duplicates_default
|
||||||
|
|
|
@ -28,9 +28,11 @@ end
|
||||||
M.setup = function()
|
M.setup = function()
|
||||||
local dap = require "dap"
|
local dap = require "dap"
|
||||||
|
|
||||||
vim.fn.sign_define("DapBreakpoint", lvim.builtin.dap.breakpoint)
|
if lvim.use_icons then
|
||||||
vim.fn.sign_define("DapBreakpointRejected", lvim.builtin.dap.breakpoint_rejected)
|
vim.fn.sign_define("DapBreakpoint", lvim.builtin.dap.breakpoint)
|
||||||
vim.fn.sign_define("DapStopped", lvim.builtin.dap.stopped)
|
vim.fn.sign_define("DapBreakpointRejected", lvim.builtin.dap.breakpoint_rejected)
|
||||||
|
vim.fn.sign_define("DapStopped", lvim.builtin.dap.stopped)
|
||||||
|
end
|
||||||
|
|
||||||
dap.defaults.fallback.terminal_win_cmd = "50vsplit new"
|
dap.defaults.fallback.terminal_win_cmd = "50vsplit new"
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ styles.none = {
|
||||||
style = "none",
|
style = "none",
|
||||||
options = {
|
options = {
|
||||||
theme = "auto",
|
theme = "auto",
|
||||||
icons_enabled = true,
|
icons_enabled = lvim.use_icons,
|
||||||
component_separators = { left = "", right = "" },
|
component_separators = { left = "", right = "" },
|
||||||
section_separators = { left = "", right = "" },
|
section_separators = { left = "", right = "" },
|
||||||
disabled_filetypes = {},
|
disabled_filetypes = {},
|
||||||
|
@ -40,7 +40,7 @@ styles.default = {
|
||||||
style = "default",
|
style = "default",
|
||||||
options = {
|
options = {
|
||||||
theme = "auto",
|
theme = "auto",
|
||||||
icons_enabled = true,
|
icons_enabled = lvim.use_icons,
|
||||||
component_separators = { left = "", right = "" },
|
component_separators = { left = "", right = "" },
|
||||||
section_separators = { left = "", right = "" },
|
section_separators = { left = "", right = "" },
|
||||||
disabled_filetypes = {},
|
disabled_filetypes = {},
|
||||||
|
@ -69,7 +69,7 @@ styles.lvim = {
|
||||||
style = "lvim",
|
style = "lvim",
|
||||||
options = {
|
options = {
|
||||||
theme = "auto",
|
theme = "auto",
|
||||||
icons_enabled = true,
|
icons_enabled = lvim.use_icons,
|
||||||
component_separators = { left = "", right = "" },
|
component_separators = { left = "", right = "" },
|
||||||
section_separators = { left = "", right = "" },
|
section_separators = { left = "", right = "" },
|
||||||
disabled_filetypes = { "alpha", "NvimTree", "Outline" },
|
disabled_filetypes = { "alpha", "NvimTree", "Outline" },
|
||||||
|
|
|
@ -39,6 +39,15 @@ local defaults = {
|
||||||
}
|
}
|
||||||
|
|
||||||
function M.config()
|
function M.config()
|
||||||
|
if not lvim.use_icons then
|
||||||
|
defaults.opts.icons = {
|
||||||
|
ERROR = "[ERROR]",
|
||||||
|
WARN = "[WARNING]",
|
||||||
|
INFO = "[INFo]",
|
||||||
|
DEBUG = "[DEBUG]",
|
||||||
|
TRACE = "[TRACE]",
|
||||||
|
}
|
||||||
|
end
|
||||||
lvim.builtin.notify = vim.tbl_deep_extend("force", defaults, lvim.builtin.notify or {})
|
lvim.builtin.notify = vim.tbl_deep_extend("force", defaults, lvim.builtin.notify or {})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ local M = {}
|
||||||
local Log = require "lvim.core.log"
|
local Log = require "lvim.core.log"
|
||||||
|
|
||||||
function M.config()
|
function M.config()
|
||||||
|
local vim_show_icons = lvim.use_icons and 1 or 0
|
||||||
lvim.builtin.nvimtree = {
|
lvim.builtin.nvimtree = {
|
||||||
active = true,
|
active = true,
|
||||||
on_config_done = nil,
|
on_config_done = nil,
|
||||||
|
@ -30,7 +31,7 @@ function M.config()
|
||||||
hijack_cursor = false,
|
hijack_cursor = false,
|
||||||
update_cwd = false,
|
update_cwd = false,
|
||||||
diagnostics = {
|
diagnostics = {
|
||||||
enable = true,
|
enable = lvim.use_icons,
|
||||||
icons = {
|
icons = {
|
||||||
hint = "",
|
hint = "",
|
||||||
info = "",
|
info = "",
|
||||||
|
@ -90,10 +91,10 @@ function M.config()
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
show_icons = {
|
show_icons = {
|
||||||
git = 1,
|
git = vim_show_icons,
|
||||||
folders = 1,
|
folders = vim_show_icons,
|
||||||
files = 1,
|
files = vim_show_icons,
|
||||||
folder_arrows = 1,
|
folder_arrows = vim_show_icons,
|
||||||
},
|
},
|
||||||
git_hl = 1,
|
git_hl = 1,
|
||||||
root_folder_modifier = ":t",
|
root_folder_modifier = ":t",
|
||||||
|
|
|
@ -134,8 +134,10 @@ function M.setup()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
for _, sign in ipairs(lvim.lsp.diagnostics.signs.values) do
|
if lvim.use_icons then
|
||||||
vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = sign.name })
|
for _, sign in ipairs(lvim.lsp.diagnostics.signs.values) do
|
||||||
|
vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = sign.name })
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
require("lvim.lsp.handlers").setup()
|
require("lvim.lsp.handlers").setup()
|
||||||
|
|
|
@ -175,7 +175,10 @@ local core_plugins = {
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Icons
|
-- Icons
|
||||||
{ "kyazdani42/nvim-web-devicons" },
|
{
|
||||||
|
"kyazdani42/nvim-web-devicons",
|
||||||
|
disable = not lvim.use_icons,
|
||||||
|
},
|
||||||
|
|
||||||
-- Status Line and Bufferline
|
-- Status Line and Bufferline
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,6 +12,8 @@ an executable
|
||||||
lvim.log.level = "warn"
|
lvim.log.level = "warn"
|
||||||
lvim.format_on_save = true
|
lvim.format_on_save = true
|
||||||
lvim.colorscheme = "onedarker"
|
lvim.colorscheme = "onedarker"
|
||||||
|
-- to disable icons and use a minimalist setup, uncomment the following
|
||||||
|
-- lvim.use_icons = false
|
||||||
|
|
||||||
-- keymappings [view all the defaults by pressing <leader>Lk]
|
-- keymappings [view all the defaults by pressing <leader>Lk]
|
||||||
lvim.leader = "space"
|
lvim.leader = "space"
|
||||||
|
|
|
@ -29,6 +29,8 @@ vim.g.clipboard = {
|
||||||
lvim.log.level = "warn"
|
lvim.log.level = "warn"
|
||||||
lvim.format_on_save = true
|
lvim.format_on_save = true
|
||||||
lvim.colorscheme = "onedarker"
|
lvim.colorscheme = "onedarker"
|
||||||
|
-- to disable icons and use a minimalist setup, uncomment the following
|
||||||
|
-- lvim.use_icons = false
|
||||||
|
|
||||||
-- keymappings [view all the defaults by pressing <leader>Lk]
|
-- keymappings [view all the defaults by pressing <leader>Lk]
|
||||||
lvim.leader = "space"
|
lvim.leader = "space"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue