This commit is contained in:
veypi 2024-10-15 18:58:57 +08:00
parent e818e59873
commit de3d0d09d9
6 changed files with 250 additions and 3 deletions

View File

@ -1,4 +1,2 @@
# 💤 LazyVim
# vim
A starter template for [LazyVim](https://github.com/LazyVim/LazyVim).
Refer to the [documentation](https://lazyvim.github.io/installation) to get started.

View File

@ -3,6 +3,7 @@
"bufferline.nvim": { "branch": "main", "commit": "0b2fd861eee7595015b6561dade52fb060be10c4" },
"catppuccin": { "branch": "main", "commit": "7be452ee067978cdc8b2c5f3411f0c71ffa612b9" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-emoji": { "branch": "main", "commit": "e8398e2adf512a03bb4e1728ca017ffeac670a9f" },
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"conform.nvim": { "branch": "master", "commit": "40d4e98fcc3e6f485f0e8924c63734bc7e305967" },
@ -26,6 +27,7 @@
"noice.nvim": { "branch": "main", "commit": "df448c649ef6bc5a6a633a44f2ad0ed8d4442499" },
"nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" },
"nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" },
"nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" },
"nvim-lint": { "branch": "master", "commit": "f707b3ae50417067fa63fdfe179b0bff6b380da1" },
"nvim-lspconfig": { "branch": "master", "commit": "b1de227da4ca6baf6ba865bec75917e4b4053844" },
"nvim-notify": { "branch": "master", "commit": "fbef5d32be8466dd76544a257d3f3dce20082a07" },

174
lua/plugins/lualine.lua Normal file
View File

@ -0,0 +1,174 @@
local M = {}
M.theme = function()
local colors = {
darkgray = nil,
gray = "#727169",
innerbg = nil,
outerbg = nil,
normal = "#7e9cd8",
insert = "#98bb6c",
visual = "#ffa066",
replace = "#e46876",
command = "#e6c384",
}
return {
inactive = {
a = { fg = colors.gray, bg = colors.outerbg, gui = "bold" },
b = { fg = colors.gray, bg = colors.outerbg },
c = { fg = colors.gray, bg = colors.innerbg },
},
visual = {
a = { fg = colors.darkgray, bg = colors.visual, gui = "bold" },
b = { fg = colors.gray, bg = colors.outerbg },
c = { fg = colors.gray, bg = colors.innerbg },
},
replace = {
a = { fg = colors.darkgray, bg = colors.replace, gui = "bold" },
b = { fg = colors.gray, bg = colors.outerbg },
c = { fg = colors.gray, bg = colors.innerbg },
},
normal = {
a = { fg = colors.darkgray, bg = colors.normal, gui = "bold" },
b = { fg = colors.gray, bg = colors.outerbg },
c = { fg = colors.gray, bg = colors.innerbg },
},
insert = {
a = { fg = colors.darkgray, bg = colors.insert, gui = "bold" },
b = { fg = colors.gray, bg = colors.outerbg },
c = { fg = colors.gray, bg = colors.innerbg },
},
command = {
a = { fg = colors.darkgray, bg = colors.command, gui = "bold" },
b = { fg = colors.gray, bg = colors.outerbg },
c = { fg = colors.gray, bg = colors.innerbg },
},
}
end
return {
{
"nvim-lualine/lualine.nvim",
event = "VeryLazy",
init = function()
vim.g.lualine_laststatus = vim.o.laststatus
if vim.fn.argc(-1) > 0 then
-- set an empty statusline till lualine loads
vim.o.statusline = " "
else
-- hide the statusline on the starter page
vim.o.laststatus = 0
end
end,
opts = function()
-- PERF: we don't need this lualine require madness 🤷
local lualine_require = require("lualine_require")
lualine_require.require = require
local icons = LazyVim.config.icons
vim.o.laststatus = vim.g.lualine_laststatus
local opts = {
options = {
theme = M.theme(),
globalstatus = vim.o.laststatus == 3,
disabled_filetypes = { statusline = { "dashboard", "alpha", "ministarter" } },
},
sections = {
lualine_a = { "mode" },
lualine_b = { "branch" },
lualine_c = {
LazyVim.lualine.root_dir(),
{
"diagnostics",
symbols = {
error = icons.diagnostics.Error,
warn = icons.diagnostics.Warn,
info = icons.diagnostics.Info,
hint = icons.diagnostics.Hint,
},
},
{ "filetype", icon_only = true, separator = "", padding = { left = 1, right = 0 } },
{ LazyVim.lualine.pretty_path() },
},
lualine_x = {
-- stylua: ignore
{
function() return require("noice").api.status.command.get() end,
cond = function() return package.loaded["noice"] and require("noice").api.status.command.has() end,
color = function() return LazyVim.ui.fg("Statement") end,
},
-- stylua: ignore
{
function() return require("noice").api.status.mode.get() end,
cond = function() return package.loaded["noice"] and require("noice").api.status.mode.has() end,
color = function() return LazyVim.ui.fg("Constant") end,
},
-- stylua: ignore
{
function() return "" .. require("dap").status() end,
cond = function() return package.loaded["dap"] and require("dap").status() ~= "" end,
color = function() return LazyVim.ui.fg("Debug") end,
},
-- stylua: ignore
{
require("lazy.status").updates,
cond = require("lazy.status").has_updates,
color = function() return LazyVim.ui.fg("Special") end,
},
{
"diff",
symbols = {
added = icons.git.added,
modified = icons.git.modified,
removed = icons.git.removed,
},
source = function()
local gitsigns = vim.b.gitsigns_status_dict
if gitsigns then
return {
added = gitsigns.added,
modified = gitsigns.changed,
removed = gitsigns.removed,
}
end
end,
},
},
lualine_y = {
{ "progress", separator = " ", padding = { left = 1, right = 0 } },
{ "location", padding = { left = 0, right = 1 } },
},
lualine_z = {
function()
return "" .. os.date("%R")
end,
},
},
extensions = { "neo-tree", "lazy" },
}
-- do not add trouble symbols if aerial is enabled
-- And allow it to be overriden for some buffer types (see autocmds)
if vim.g.trouble_lualine and LazyVim.has("trouble.nvim") then
local trouble = require("trouble")
local symbols = trouble.statusline({
mode = "symbols",
groups = {},
title = false,
filter = { range = true },
format = "{kind_icon}{symbol.name:Normal}",
hl_group = "lualine_c_normal",
})
table.insert(opts.sections.lualine_c, {
symbols and symbols.get,
cond = function()
return vim.b.trouble_lualine ~= false and symbols.has()
end,
})
end
return opts
end,
}
}

