fix
This commit is contained in:
parent
6634a80445
commit
857bf86ef3
7
init.lua
7
init.lua
|
@ -1,5 +1,9 @@
|
|||
require("impatient") -- start quickly
|
||||
local exist, _ = pcall(require, "impatient") -- start quickly)
|
||||
if not exist then
|
||||
vim.notify("没找到impatient")
|
||||
end
|
||||
require("setup")
|
||||
require("core.g")
|
||||
require("core.option")
|
||||
|
||||
-- 加载插件配置文件
|
||||
|
@ -40,6 +44,7 @@ require("lsp.go")
|
|||
require("lsp.lua")
|
||||
require("lsp.protocol")
|
||||
require("lsp.volar")
|
||||
require("lsp.clang")
|
||||
-- lspsaga
|
||||
require("plugins.lspsaga")
|
||||
-- golang lsp
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
local G = {}
|
||||
|
||||
G.g = vim.g
|
||||
G.b = vim.b
|
||||
G.o = vim.o
|
||||
G.v = vim.v
|
||||
G.fn = vim.fn
|
||||
G.api = vim.api
|
||||
G.opt = vim.opt
|
||||
|
||||
function G.map(maps)
|
||||
for _, map in pairs(maps) do
|
||||
G.api.nvim_set_keymap(map[1], map[2], map[3], map[4])
|
||||
end
|
||||
end
|
||||
|
||||
function G.hi(hls)
|
||||
local colormode = G.o.termguicolors and "" or "cterm"
|
||||
for group, color in pairs(hls) do
|
||||
local opt = {}
|
||||
if color.fg then
|
||||
opt[colormode .. "fg"] = color.fg
|
||||
end
|
||||
if color.bg then
|
||||
opt[colormode .. "bg"] = color.bg
|
||||
end
|
||||
if color.italic then
|
||||
opt.italic = true
|
||||
end
|
||||
if color.bold then
|
||||
opt.bold = true
|
||||
end
|
||||
if color.underline then
|
||||
opt.underline = true
|
||||
end
|
||||
G.api.nvim_set_hl(0, group, opt)
|
||||
end
|
||||
end
|
||||
|
||||
function G.cmd(cmd)
|
||||
G.api.nvim_command(cmd)
|
||||
end
|
||||
|
||||
function G.exec(c)
|
||||
G.api.nvim_exec(c)
|
||||
end
|
||||
|
||||
function G.eval(c)
|
||||
return G.api.nvim_eval(c)
|
||||
end
|
||||
|
||||
return G
|
|
@ -0,0 +1 @@
|
|||
require("lspconfig").clangd.setup({})
|
|
@ -10,6 +10,11 @@ require("mason").setup({
|
|||
|
||||
require("mason-lspconfig").setup({
|
||||
ensure_installed = {
|
||||
"clangd",
|
||||
"emmet_ls",
|
||||
"cmake",
|
||||
"gradle_ls",
|
||||
"kotlin_language_server",
|
||||
"lua_ls",
|
||||
"rust_analyzer",
|
||||
"gopls",
|
||||
|
|
|
@ -39,15 +39,15 @@ require("nvim-treesitter.configs").setup({
|
|||
---- If you need to change the installation directory of the parsers (see -> Advanced Setup)
|
||||
-- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")!
|
||||
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
init_selection = "<CR>",
|
||||
node_incremental = "<CR>",
|
||||
node_decremental = "<BS>",
|
||||
scope_incremental = "<TAB>",
|
||||
},
|
||||
},
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
init_selection = "<CR>",
|
||||
node_incremental = "<CR>",
|
||||
node_decremental = "<BS>",
|
||||
scope_incremental = "<TAB>",
|
||||
},
|
||||
},
|
||||
indent = {
|
||||
enable = true,
|
||||
},
|
||||
|
|
|
@ -1,30 +1,52 @@
|
|||
local wilder = require("wilder")
|
||||
local G = require("core.g")
|
||||
|
||||
local wilder = require("wilder")
|
||||
wilder.setup({
|
||||
modes = { ":", "/", "?" },
|
||||
next_key = 0,
|
||||
previous_key = 0,
|
||||
reject_key = 0,
|
||||
accept_key = 0,
|
||||
})
|
||||
wilder.set_option("pipeline", {
|
||||
wilder.branch(
|
||||
{
|
||||
wilder.check(function(_, x)
|
||||
return G.fn.empty(x)
|
||||
end),
|
||||
wilder.history(15),
|
||||
},
|
||||
wilder.cmdline_pipeline({
|
||||
fuzzy = 1,
|
||||
set_pcre2_pattern = 1,
|
||||
fuzzy_filter = wilder.vim_fuzzy_filter(),
|
||||
}),
|
||||
wilder.python_search_pipeline({
|
||||
pattern = "fuzzy",
|
||||
})
|
||||
wilder.search_pipeline()
|
||||
),
|
||||
wilder.debounce(10),
|
||||
})
|
||||
|
||||
local highlighters = {
|
||||
wilder.pcre2_highlighter(),
|
||||
wilder.basic_highlighter(),
|
||||
}
|
||||
|
||||
wilder.set_option(
|
||||
"renderer",
|
||||
wilder.renderer_mux({
|
||||
[":"] = wilder.popupmenu_renderer({
|
||||
highlighter = highlighters,
|
||||
}),
|
||||
["/"] = wilder.wildmenu_renderer({
|
||||
highlighter = highlighters,
|
||||
}),
|
||||
})
|
||||
wilder.popupmenu_renderer(wilder.popupmenu_border_theme({
|
||||
highlights = {
|
||||
accent = "WilderAccent",
|
||||
selected_accent = "WilderSelectedAccent",
|
||||
},
|
||||
highlighter = wilder.basic_highlighter(),
|
||||
left = { " ", wilder.popupmenu_devicons() },
|
||||
right = { " ", wilder.popupmenu_scrollbar() },
|
||||
border = "rounded",
|
||||
max_height = 17, -- 最大高度限制 因为要计算上下 所以17支持最多15个选项
|
||||
}))
|
||||
)
|
||||
G.cmd("silent! UpdateRemotePlugins")
|
||||
G.hi({
|
||||
WilderAccent = { fg = 12 },
|
||||
WilderSelectedAccent = { fg = 12, bg = 239 },
|
||||
})
|
||||
G.map({
|
||||
{ "c", "<tab>", [[wilder#in_context() ? wilder#next() : '<tab>']], { noremap = true, expr = true } },
|
||||
{ "c", "<Down>", [[wilder#in_context() ? wilder#next() : '<down>']], { noremap = true, expr = true } },
|
||||
{ "c", "<up>", [[wilder#in_context() ? wilder#previous() : '<up>']], { noremap = true, expr = true } },
|
||||
{ "c", "0", "0", {} }, -- 不清楚原因导致0无法使用 强制覆盖
|
||||
})
|
||||
|
||||
|
|
348
lua/setup.lua
348
lua/setup.lua
|
@ -12,179 +12,181 @@ end
|
|||
local packer_bootstrap = ensure_packer()
|
||||
|
||||
return require("packer").startup(function(use)
|
||||
use({ "wbthomason/packer.nvim" })
|
||||
use({ "folke/tokyonight.nvim" })
|
||||
use({ "catppuccin/nvim", as = "catppuccin" })
|
||||
use({ "wbthomason/packer.nvim" })
|
||||
use({ "folke/tokyonight.nvim" })
|
||||
use({ "catppuccin/nvim", as = "catppuccin" })
|
||||
|
||||
-- bufferline
|
||||
use({ "akinsho/bufferline.nvim", tag = "v3.*", requires = "nvim-tree/nvim-web-devicons" })
|
||||
-- 行号模式自动切换
|
||||
use({ "nkakouros-original/numbers.nvim" })
|
||||
-- 模糊搜索
|
||||
use({
|
||||
"nvim-telescope/telescope.nvim",
|
||||
tag = "0.1.1",
|
||||
requires = {
|
||||
{ "nvim-lua/plenary.nvim" },
|
||||
{ "nvim-treesitter/nvim-treesitter" },
|
||||
{ "kdheepak/lazygit.nvim" },
|
||||
},
|
||||
})
|
||||
-- 文件树
|
||||
use({
|
||||
"nvim-tree/nvim-tree.lua",
|
||||
requires = {
|
||||
"nvim-tree/nvim-web-devicons", -- optional, for file icons
|
||||
},
|
||||
tag = "nightly", -- optional, updated every week. (see issue #1193)
|
||||
})
|
||||
-- 终端管理
|
||||
use({ "akinsho/toggleterm.nvim", tag = "*" })
|
||||
-- LSP管理器
|
||||
use({
|
||||
"williamboman/mason.nvim",
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
"neovim/nvim-lspconfig",
|
||||
"jose-elias-alvarez/null-ls.nvim",
|
||||
})
|
||||
-- 命令行
|
||||
use({
|
||||
"VonHeikemen/fine-cmdline.nvim",
|
||||
requires = {
|
||||
{ "MunifTanjim/nui.nvim" },
|
||||
},
|
||||
})
|
||||
-- 通知
|
||||
use({ "rcarriga/nvim-notify" })
|
||||
-- 缩进线
|
||||
use({ "lukas-reineke/indent-blankline.nvim" })
|
||||
-- 注释管理
|
||||
use({
|
||||
"numToStr/Comment.nvim",
|
||||
config = function()
|
||||
require("Comment").setup({})
|
||||
end,
|
||||
})
|
||||
-- git管理
|
||||
use({ "lewis6991/gitsigns.nvim" })
|
||||
use({
|
||||
"nvim-lualine/lualine.nvim",
|
||||
requires = { "kyazdani42/nvim-web-devicons", opt = true },
|
||||
})
|
||||
-- 自动修复部分按键
|
||||
use({ "tummetott/unimpaired.nvim" })
|
||||
-- 标签补全
|
||||
use({ "windwp/nvim-autopairs" })
|
||||
use({ "windwp/nvim-ts-autotag" })
|
||||
-- 自动保存
|
||||
use({
|
||||
"Pocco81/auto-save.nvim",
|
||||
})
|
||||
-- lspsaga
|
||||
use({
|
||||
"glepnir/lspsaga.nvim",
|
||||
branch = "main",
|
||||
requires = {
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
--Please make sure you install markdown and markdown_inline parser
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
"folke/lsp-colors.nvim",
|
||||
},
|
||||
})
|
||||
-- 错误列表
|
||||
use({
|
||||
"folke/trouble.nvim",
|
||||
requires = "nvim-tree/nvim-web-devicons",
|
||||
})
|
||||
-- 上下高亮跳动
|
||||
use({ "danilamihailov/beacon.nvim" })
|
||||
-- markdown lsp
|
||||
use({
|
||||
"iamcco/markdown-preview.nvim",
|
||||
run = "cd app && npm install",
|
||||
setup = function()
|
||||
vim.g.mkdp_filetypes = { "markdown" }
|
||||
end,
|
||||
ft = { "markdown" },
|
||||
})
|
||||
-- 跳转
|
||||
use({ "ggandor/leap.nvim" })
|
||||
use({ "ggandor/flit.nvim" })
|
||||
-- 项目管理
|
||||
use({ "ahmedkhalf/project.nvim" })
|
||||
-- 优化启动速度
|
||||
use({ "lewis6991/impatient.nvim" })
|
||||
-- TODO 管理
|
||||
use({
|
||||
"folke/todo-comments.nvim",
|
||||
requires = "nvim-lua/plenary.nvim",
|
||||
})
|
||||
-- 代码高亮
|
||||
use({
|
||||
-- bufferline
|
||||
use({ "akinsho/bufferline.nvim", tag = "v3.*", requires = "nvim-tree/nvim-web-devicons" })
|
||||
-- 行号模式自动切换
|
||||
use({ "nkakouros-original/numbers.nvim" })
|
||||
-- 模糊搜索
|
||||
use({
|
||||
"nvim-telescope/telescope.nvim",
|
||||
tag = "0.1.1",
|
||||
requires = {
|
||||
{ "nvim-lua/plenary.nvim" },
|
||||
{ "nvim-treesitter/nvim-treesitter" },
|
||||
{ "kdheepak/lazygit.nvim" },
|
||||
},
|
||||
})
|
||||
-- 文件树
|
||||
use({
|
||||
"nvim-tree/nvim-tree.lua",
|
||||
requires = {
|
||||
"nvim-tree/nvim-web-devicons", -- optional, for file icons
|
||||
},
|
||||
tag = "nightly", -- optional, updated every week. (see issue #1193)
|
||||
})
|
||||
-- 终端管理
|
||||
use({ "akinsho/toggleterm.nvim", tag = "*" })
|
||||
-- LSP管理器
|
||||
use({
|
||||
"williamboman/mason.nvim",
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
"neovim/nvim-lspconfig",
|
||||
"jose-elias-alvarez/null-ls.nvim",
|
||||
})
|
||||
-- 命令行
|
||||
use({
|
||||
"VonHeikemen/fine-cmdline.nvim",
|
||||
requires = {
|
||||
{ "MunifTanjim/nui.nvim" },
|
||||
},
|
||||
})
|
||||
-- 通知
|
||||
use({ "rcarriga/nvim-notify" })
|
||||
-- 缩进线
|
||||
use({ "lukas-reineke/indent-blankline.nvim" })
|
||||
-- 注释管理
|
||||
use({
|
||||
"numToStr/Comment.nvim",
|
||||
config = function()
|
||||
require("Comment").setup({})
|
||||
end,
|
||||
})
|
||||
-- git管理
|
||||
use({ "lewis6991/gitsigns.nvim" })
|
||||
use({
|
||||
"nvim-lualine/lualine.nvim",
|
||||
requires = { "kyazdani42/nvim-web-devicons", opt = true },
|
||||
})
|
||||
-- 自动修复部分按键
|
||||
use({ "tummetott/unimpaired.nvim" })
|
||||
-- 标签补全
|
||||
use({ "windwp/nvim-autopairs" })
|
||||
use({ "windwp/nvim-ts-autotag" })
|
||||
-- 自动保存
|
||||
use({
|
||||
"Pocco81/auto-save.nvim",
|
||||
})
|
||||
-- lspsaga
|
||||
use({
|
||||
"glepnir/lspsaga.nvim",
|
||||
branch = "main",
|
||||
requires = {
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
--Please make sure you install markdown and markdown_inline parser
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
run = ":TSUpdate",
|
||||
})
|
||||
-- 自动完成相关
|
||||
use({
|
||||
"folke/lsp-colors.nvim",
|
||||
},
|
||||
})
|
||||
-- 错误列表
|
||||
use({
|
||||
"folke/trouble.nvim",
|
||||
requires = "nvim-tree/nvim-web-devicons",
|
||||
})
|
||||
-- 上下高亮跳动
|
||||
use({ "danilamihailov/beacon.nvim" })
|
||||
-- markdown lsp
|
||||
use({ "mzlogin/vim-markdown-toc", ft = "markdown" })
|
||||
use({
|
||||
"iamcco/markdown-preview.nvim",
|
||||
run = "cd app && npm install",
|
||||
setup = function()
|
||||
vim.g.mkdp_filetypes = { "markdown" }
|
||||
end,
|
||||
ft = { "markdown" },
|
||||
})
|
||||
-- 跳转
|
||||
use({ "ggandor/leap.nvim" })
|
||||
use({ "ggandor/flit.nvim" })
|
||||
-- 项目管理
|
||||
use({ "ahmedkhalf/project.nvim" })
|
||||
-- 优化启动速度
|
||||
use({ "lewis6991/impatient.nvim" })
|
||||
-- TODO 管理
|
||||
use({
|
||||
"folke/todo-comments.nvim",
|
||||
requires = "nvim-lua/plenary.nvim",
|
||||
})
|
||||
-- 代码高亮
|
||||
use({
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
run = ":TSUpdate",
|
||||
})
|
||||
use({ "nvim-treesitter/playground", after = "nvim-treesitter" })
|
||||
-- 自动完成相关
|
||||
use({
|
||||
"hrsh7th/nvim-cmp",
|
||||
requires = {
|
||||
"onsails/lspkind-nvim",
|
||||
"octaltree/cmp-look",
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
"hrsh7th/cmp-calc",
|
||||
"hrsh7th/cmp-cmdline",
|
||||
"hrsh7th/nvim-cmp",
|
||||
requires = {
|
||||
"onsails/lspkind-nvim",
|
||||
"octaltree/cmp-look",
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
"hrsh7th/cmp-calc",
|
||||
"hrsh7th/cmp-cmdline",
|
||||
"hrsh7th/nvim-cmp",
|
||||
"hrsh7th/cmp-vsnip",
|
||||
"hrsh7th/vim-vsnip",
|
||||
"hrsh7th/cmp-emoji",
|
||||
},
|
||||
})
|
||||
use({
|
||||
"L3MON4D3/LuaSnip",
|
||||
requires = {
|
||||
"rafamadriz/friendly-snippets",
|
||||
},
|
||||
-- follow latest release.
|
||||
tag = "v<CurrentMajor>.*",
|
||||
-- install jsregexp (optional!:).
|
||||
run = "make install_jsregexp",
|
||||
})
|
||||
-- golang ide
|
||||
use({
|
||||
"ray-x/go.nvim",
|
||||
"ray-x/guihua.lua", -- recommended if need floating window support
|
||||
})
|
||||
-- 高亮当前关键词
|
||||
use({ "RRethy/vim-illuminate" })
|
||||
-- 罗列文件中的所有url
|
||||
use("axieax/urlview.nvim")
|
||||
-- 快捷键提示
|
||||
use({
|
||||
"folke/which-key.nvim",
|
||||
config = function()
|
||||
vim.o.timeout = true
|
||||
vim.o.timeoutlen = 300
|
||||
end,
|
||||
})
|
||||
-- debug
|
||||
use({
|
||||
"theHamsta/nvim-dap-virtual-text",
|
||||
"rcarriga/nvim-dap-ui",
|
||||
"mfussenegger/nvim-dap",
|
||||
"folke/neodev.nvim",
|
||||
})
|
||||
use({
|
||||
"gelguy/wilder.nvim",
|
||||
config = function()
|
||||
-- config goes here
|
||||
end,
|
||||
})
|
||||
-- 屏幕保护
|
||||
use("eandrju/cellular-automaton.nvim")
|
||||
-- 自动保存
|
||||
if packer_bootstrap then
|
||||
require("packer").sync()
|
||||
end
|
||||
end)
|
||||
"hrsh7th/cmp-vsnip",
|
||||
"hrsh7th/vim-vsnip",
|
||||
"hrsh7th/cmp-emoji",
|
||||
},
|
||||
})
|
||||
use({
|
||||
"L3MON4D3/LuaSnip",
|
||||
requires = {
|
||||
"rafamadriz/friendly-snippets",
|
||||
},
|
||||
-- follow latest release.
|
||||
tag = "v<CurrentMajor>.*",
|
||||
-- install jsregexp (optional!:).
|
||||
run = "make install_jsregexp",
|
||||
})
|
||||
-- golang ide
|
||||
use({
|
||||
"ray-x/go.nvim",
|
||||
"ray-x/guihua.lua", -- recommended if need floating window support
|
||||
})
|
||||
-- 高亮当前关键词
|
||||
use({ "RRethy/vim-illuminate" })
|
||||
-- 罗列文件中的所有url
|
||||
use("axieax/urlview.nvim")
|
||||
-- 快捷键提示
|
||||
use({
|
||||
"folke/which-key.nvim",
|
||||
config = function()
|
||||
vim.o.timeout = true
|
||||
vim.o.timeoutlen = 300
|
||||
end,
|
||||
})
|
||||
-- debug
|
||||
use({
|
||||
"theHamsta/nvim-dap-virtual-text",
|
||||
"rcarriga/nvim-dap-ui",
|
||||
"mfussenegger/nvim-dap",
|
||||
"folke/neodev.nvim",
|
||||
})
|
||||
use({
|
||||
"gelguy/wilder.nvim",
|
||||
config = function()
|
||||
-- config goes here
|
||||
end,
|
||||
})
|
||||
-- 屏幕保护
|
||||
use("eandrju/cellular-automaton.nvim")
|
||||
-- 自动保存
|
||||
if packer_bootstrap then
|
||||
require("packer").sync()
|
||||
end
|
||||
end)
|
||||
|
|
Loading…
Reference in New Issue