增加格式化插件;格式化配置;增加搜索插件

This commit is contained in:
LingZhaoHui 2024-06-20 00:46:34 +08:00
parent dc5fda281a
commit 1ed88eaaca
Signed by: zeekling
GPG Key ID: D96E4E75267CA2CC
12 changed files with 407 additions and 345 deletions

View File

@ -1,48 +1,67 @@
return { return {
{ {
"hrsh7th/nvim-cmp", "hrsh7th/nvim-cmp",
dependencies = { dependencies = {
"hrsh7th/cmp-buffer", "hrsh7th/cmp-buffer",
"hrsh7th/cmp-path", "hrsh7th/cmp-path",
"hrsh7th/cmp-nvim-lsp", "hrsh7th/cmp-nvim-lsp",
"L3MON4D3/LuaSnip", "L3MON4D3/LuaSnip",
"saadparwaiz1/cmp_luasnip", "saadparwaiz1/cmp_luasnip",
}, },
config = function() config = function()
local cmp = require("cmp") local cmp = require("cmp")
cmp.setup({ cmp.setup({
snippet = { snippet = {
expand = function(args) expand = function(args)
require("luasnip").lsp_expand(args.body) require("luasnip").lsp_expand(args.body)
end, end,
}, },
mapping = cmp.mapping.preset.insert({ mapping = cmp.mapping.preset.insert({
['<C-b>'] = cmp.mapping.scroll_docs(-4), ["<C-b>"] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4), ["<C-f>"] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(), ["<C-Space>"] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.abort(), ["<C-e>"] = cmp.mapping.abort(),
['<CR>'] = cmp.mapping.confirm({ select = true }), ["<CR>"] = cmp.mapping.confirm({ select = true }),
}), }),
sources = cmp.config.sources({ sources = cmp.config.sources({
{ name = 'nvim_lsp' }, { name = "nvim_lsp" },
{ name = 'luasnip' }, { name = "luasnip" },
}, { }, {
{ name = 'buffer' }, { name = "buffer" },
{ name = "path" }, { name = "path" },
}), }),
}) })
end, end,
}, },
{ {
"neovim/nvim-lspconfig" "neovim/nvim-lspconfig",
}, },
{ {
"nvim-treesitter/nvim-treesitter", "nvim-treesitter/nvim-treesitter",
config = function() config = function()
require('nvim-treesitter.configs').setup { require("nvim-treesitter.configs").setup({
ensure_installed = { 'c', 'cpp', 'cmake', 'bash', 'go', 'lua', 'python', 'java', 'git_config', 'git_rebase', 'gitattributes', 'gitcommit', 'gitignore', 'groovy', 'json', 'sql', 'vim', 'xml', 'tcl'}, ensure_installed = {
} "c",
end, "cpp",
} "cmake",
"bash",
"go",
"lua",
"python",
"java",
"git_config",
"git_rebase",
"gitattributes",
"gitcommit",
"gitignore",
"groovy",
"json",
"sql",
"vim",
"xml",
"tcl",
},
})
end,
},
} }

View File

@ -9,7 +9,7 @@ return {
-- 快捷键在这里定义 -- 快捷键在这里定义
wk.register({ wk.register({
["<leader>"] = { ["<leader>"] = {
b = { b = {
name="Buffer", name="Buffer",
p={"<cmd>BufferLineCyclePrev<cr>", "Go to pre buffer"}, p={"<cmd>BufferLineCyclePrev<cr>", "Go to pre buffer"},
n={"<cmd>BufferLineCycleNext<cr>", "Go to next buffer"}, n={"<cmd>BufferLineCycleNext<cr>", "Go to next buffer"},
@ -19,13 +19,24 @@ return {
name="dirTree", name="dirTree",
s={"<cmd>NvimTreeToggle<cr>", "show dir tree on left"}, s={"<cmd>NvimTreeToggle<cr>", "show dir tree on left"},
c={"<cmd>NvimTreeClose<cr>", "hidden dir tree on left"} c={"<cmd>NvimTreeClose<cr>", "hidden dir tree on left"}
}, },
l = { f = {
name="Lazy", name="Search,Format",
s={"<cmd>Lazy show<cr>", "Lazy show"}, s={
i={"<cmd>Lazy install<cr>", "Lazy install"}, name="search",
u={"<cmd>Lazy update<cr>", "Lazy update"},
}, f={"<cmd>Telescope find_files<cr>", "Search file by name"},
g={"<cmd>Telescope live_grep<cr>", "Grep in files"},
b={"<cmd>Telescope buffers<cr>", "Grep in buffer"},
},
f={"<cmd>Format<cr>", "Code Format"}
},
l = {
name="Lazy",
s={"<cmd>Lazy show<cr>", "Lazy show"},
i={"<cmd>Lazy install<cr>", "Lazy install"},
u={"<cmd>Lazy update<cr>", "Lazy update"},
},
m = { m = {
name="Markdown", name="Markdown",
k={ k={
@ -38,9 +49,6 @@ return {
name = "version", name = "version",
v={"<cmd>version<cr>", "neovim version"}, v={"<cmd>version<cr>", "neovim version"},
}, },
s = {
name="Search"
},
} }
}, {silent = true, noremap = true}) }, {silent = true, noremap = true})
wk.setup() wk.setup()

View File

@ -1,26 +1,41 @@
return { return {
'nvim-java/nvim-java', "nvim-java/nvim-java",
dependencies = { dependencies = {
'nvim-java/lua-async-await', "nvim-java/lua-async-await",
'nvim-java/nvim-java-refactor', "nvim-java/nvim-java-refactor",
'nvim-java/nvim-java-core', "nvim-java/nvim-java-core",
'nvim-java/nvim-java-test', "nvim-java/nvim-java-test",
'nvim-java/nvim-java-dap', "nvim-java/nvim-java-dap",
'MunifTanjim/nui.nvim', "MunifTanjim/nui.nvim",
'neovim/nvim-lspconfig', "neovim/nvim-lspconfig",
'mfussenegger/nvim-dap', "mfussenegger/nvim-dap",
{ {
'williamboman/mason.nvim', "williamboman/mason.nvim",
opts = { opts = {
registries = { registries = {
'github:nvim-java/mason-registry', "github:nvim-java/mason-registry",
'github:mason-org/mason-registry', "github:mason-org/mason-registry",
}, },
}, },
} },
}, },
config = function() config = function()
require('java').setup({ require("java").setup({
}) root_markers = {
end, "settings.gradle",
"settings.gradle.kts",
"pom.xml",
"build.gradle",
"mvnw",
"gradlew",
"build.gradle",
"build.gradle.kts",
".git",
},
java_test = {
enable = true,
},
})
require("lspconfig").jdtls.setup({})
end,
} }

View File

@ -1,8 +1,9 @@
return { return {
{ {
"ray-x/lsp_signature.nvim", "ray-x/lsp_signature.nvim",
event = "BufRead", event = "BufRead",
config = function() require"lsp_signature".on_attach() end, config = function()
}, require("lsp_signature").on_attach()
end,
},
} }

View File

@ -1,9 +1,8 @@
return { return {
"iamcco/markdown-preview.nvim", "iamcco/markdown-preview.nvim",
cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" }, cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" },
ft = { "markdown" }, ft = { "markdown" },
build = function() build = function()
vim.fn["mkdp#util#install"]() vim.fn["mkdp#util#install"]()
end, end,
} }

View File

@ -1,161 +1,177 @@
return { return {
{ {
"nathom/filetype.nvim", "nathom/filetype.nvim",
event = "User FileOpened", event = "User FileOpened",
config = function() config = function()
require("filetype").setup({ require("filetype").setup({
overrides = { overrides = {
extensions = { extensions = {
h = "cpp", h = "cpp",
}, },
} },
}) })
end end,
}, },
{ {
"HiPhish/nvim-ts-rainbow2", "HiPhish/nvim-ts-rainbow2",
-- Bracket pair rainbow colorize -- Bracket pair rainbow colorize
event = { "User FileOpened" }, event = { "User FileOpened" },
}, },
{ {
"romgrk/nvim-treesitter-context", "romgrk/nvim-treesitter-context",
lazy = true, lazy = true,
event = { "User FileOpened" }, event = { "User FileOpened" },
config = function() config = function()
require("treesitter-context").setup({ require("treesitter-context").setup({
enable = true, enable = true,
throttle = true, throttle = true,
max_lines = 0, max_lines = 0,
patterns = { patterns = {
default = { default = {
"class", "class",
"function", "function",
"method", "method",
}, },
}, },
}) })
end, end,
}, },
{ {
"windwp/nvim-spectre", "windwp/nvim-spectre",
cmd = { "Spectre" }, cmd = { "Spectre" },
config = function() config = function()
require("spectre").setup() require("spectre").setup()
end, end,
}, },
{ {
"andymass/vim-matchup", "andymass/vim-matchup",
-- Highlight, jump between pairs like if..else -- Highlight, jump between pairs like if..else
event = { "User FileOpened" }, event = { "User FileOpened" },
config = function() config = function()
vim.g.matchup_matchparen_offscreen = { method = "popup" } vim.g.matchup_matchparen_offscreen = { method = "popup" }
lvim.builtin.treesitter.matchup.enable = true lvim.builtin.treesitter.matchup.enable = true
end, end,
}, },
{ {
"rcarriga/nvim-notify", "rcarriga/nvim-notify",
lazy = true, lazy = true,
event = "VeryLazy", event = "VeryLazy",
config = function() config = function()
local notify = require("notify") local notify = require("notify")
notify.setup({ notify.setup({
-- "fade", "slide", "fade_in_slide_out", "static" -- "fade", "slide", "fade_in_slide_out", "static"
stages = "static", stages = "static",
on_open = nil, on_open = nil,
on_close = nil, on_close = nil,
timeout = 3000, timeout = 3000,
fps = 1, fps = 1,
render = "default", render = "default",
background_colour = "Normal", background_colour = "Normal",
max_width = math.floor(vim.api.nvim_win_get_width(0) / 2), max_width = math.floor(vim.api.nvim_win_get_width(0) / 2),
max_height = math.floor(vim.api.nvim_win_get_height(0) / 4), max_height = math.floor(vim.api.nvim_win_get_height(0) / 4),
-- minimum_width = 50, -- minimum_width = 50,
-- ERROR > WARN > INFO > DEBUG > TRACE -- ERROR > WARN > INFO > DEBUG > TRACE
level = "TRACE", level = "TRACE",
}) })
vim.notify = notify
end,
},
{
"folke/noice.nvim",
enabled = ENABLE_NOICE,
event = { "BufRead", "BufNewFile" },
dependencies = { "rcarriga/nvim-notify", "MunifTanjim/nui.nvim" },
config = function()
require("noice").setup({
lsp = {
progress = {
enabled = false,
},
},
presets = {
bottom_search = false,
command_palette = true,
long_message_to_split = true,
inc_rename = false,
lsp_doc_border = true,
},
messages = {
enabled = true,
view = "notify",
view_error = "notify",
view_warn = "notify",
view_history = "messages",
view_search = "virtualtext",
},
health = {
checker = false,
},
})
end,
},
{ "lukas-reineke/cmp-under-comparator" },
{
"ray-x/cmp-treesitter",
},
{
'nvim-lualine/lualine.nvim',
config = function()
require('lualine').setup()
end
},
{
"nvim-neo-tree/neo-tree.nvim",
branch = "v3.x",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
"MunifTanjim/nui.nvim",
-- "3rd/image.nvim", -- Optional image support in preview window: See `# Preview Mode` for more information
}
},
{
"tiagovla/scope.nvim",
},
{
"akinsho/bufferline.nvim",
tag = "v3.*",
config = function()
vim.g.termguicolors = true
require("bufferline").setup()
end,
},
{
'nvimdev/dashboard-nvim',
event = 'VimEnter',
config = function()
require('dashboard').setup {
-- config
}
end,
dependencies = { {'nvim-tree/nvim-web-devicons'}}
},
{
"azabiong/vim-highlighter",
},
{"stevearc/dressing.nvim",
opts = {}}
vim.notify = notify
end,
},
{
"folke/noice.nvim",
enabled = ENABLE_NOICE,
event = { "BufRead", "BufNewFile" },
dependencies = { "rcarriga/nvim-notify", "MunifTanjim/nui.nvim" },
config = function()
require("noice").setup({
lsp = {
progress = {
enabled = false,
},
},
presets = {
bottom_search = false,
command_palette = true,
long_message_to_split = true,
inc_rename = false,
lsp_doc_border = true,
},
messages = {
enabled = true,
view = "notify",
view_error = "notify",
view_warn = "notify",
view_history = "messages",
view_search = "virtualtext",
},
health = {
checker = false,
},
})
end,
},
{ "lukas-reineke/cmp-under-comparator" },
{
"ray-x/cmp-treesitter",
},
{
"nvim-lualine/lualine.nvim",
config = function()
require("lualine").setup()
end,
},
{
"nvim-neo-tree/neo-tree.nvim",
branch = "v3.x",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
"MunifTanjim/nui.nvim",
-- "3rd/image.nvim", -- Optional image support in preview window: See `# Preview Mode` for more information
},
},
{
"tiagovla/scope.nvim",
},
{
"akinsho/bufferline.nvim",
tag = "v3.*",
config = function()
vim.g.termguicolors = true
require("bufferline").setup()
end,
},
{
"nvimdev/dashboard-nvim",
event = "VimEnter",
config = function()
require("dashboard").setup({
-- config
})
end,
dependencies = { { "nvim-tree/nvim-web-devicons" } },
},
{
"azabiong/vim-highlighter",
},
{
"stevearc/dressing.nvim",
opts = {},
},
{
"mhartington/formatter.nvim",
config = function()
require("formatter").setup({
logging = true,
log_level = vim.log.levels.WARN,
filetype = {
lua = { require("formatter.filetypes.lua").stylua },
java = { require("formatter.filetypes.java").clangformat },
},
["*"] = {
require("formatter.filetypes.any").remove_trailing_whitespace,
},
})
end,
},
} }

View File

@ -1,6 +1,5 @@
return { return {
{ {
"tpope/vim-fugitive", "tpope/vim-fugitive",
} },
} }

View File

@ -1,10 +1,10 @@
return { return {
{ {
"nvim-tree/nvim-tree.lua", "nvim-tree/nvim-tree.lua",
version = "*", version = "*",
dependencies = {"nvim-tree/nvim-web-devicons"}, dependencies = { "nvim-tree/nvim-web-devicons" },
config = function() config = function()
require("nvim-tree").setup {} require("nvim-tree").setup({})
end end,
} },
} }

View File

@ -0,0 +1,7 @@
return {
{
"nvim-telescope/telescope.nvim",
tag = "0.1.8",
dependencies = { "nvim-lua/plenary.nvim" },
},
}

View File

@ -1,72 +1,71 @@
return { return {
{ {
"simrat39/symbols-outline.nvim", "simrat39/symbols-outline.nvim",
config = function() config = function()
require("symbols-outline").setup({ require("symbols-outline").setup({
highlight_hovered_item = true, highlight_hovered_item = true,
show_guides = true, show_guides = true,
auto_preview = false, auto_preview = false,
position = 'right', position = "right",
relative_width = true, relative_width = true,
width = 25, width = 25,
auto_close = false, auto_close = false,
show_numbers = false, show_numbers = false,
show_relative_numbers = false, show_relative_numbers = false,
show_symbol_details = true, show_symbol_details = true,
preview_bg_highlight = 'Pmenu', preview_bg_highlight = "Pmenu",
autofold_depth = nil, autofold_depth = nil,
auto_unfold_hover = true, auto_unfold_hover = true,
fold_markers = { '', '' }, fold_markers = { "", "" },
wrap = false, wrap = false,
keymaps = { keymaps = {
-- These keymaps can be a string or a table for multiple keys -- These keymaps can be a string or a table for multiple keys
close = { "<Esc>", "q" }, close = { "<Esc>", "q" },
goto_location = "<Cr>", goto_location = "<Cr>",
focus_location = "o", focus_location = "o",
hover_symbol = "<C-space>", hover_symbol = "<C-space>",
toggle_preview = "K", toggle_preview = "K",
rename_symbol = "r", rename_symbol = "r",
code_actions = "a", code_actions = "a",
fold = "h", fold = "h",
unfold = "l", unfold = "l",
fold_all = "W", fold_all = "W",
unfold_all = "E", unfold_all = "E",
fold_reset = "R", fold_reset = "R",
}, },
lsp_blacklist = {}, lsp_blacklist = {},
symbol_blacklist = {}, symbol_blacklist = {},
symbols = { symbols = {
File = { icon = "", hl = "@text.uri" }, File = { icon = "", hl = "@text.uri" },
Module = { icon = "", hl = "@namespace" }, Module = { icon = "", hl = "@namespace" },
Namespace = { icon = "", hl = "@namespace" }, Namespace = { icon = "", hl = "@namespace" },
Package = { icon = "", hl = "@namespace" }, Package = { icon = "", hl = "@namespace" },
Class = { icon = "𝓒", hl = "@type" }, Class = { icon = "𝓒", hl = "@type" },
Method = { icon = "ƒ", hl = "@method" }, Method = { icon = "ƒ", hl = "@method" },
Property = { icon = "", hl = "@method" }, Property = { icon = "", hl = "@method" },
Field = { icon = "", hl = "@field" }, Field = { icon = "", hl = "@field" },
Constructor = { icon = "", hl = "@constructor" }, Constructor = { icon = "", hl = "@constructor" },
Enum = { icon = "", hl = "@type" }, Enum = { icon = "", hl = "@type" },
Interface = { icon = "", hl = "@type" }, Interface = { icon = "", hl = "@type" },
Function = { icon = "", hl = "@function" }, Function = { icon = "", hl = "@function" },
Variable = { icon = "", hl = "@constant" }, Variable = { icon = "", hl = "@constant" },
Constant = { icon = "", hl = "@constant" }, Constant = { icon = "", hl = "@constant" },
String = { icon = "𝓐", hl = "@string" }, String = { icon = "𝓐", hl = "@string" },
Number = { icon = "#", hl = "@number" }, Number = { icon = "#", hl = "@number" },
Boolean = { icon = "", hl = "@boolean" }, Boolean = { icon = "", hl = "@boolean" },
Array = { icon = "", hl = "@constant" }, Array = { icon = "", hl = "@constant" },
Object = { icon = "⦿", hl = "@type" }, Object = { icon = "⦿", hl = "@type" },
Key = { icon = "🔐", hl = "@type" }, Key = { icon = "🔐", hl = "@type" },
Null = { icon = "NULL", hl = "@type" }, Null = { icon = "NULL", hl = "@type" },
EnumMember = { icon = "", hl = "@field" }, EnumMember = { icon = "", hl = "@field" },
Struct = { icon = "𝓢", hl = "@type" }, Struct = { icon = "𝓢", hl = "@type" },
Event = { icon = "🗲", hl = "@type" }, Event = { icon = "🗲", hl = "@type" },
Operator = { icon = "+", hl = "@operator" }, Operator = { icon = "+", hl = "@operator" },
TypeParameter = { icon = "𝙏", hl = "@parameter" }, TypeParameter = { icon = "𝙏", hl = "@parameter" },
Component = { icon = "", hl = "@function" }, Component = { icon = "", hl = "@function" },
Fragment = { icon = "", hl = "@constant" }, Fragment = { icon = "", hl = "@constant" },
}, },
}) })
end, end,
}, },
} }

View File

@ -1,14 +1,13 @@
return { return {
{ {
'projekt0n/github-nvim-theme', "projekt0n/github-nvim-theme",
}, },
{ {
"Mofiqul/vscode.nvim", "Mofiqul/vscode.nvim",
lazy=false, lazy = false,
config = function() config = function()
require('vscode').setup({ require("vscode").setup({})
}) vim.cmd("colorscheme vscode")
vim.cmd('colorscheme vscode') end,
end, },
}
} }