45
lua/plugins/nvm.lua Normal file
View File

@ -0,0 +1,45 @@
return {
{
"hrsh7th/nvim-cmp",
dependencies = { "hrsh7th/cmp-emoji" },
---@param opts cmp.ConfigSchema
opts = function(_, opts)
table.insert(opts.sources, { name = "emoji" })
local has_words_before = function()
unpack = unpack or table.unpack
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
local cmp = require("cmp")
opts.mapping = vim.tbl_extend("force", opts.mapping, {
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
-- You could replace select_next_item() with confirm({ select = true }) to get VS Code autocompletion behavior
cmp.select_next_item()
elseif vim.snippet.active({ direction = 1 }) then
vim.schedule(function()
vim.snippet.jump(1)
end)
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif vim.snippet.active({ direction = -1 }) then
vim.schedule(function()
vim.snippet.jump(-1)
end)
else
fallback()
end
end, { "i", "s" }),
})
end,
}
}

12
lua/plugins/theme.lua Normal file
View File

@ -0,0 +1,12 @@
return {
{
"folke/tokyonight.nvim",
opts = {
transparent = true,
styles = {
sidebars = "transparent",
floats = "transparent",
},
},
}
}

16
lua/plugins/tools.lua Normal file
View File

@ -0,0 +1,16 @@
return {
{
"norcalli/nvim-colorizer.lua",
config = function()
require("colorizer").setup({ "css", "scss", "html", "javascript", "vue", "ts", "lua" }, {
RGB = true, -- #RGB hex codes
RRGGBB = true, -- #RRGGBB hex codes
RRGGBBAA = true, -- #RRGGBBAA hex codes
rgb_fn = true, -- CSS rgb() and rgba() functions
hsl_fn = true, -- CSS hsl() and hsla() functions
css = true, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB
css_fn = true, -- Enable all CSS *functions*: rgb_fn, hsl_fn
})
end,
}
}