mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-24 17:58:51 +02:00
refactor: move icons to settings and add setup method for configs extending LazyVim (like my own dots)
This commit is contained in:
parent
ff777b5efd
commit
7a49913cf2
8 changed files with 57 additions and 40 deletions
8
init.lua
8
init.lua
|
@ -1,4 +1,4 @@
|
||||||
require("lazyvim.config.options")
|
vim.g.mapleader = " "
|
||||||
require("lazyvim.config.lazy")
|
vim.g.maplocalleader = " "
|
||||||
require("lazyvim.config.autocmds")
|
|
||||||
require("lazyvim.config.keymaps")
|
require("lazyvim").setup()
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
return {
|
|
||||||
diagnostics = {
|
|
||||||
Error = " ",
|
|
||||||
Warn = " ",
|
|
||||||
Hint = " ",
|
|
||||||
Info = " ",
|
|
||||||
},
|
|
||||||
kinds = {
|
|
||||||
Class = " ",
|
|
||||||
Color = " ",
|
|
||||||
Constant = " ",
|
|
||||||
Constructor = " ",
|
|
||||||
Enum = "了 ",
|
|
||||||
EnumMember = " ",
|
|
||||||
Field = " ",
|
|
||||||
File = " ",
|
|
||||||
Folder = " ",
|
|
||||||
Function = " ",
|
|
||||||
Interface = "ﰮ ",
|
|
||||||
Keyword = " ",
|
|
||||||
Method = "ƒ ",
|
|
||||||
Property = " ",
|
|
||||||
Snippet = " ",
|
|
||||||
Struct = " ",
|
|
||||||
Text = " ",
|
|
||||||
Unit = " ",
|
|
||||||
Value = " ",
|
|
||||||
Variable = " ",
|
|
||||||
},
|
|
||||||
}
|
|
|
@ -1,6 +1,3 @@
|
||||||
vim.g.mapleader = " "
|
|
||||||
vim.g.maplocalleader = " "
|
|
||||||
|
|
||||||
vim.opt.autowrite = true -- enable auto write
|
vim.opt.autowrite = true -- enable auto write
|
||||||
vim.opt.clipboard = "unnamedplus" -- sync with system clipboard
|
vim.opt.clipboard = "unnamedplus" -- sync with system clipboard
|
||||||
vim.opt.cmdheight = 1
|
vim.opt.cmdheight = 1
|
||||||
|
|
35
lua/lazyvim/config/settings.lua
Normal file
35
lua/lazyvim/config/settings.lua
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
---@class LazyVimSettings
|
||||||
|
local settings = {
|
||||||
|
icons = {
|
||||||
|
diagnostics = {
|
||||||
|
Error = " ",
|
||||||
|
Warn = " ",
|
||||||
|
Hint = " ",
|
||||||
|
Info = " ",
|
||||||
|
},
|
||||||
|
kinds = {
|
||||||
|
Class = " ",
|
||||||
|
Color = " ",
|
||||||
|
Constant = " ",
|
||||||
|
Constructor = " ",
|
||||||
|
Enum = "了 ",
|
||||||
|
EnumMember = " ",
|
||||||
|
Field = " ",
|
||||||
|
File = " ",
|
||||||
|
Folder = " ",
|
||||||
|
Function = " ",
|
||||||
|
Interface = "ﰮ ",
|
||||||
|
Keyword = " ",
|
||||||
|
Method = "ƒ ",
|
||||||
|
Property = " ",
|
||||||
|
Snippet = " ",
|
||||||
|
Struct = " ",
|
||||||
|
Text = " ",
|
||||||
|
Unit = " ",
|
||||||
|
Value = " ",
|
||||||
|
Variable = " ",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
return settings
|
15
lua/lazyvim/init.lua
Normal file
15
lua/lazyvim/init.lua
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
---@param opts? LazyVimSettings
|
||||||
|
function M.setup(opts)
|
||||||
|
if not package.loaded.lazy then
|
||||||
|
require("lazyvim.config.lazy")
|
||||||
|
end
|
||||||
|
local settings = require("lazyvim.config.settings")
|
||||||
|
package.loaded["lazyvim.config.settings"] = vim.tbl_deep_extend("force", settings, opts or {})
|
||||||
|
require("lazyvim.config.options")
|
||||||
|
require("lazyvim.config.autocmds")
|
||||||
|
require("lazyvim.config.keymaps")
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
|
@ -59,7 +59,7 @@ return {
|
||||||
}),
|
}),
|
||||||
formatting = {
|
formatting = {
|
||||||
format = function(_, item)
|
format = function(_, item)
|
||||||
local icons = require("lazyvim.config.icons").kinds
|
local icons = require("lazyvim.config.settings").icons.kinds
|
||||||
if icons[item.kind] then
|
if icons[item.kind] then
|
||||||
item.kind = icons[item.kind] .. item.kind
|
item.kind = icons[item.kind] .. item.kind
|
||||||
end
|
end
|
||||||
|
|
|
@ -20,7 +20,7 @@ return {
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- diagnostics
|
-- diagnostics
|
||||||
for name, icon in pairs(require("lazyvim.config.icons").diagnostics) do
|
for name, icon in pairs(require("lazyvim.config.settings").icons.diagnostics) do
|
||||||
name = "DiagnosticSign" .. name
|
name = "DiagnosticSign" .. name
|
||||||
vim.fn.sign_define(name, { text = icon, texthl = name, numhl = "" })
|
vim.fn.sign_define(name, { text = icon, texthl = name, numhl = "" })
|
||||||
end
|
end
|
||||||
|
|
|
@ -48,7 +48,7 @@ return {
|
||||||
diagnostics = "nvim_lsp",
|
diagnostics = "nvim_lsp",
|
||||||
always_show_bufferline = false,
|
always_show_bufferline = false,
|
||||||
diagnostics_indicator = function(_, _, diag)
|
diagnostics_indicator = function(_, _, diag)
|
||||||
local icons = require("lazyvim.config.icons").diagnostics
|
local icons = require("lazyvim.config.settings").icons.diagnostics
|
||||||
local ret = (diag.error and icons.Error .. diag.error .. " " or "")
|
local ret = (diag.error and icons.Error .. diag.error .. " " or "")
|
||||||
.. (diag.warning and icons.Warn .. diag.warning or "")
|
.. (diag.warning and icons.Warn .. diag.warning or "")
|
||||||
return vim.trim(ret)
|
return vim.trim(ret)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue