适配neovim 0.11

1. 更改使用的主题
2. 更改底部状态栏样式
3. 更换彩虹括号插件适配neovim 0.11
4. 更换彩虹缩进样式
5. 添加lock文件
This commit is contained in:
a770 2025-05-10 20:43:44 +08:00
parent 1a430bf24b
commit 38bedd3beb
17 changed files with 259 additions and 425 deletions

View file

@ -9,7 +9,7 @@ vim.opt.conceallevel = 2
-- 使用相对数
vim.o.relativenumber = true
-- 高亮当前行
vim.o.cursorline = true
vim.o.cursorline = false
-- 一行不能完全显示时自动换行
vim.o.wrap = true
-- 在最后一行显示一些内容

View file

@ -207,7 +207,7 @@ mapcmd("<LEADER>sc", "set spell!")
-- 运行代码
vim.cmd([[
au filetype dart noremap r :wall<cr>:Telescope flutter commands<cr>
au filetype python noremap r :wall<cr>:set splitbelow<cr>:sp<cr>:term python %<cr>
au filetype python noremap r :wall<cr>:set splitbelow<cr>:sp<cr>:term uv run %<cr>
au filetype go noremap r :wall<cr>:set splitbelow<cr>:sp<cr>:term go run %<cr>
au filetype markdown noremap r :MarkdownPreview<cr>
au filetype rust noremap r :wall<cr>:set splitbelow<cr>:sp<cr>:term cargo run<cr>

View file

@ -29,7 +29,7 @@ require("lazy").setup({
require("lazy.plugins.fittencode"),
-- 免费大语言模型 (LLM) 支持
require("lazy.plugins.llm"),
-- command line浮动弹窗
-- command line浮动弹窗noice
require("lazy.plugins.cmdline"),
-- 代码函数名称浏览时固定,`[c`可以跳转到上下文
require("lazy.plugins.stickyScroll"),
@ -50,7 +50,7 @@ require("lazy").setup({
-- treesitter语法高亮
require("lazy.plugins.treesitter"),
-- rainbow彩虹括号
require("lazy.plugins.rainbow"),
require("lazy.plugins.rainbowbracket"),
-- tabular使用:Tab /=来格式化等号之类,特使符号要转义如:Tabularize /\/
require("lazy.plugins.tabular"),
-- surround,各种对字符的包裹{} [] ''
@ -59,12 +59,14 @@ require("lazy").setup({
require("lazy.plugins.pairs"),
-- flutter
require("lazy.plugins.flutter"),
-- 底部状态栏+主题 themes
-- 主题 themes
require("lazy.plugins.themes"),
-- 顶部标签页,文件缓冲区
require("lazy.plugins.bufferline"),
-- 底部状态栏
require("lazy.plugins.bottombar"),
-- 注释插件
require("lazy.plugins.comment"),
-- 文件缓冲标签栏
require("lazy.plugins.bufferline"),
-- explorer tree 文件列表现在已使用yazi
require("lazy.plugins.filemanager"),
-- crtl+g快捷键在neovim中启动lazygit
@ -77,18 +79,17 @@ require("lazy").setup({
require("lazy.plugins.color"),
-- sudo write
require("lazy.plugins.suda"),
-- jump使用flash.nvim插件实现f单个字母时按f下一处建议先esc退出再可视模式此时才可以继续使用f斜杠粘贴整个单词查找的时候不好用
-- jump使用flash.nvim插件实现
require("lazy.plugins.jump"),
-- 多光标
require("lazy.plugins.multicursor"),
-- which-key使用多个字母快捷键停留时会提示
require("lazy.plugins.whichkey"),
-- 用于改进在 Neovim 中查看 Markdown 文件的插件
-- require("lazy.plugins.render-markdown"),
-- 顶部的winbar,可以鼠标点击
-- require("lazy.plugins.winbar"),
-- cw推荐的indent缩进线hlchunk可以根据线条的款式来分辨缩进
-- require("lazy.plugins.indent"),
require("lazy.plugins.winbar"),
-- 用于改进在 Neovim 中查看 Markdown 文件的插件
require("lazy.plugins.markview"),
-- require("lazy.plugins.render-markdown"),
-- mcp server插件
-- require("lazy.plugins.mcphub"),
-- 像cursor一样使用neovim

View file

@ -15,6 +15,8 @@ return {
["<CR>"] = { "select_and_accept", "fallback" },
},
completion = {
-- 不预选第一个项目,选中后自动插入该项目文本
list = { selection = { preselect = false, auto_insert = true } },
-- 自动显示补全窗口,仅在输入命令时显示菜单,而搜索或使用其他输入菜单时则不显示
menu = {
auto_show = function(ctx)

View file

@ -0,0 +1,25 @@
-- ===
-- === 底部状态栏
-- ===
return {
"nvim-lualine/lualine.nvim",
dependencies = {
"nvim-tree/nvim-web-devicons",
},
opts = {
options = {
theme = "catppuccin",
always_divide_middle = false,
component_separators = { left = "", right = "" },
section_separators = { left = "", right = "" },
},
sections = {
lualine_a = { "mode" },
lualine_b = { "branch", "diff", "diagnostics" },
lualine_c = { "lsp_status" },
lualine_x = {},
lualine_y = { "encoding", "fileformat", "progress" },
lualine_z = { "location" },
},
},
}

View file

@ -1,13 +1,50 @@
-- ===
-- === explorer tree 文件列表
-- === explorer tree 文件列表
-- ===
---@type LazySpec
return {
"mikavilpas/yazi.nvim", -- 使用yazi替代joshuto和ranger,仍然使用fm-nvim来启动lazygit
"mikavilpas/yazi.nvim",
event = "VeryLazy",
keys = {
{ "tt", "<cmd>Yazi<CR>", desc = "Toggle Yazi" },
dependencies = {
-- check the installation instructions at
-- https://github.com/folke/snacks.nvim
"folke/snacks.nvim",
},
config = function()
end
keys = {
-- 👇 in this section, choose your own keymappings!
{
"tt",
mode = { "n", "v" },
"<cmd>Yazi<cr>",
desc = "Open yazi at the current file",
},
},
---@type YaziConfig | {}
opts = {
-- if you want to open yazi instead of netrw, see below for more info
open_for_directories = false,
keymaps = {
show_help = "<f1>",
},
},
-- 👇 if you use `open_for_directories=true`, this is recommended
init = function()
-- More details: https://github.com/mikavilpas/yazi.nvim/issues/802
-- vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
end,
}
-- return {
-- "rolv-apneseth/tfm.nvim",
-- event = "VeryLazy",
-- opts = {
-- enable_cmds = true,
-- },
-- keys = {
-- {
-- "tt",
-- ":Tfm<CR>",
-- desc = "TFM - new tab",
-- },
-- },
-- }

View file

@ -10,10 +10,10 @@ return {
keymaps = {
inline = {
['<S-CR>'] = 'accept_all_suggestions', -- 接受所有建议
['<C-i>'] = 'accept_line', -- 接受当前行
-- ['<C-i>'] = 'accept_word', -- 接受当前单词
['<C-n>'] = 'revoke_line', -- 撤销当前行
-- ['<C-n>'] = 'revoke_word', -- 撤销当前单词
-- ['<C-i>'] = 'accept_line', -- 接受当前行
['<C-i>'] = 'accept_word', -- 接受当前单词
-- ['<C-n>'] = 'revoke_line', -- 撤销当前行
['<C-n>'] = 'revoke_word', -- 撤销当前单词
['<c-\\>'] = 'triggering_completion', -- 触发补全
},
},

View file

@ -1,5 +1,5 @@
-- ufo关于折叠的设置
vim.o.foldcolumn = '0' -- '0' is not bad,其他的会有奇怪的数字
vim.o.foldcolumn = "0" -- '0' is not bad,其他的会有奇怪的数字
vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value
vim.o.foldlevelstart = 99
vim.o.foldenable = true
@ -7,22 +7,21 @@ vim.o.foldenable = true
vim.o.fillchars = [[eob: ,fold: ,foldopen:,foldsep: ,foldclose:]]
return {
'kevinhwang91/nvim-ufo',
dependencies = 'kevinhwang91/promise-async',
"kevinhwang91/nvim-ufo",
dependencies = "kevinhwang91/promise-async",
config = function()
-- Option 3: treesitter as a main provider instead
-- Only depend on `nvim-treesitter/queries/filetype/folds.scm`,
-- performance and stability are better than `foldmethod=nvim_treesitter#foldexpr()`
require('ufo').setup({
provider_selector = function(bufnr, filetype, buftype)
return {'treesitter', 'indent'}
end
require("ufo").setup({
provider_selector = function(bufnr, filetype, buftype)
return { "treesitter", "indent" }
end,
})
-- 键盘映射,这里的按键会打开或折叠全部的可折叠位置
vim.keymap.set('n', 'zR', require('ufo').openAllFolds)
vim.keymap.set('n', 'zM', require('ufo').closeAllFolds)
vim.keymap.set('n', 'zr', require('ufo').openFoldsExceptKinds)
vim.keymap.set('n', 'zm', require('ufo').closeFoldsWith) -- closeAllFolds == closeFoldsWith(0)
end
vim.keymap.set("n", "zR", require("ufo").openAllFolds)
vim.keymap.set("n", "zM", require("ufo").closeAllFolds)
vim.keymap.set("n", "zr", require("ufo").openFoldsExceptKinds)
vim.keymap.set("n", "zm", require("ufo").closeFoldsWith) -- closeAllFolds == closeFoldsWith(0)
end,
}

View file

@ -1,29 +0,0 @@
return {
"shellRaining/hlchunk.nvim",
-- 确保这个插件在lsp之后加载不然会显示为蓝色的线
event = "VeryLazy",
config = function()
vim.api.nvim_create_autocmd({ "CursorMoved", "CursorMovedI" }, { pattern = "*", command = "EnableHL", })
require('hlchunk').setup({
chunk = {
enable = true,
use_treesitter = true,
style = {
{ fg = "#806d9c" },
},
},
indent = {
chars = { "", "¦", "", "", },
use_treesitter = false,
},
-- 不显示缩进空白处的点点
blank = {
enable = false,
},
-- 让左侧数字高亮
line_num = {
use_treesitter = true,
},
})
end
}

View file

@ -5,39 +5,29 @@ return {
},
config = function()
opts = {}
-- Other blankline configuration here
require("ibl").setup(require("indent-rainbowline").make_opts(opts,{
-- How transparent should the rainbow colors be. 1 is completely opaque, 0 is invisible. 0.07 by default
color_transparency = 0.15,
-- The 24-bit colors to mix with the background. Specified in hex.
-- { 0xffff40, 0x79ff79, 0xff79ff, 0x4fecec, } by default
colors = {"0xff0000","0x00ff00","0x0000ff","0xffff40","0x79ff79","0xff79ff","0x4fecec"},
}))
local highlight = {
"RainbowRed",
"RainbowYellow",
"RainbowBlue",
"RainbowOrange",
"RainbowGreen",
"RainbowViolet",
"RainbowCyan",
}
-- local highlight = {
-- "RainbowRed",
-- "RainbowYellow",
-- "RainbowBlue",
-- "RainbowOrange",
-- "RainbowGreen",
-- "RainbowViolet",
-- "RainbowCyan",
-- }
local hooks = require("ibl.hooks")
-- create the highlight groups in the highlight setup hook, so they are reset
-- every time the colorscheme changes
hooks.register(hooks.type.HIGHLIGHT_SETUP, function()
vim.api.nvim_set_hl(0, "RainbowRed", { fg = "#61AFEF" })
vim.api.nvim_set_hl(0, "RainbowYellow", { fg = "#C678DD" })
vim.api.nvim_set_hl(0, "RainbowBlue", { fg = "#E06C75" })
vim.api.nvim_set_hl(0, "RainbowOrange", { fg = "#D19A66" })
vim.api.nvim_set_hl(0, "RainbowGreen", { fg = "#98C379" })
vim.api.nvim_set_hl(0, "RainbowViolet", { fg = "#E5C07B" })
vim.api.nvim_set_hl(0, "RainbowCyan", { fg = "#56B6C2" })
end)
-- local hooks = require "ibl.hooks"
-- -- create the highlight groups in the highlight setup hook, so they are reset
-- -- every time the colorscheme changes
-- hooks.register(hooks.type.HIGHLIGHT_SETUP, function()
-- vim.api.nvim_set_hl(0, "RainbowRed", { fg = "#E06C75" })
-- vim.api.nvim_set_hl(0, "RainbowYellow", { fg = "#E5C07B" })
-- vim.api.nvim_set_hl(0, "RainbowBlue", { fg = "#61AFEF" })
-- vim.api.nvim_set_hl(0, "RainbowOrange", { fg = "#D19A66" })
-- vim.api.nvim_set_hl(0, "RainbowGreen", { fg = "#98C379" })
-- vim.api.nvim_set_hl(0, "RainbowViolet", { fg = "#C678DD" })
-- vim.api.nvim_set_hl(0, "RainbowCyan", { fg = "#56B6C2" })
-- end)
-- require("ibl").setup { indent = { highlight = highlight } }
end
require("ibl").setup({ indent = { highlight = highlight } })
end,
}

View file

@ -1,8 +1,16 @@
return {
"folke/flash.nvim",
event = "VeryLazy",
event = "VeryLazy",
config = function()
require('flash').setup {
-- 下面映射可以通过<esc>取消f和t但是会覆盖原本的退出可视模式等功能
-- local map = vim.keymap.set
-- map({ "n", "x", "o" }, "<esc>", function()
-- local char = require("flash.plugins.char")
-- if char.state then
-- char.state:hide()
-- end
-- end, { desc = "Cancel Flash Char" })
require("flash").setup({
labels = "arstdhneioqwfpgjluyzxcvbkm",
modes = {
-- options used when flash is activated through
@ -12,8 +20,7 @@ return {
-- You can always toggle when searching with `require("flash").toggle()`
enabled = false,
},
}
}
end
},
})
end,
}

View file

@ -1,63 +1,66 @@
return {
'VonHeikemen/lsp-zero.nvim',
branch = 'v3.x',
"neovim/nvim-lspconfig",
dependencies = {
{ 'neovim/nvim-lspconfig' },
{ 'saghen/blink.cmp' },
{ 'williamboman/mason.nvim' },
{ 'williamboman/mason-lspconfig.nvim' },
{ "saghen/blink.cmp" },
{ "williamboman/mason.nvim" },
{
"MysticalDevil/inlay-hints.nvim",
event = "LspAttach",
config = function()
require("inlay-hints").setup()
end
}
end,
},
},
config = function()
-- 打算启用的语言服务列表
local servers = {
'marksman', -- 任意标题<space>aw打开code action可以开头生成目录超链接可以链接到同一个git项目的其他markdown文件#指定标题<space>h可以预览
'lua_ls',
'rust_analyzer',
'pylsp', -- Mason对应的安装名称是python-lsp-server
-- 'gopls',
markdown = { "marksman" }, -- 任意标题<space>aw打开code action可以开头生成目录超链接可以链接到同一个git项目的其他markdown文件#指定标题<space>h可以预览
lua = { "lua_ls", "lua-language-server" }, -- Mason对应的安装名称是lua-language-server
rust = { "rust_analyzer", "rust-analyzer" },
python = { "pylsp", "python-lsp-server" },
-- golang={'gopls'},
}
-- lsp_zero的相关配置
local lsp_zero = require('lsp-zero')
lsp_zero.on_attach(function(client, bufnr)
lsp_zero.default_keymaps({ buffer = bufnr })
local opts = { buffer = bufnr }
vim.keymap.set('n', '<leader>h', vim.lsp.buf.hover, opts) -- <space>h显示提示文档
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts) -- gd跳转到定义的位置
vim.keymap.set('n', 'go', vim.lsp.buf.type_definition, opts) -- go跳转到变量类型定义的位置
vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts) -- gr跳转到引用了对应变量或函数的位置
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, opts) -- <space>rn变量重命名
-- vim.keymap.set({ 'n', 'x' }, '<leader>f', function() vim.lsp.buf.format({ async = true }) end, opts) -- <space>f进行代码格式化
vim.keymap.set('n', '<leader>aw', vim.lsp.buf.code_action, opts) -- <space>aw可以在出现警告或错误的地方打开建议的修复方法
vim.keymap.set('n', '<leader>d', vim.diagnostic.open_float, opts) -- <space>d浮动窗口显示所在行警告或错误信息
vim.keymap.set('n', '<leader>-', vim.diagnostic.goto_prev, opts) -- <space>-跳转到上一处警告或错误的地方
vim.keymap.set('n', '<leader>=', vim.diagnostic.goto_next, opts) -- <space>+跳转到下一处警告或错误的地方
end)
-- “符号栏”是行号旁边的装订线中的一个空格。当一行中出现警告或错误时Neovim 会向您显示一个字母
lsp_zero.set_sign_icons({
error = '',
warn = '',
hint = '',
info = '»'
})
vim.keymap.set("n", "<leader>h", vim.lsp.buf.hover, opts) -- <space>h显示提示文档
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts) -- gd跳转到定义的位置
vim.keymap.set("n", "go", vim.lsp.buf.type_definition, opts) -- go跳转到变量类型定义的位置
vim.keymap.set("n", "gr", vim.lsp.buf.references, opts) -- gr跳转到引用了对应变量或函数的位置
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts) -- <space>rn变量重命名
vim.keymap.set("n", "<leader>aw", vim.lsp.buf.code_action, opts) -- <space>aw可以在出现警告或错误的地方打开建议的修复方法
vim.keymap.set("n", "<leader>d", vim.diagnostic.open_float, opts) -- <space>d浮动窗口显示所在行警告或错误信息
vim.keymap.set("n", "<leader>-", vim.diagnostic.goto_prev, opts) -- <space>-跳转到上一处警告或错误的地方
vim.keymap.set("n", "<leader>=", vim.diagnostic.goto_next, opts) -- <space>+跳转到下一处警告或错误的地方
-- vim.keymap.set({ 'n', 'x' }, '<leader>f', function() vim.lsp.buf.format({ async = true }) end, opts) -- <space>f进行代码格式化
-- 通过mason来自动安装语言服务器可以在对应的代码运行LspIstall来安装可用的语言服务器
require('mason').setup({})
require('mason-lspconfig').setup({
ensure_installed = servers -- 直接把前面的servers列表传递过来
})
-- cmp相关配置通过for读取servers列表循环批量激活语言服务
local lspconfig = require('lspconfig')
for _, lsp in ipairs(servers) do
lspconfig[lsp].setup {
capabilities = require('blink.cmp').get_lsp_capabilities(),
require("mason").setup({})
local mr = require("mason-registry")
local capabilities = require("blink.cmp").get_lsp_capabilities()
-- cmp相关配置
local lspconfig = require("lspconfig")
for lang_group_name, server_names_arr in pairs(servers) do
-- 使用Mason批量安装语言服务器
local mason_name = server_names_arr[2] or server_names_arr[1] -- Second for Mason, or fallback to first
local p = mr.get_package(mason_name)
if p then -- Check if package actually exists in mason-registry
if not p:is_installed() then
vim.notify(
"Installing Mason package: " .. mason_name .. " (for language: " .. lang_group_name .. ")",
vim.log.levels.INFO
)
p:install() -- This is synchronous
vim.notify(mason_name .. " installed successfully.", vim.log.levels.INFO)
end
else
vim.notify("Mason package not found: " .. mason_name, vim.log.levels.WARN)
end
-- 批量激活语言服务
local lsp = server_names_arr[1] -- First element is for lspconfig
lspconfig[lsp].setup({
capabilities = capabilities, -- Use the memoized capabilities
settings = {
gopls = {
["gopls"] = {
hints = { -- gopls开启hints
rangeVariableTypes = true,
parameterNames = true,
@ -66,23 +69,23 @@ return {
compositeLiteralFields = true,
compositeLiteralTypes = true,
functionTypeParameters = true,
}
},
},
Lua = {
hint = { -- Lua开启hints
["Lua"] = {
hint = { -- Lua开启hints
enable = true, -- necessary
},
diagnostics = {
-- 忽略掉vim配置时一些全局变量语言服务器找不到的警告
globals = {
'vim',
'require',
'opts',
"vim",
"require",
"opts",
},
},
},
},
}
})
end
end
end,
}

View file

@ -0,0 +1,12 @@
-- For `plugins/markview.lua` users.
return {
"OXY2DEV/markview.nvim",
lazy = false,
opts = {
headings = {
heading_1 = { sign = "" },
heading_2 = { sign = "" },
},
code_blocks = { sign = false },
},
}

View file

@ -1,21 +0,0 @@
-- ===
-- === rainbow彩虹括号必须要保证安装了treesitter,我分开是为了方便通过文件查找配置
-- ===
return {
'p00f/nvim-ts-rainbow',
config = function()
require("nvim-treesitter.configs").setup {
rainbow = {
-- `false` will disable the whole extension
enable = true,
-- disable = { "jsx", "cpp" }, list of languages you want to disable the plugin for
extended_mode = true, -- Also highlight non-bracket delimiters like html tags, boolean or table: lang -> boolean
max_file_lines = nil, -- Do not enable for files with more than n lines, int
-- colors = {}, -- table of hex strings
-- termcolors = {} -- table of colour name strings
}
}
end
}

View file

@ -0,0 +1,10 @@
-- ===
-- === rainbow彩虹括号必须要保证安装了treesitter,我分开是为了方便通过文件查找配置
-- ===
return {
"HiPhish/rainbow-delimiters.nvim",
config = function()
require("rainbow-delimiters.setup").setup({})
end,
}

View file

@ -1,253 +1,38 @@
-- ===
-- === 底部状态栏+onedark主题
-- === 主题
-- ===
return {
'nvim-lualine/lualine.nvim',
dependencies = {
'kyazdani42/nvim-web-devicons', -- 图标
'navarasu/onedark.nvim', -- onedark主题
},
config = function()
-- Eviline config for lualine
-- Author: shadmansaleh
-- Credit: glepnir
local lualine = require('lualine')
-- Color table for highlights
-- stylua: ignore
local colors = {
bg = '#202328',
fg = '#bbc2cf',
yellow = '#ECBE7B',
cyan = '#008080',
darkblue = '#081633',
green = '#98be65',
orange = '#FF8800',
violet = '#a9a1e1',
magenta = '#c678dd',
blue = '#51afef',
red = '#ec5f67',
}
local conditions = {
buffer_not_empty = function()
return vim.fn.empty(vim.fn.expand('%:t')) ~= 1
end,
hide_in_width = function()
return vim.fn.winwidth(0) > 80
end,
check_git_workspace = function()
local filepath = vim.fn.expand('%:p:h')
local gitdir = vim.fn.finddir('.git', filepath .. ';')
return gitdir and #gitdir > 0 and #gitdir < #filepath
end,
}
-- Config
local config = {
options = {
-- Disable sections and component separators
component_separators = '',
section_separators = '',
theme = {
-- We are going to use lualine_c an lualine_x as left and
-- right section. Both are highlighted by c theme . So we
-- are just setting default looks o statusline
normal = { c = { fg = colors.fg, bg = colors.bg } },
inactive = { c = { fg = colors.fg, bg = colors.bg } },
},
},
sections = {
-- these are to remove the defaults
lualine_a = {},
lualine_b = {},
lualine_y = {},
lualine_z = {},
-- These will be filled later
lualine_c = {},
lualine_x = {},
},
inactive_sections = {
-- these are to remove the defaults
lualine_a = {},
lualine_b = {},
lualine_y = {},
lualine_z = {},
lualine_c = {},
lualine_x = {},
},
}
-- Inserts a component in lualine_c at left section
local function ins_left(component)
table.insert(config.sections.lualine_c, component)
end
-- Inserts a component in lualine_x ot right section
local function ins_right(component)
table.insert(config.sections.lualine_x, component)
end
ins_left {
function()
return ''
end,
color = { fg = colors.blue }, -- Sets highlighting of component
padding = { left = 0, right = 1 }, -- We don't need space before this
}
ins_left {
-- mode component
function()
return ''
end,
color = function()
-- auto change color according to neovims mode
local mode_color = {
n = colors.red,
i = colors.green,
v = colors.blue,
[''] = colors.blue,
V = colors.blue,
c = colors.magenta,
no = colors.red,
s = colors.orange,
S = colors.orange,
[''] = colors.orange,
ic = colors.yellow,
R = colors.violet,
Rv = colors.violet,
cv = colors.red,
ce = colors.red,
r = colors.cyan,
rm = colors.cyan,
['r?'] = colors.cyan,
['!'] = colors.red,
t = colors.red,
{
"catppuccin/nvim",
name = "catppuccin",
priority = 1000,
opts = {
transparent_background = true,
custom_highlights = function(colors)
return {
LineNr = { fg = colors.surface2 },
Visual = { bg = colors.overlay0 },
Search = { bg = colors.surface2 },
IncSearch = { bg = colors.lavender },
CurSearch = { bg = colors.lavender },
MatchParen = { bg = colors.lavender, fg = colors.base, bold = true },
}
return { fg = mode_color[vim.fn.mode()] }
end,
padding = { right = 1 },
}
ins_left {
-- filesize component
'filesize',
cond = conditions.buffer_not_empty,
}
ins_left {
'filename',
cond = conditions.buffer_not_empty,
color = { fg = colors.magenta, gui = 'bold' },
}
ins_left { 'location' }
ins_left { 'progress', color = { fg = colors.fg, gui = 'bold' } }
ins_left {
'diagnostics',
sources = { 'nvim_diagnostic' },
symbols = { error = '', warn = '', info = '' },
diagnostics_color = {
color_error = { fg = colors.red },
color_warn = { fg = colors.yellow },
color_info = { fg = colors.cyan },
integrations = {
barbar = true,
blink_cmp = true,
gitsigns = true,
mason = true,
noice = true,
notify = true,
nvimtree = true,
rainbow_delimiters = true,
},
}
},
config = function(_, opts)
require("catppuccin").setup(opts)
-- Insert mid section. You can make any number of sections in neovim :)
-- for lualine it's any number greater then 2
ins_left {
function()
return '%='
end,
}
ins_left {
-- Lsp server name .
function()
local msg = 'No Active Lsp'
local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype')
local clients = vim.lsp.get_active_clients()
if next(clients) == nil then
return msg
end
for _, client in ipairs(clients) do
local filetypes = client.config.filetypes
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
return client.name
end
end
return msg
end,
icon = ' LSP:',
color = { fg = '#ffffff', gui = 'bold' },
}
-- Add components to right sections
ins_right {
'o:encoding', -- option component same as &encoding in viml
fmt = string.upper, -- I'm not sure why it's upper case either ;)
cond = conditions.hide_in_width,
color = { fg = colors.green, gui = 'bold' },
}
ins_right {
'fileformat',
fmt = string.upper,
icons_enabled = false, -- I think icons are cool but Eviline doesn't have them. sigh
color = { fg = colors.green, gui = 'bold' },
}
ins_right {
'branch',
icon = '',
color = { fg = colors.violet, gui = 'bold' },
}
ins_right {
'diff',
-- Is it me or the symbol for modified us really weird
symbols = { added = '', modified = '', removed = '' },
diff_color = {
added = { fg = colors.green },
modified = { fg = colors.orange },
removed = { fg = colors.red },
},
cond = conditions.hide_in_width,
}
ins_right {
function()
return ''
end,
color = { fg = colors.blue },
padding = { left = 1 },
}
-- Now don't forget to initialize lualine
lualine.setup(config)
-- ===
-- === 主题配置 theme
-- ===
-- vim.cmd 'colorscheme space-vim-dark'
-- 使用灰色注释
vim.cmd 'hi Comment guifg=#5C6370 ctermfg=59'
-- 使用透明背景
-- vim.cmd 'hi Normal ctermbg=NONE guibg=NONE'
-- vim.cmd 'hi LineNr ctermbg=NONE guibg=NONE'
-- vim.cmd 'hi SignColumn ctermbg=NONE guibg=NONE'
-- dark,darker,cool,deep,warm,warmer
require('onedark').setup {
style = 'darker'
}
require('onedark').load()
end
vim.cmd.colorscheme("catppuccin")
end,
},
}

View file

@ -0,0 +1,13 @@
return {
"romgrk/barbar.nvim",
dependencies = {
"lewis6991/gitsigns.nvim", -- OPTIONAL: for git status
"nvim-tree/nvim-web-devicons", -- OPTIONAL: for file icons
},
init = function()
vim.g.barbar_auto_setup = true
end,
opts = {
},
version = "^1.0.0", -- optional: only update when a new 1.x version is released
}