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

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

@ -10,7 +10,7 @@ if not vim.loop.fs_stat(lazypath) then
lazypath,
})
end
--
--
-- 2. 将 lazypath 设置为运行时路径
-- rtpruntime path
-- nvim进行路径搜索的时候除已有的路径还会从prepend的路径中查找

View File

@ -1,48 +1,67 @@
return {
{
"hrsh7th/nvim-cmp",
dependencies = {
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"hrsh7th/cmp-nvim-lsp",
"L3MON4D3/LuaSnip",
"saadparwaiz1/cmp_luasnip",
},
config = function()
local cmp = require("cmp")
cmp.setup({
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.abort(),
['<CR>'] = cmp.mapping.confirm({ select = true }),
}),
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
}, {
{ name = 'buffer' },
{ name = "path" },
}),
})
end,
},
{
"neovim/nvim-lspconfig"
},
{
"nvim-treesitter/nvim-treesitter",
config = function()
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'},
}
end,
}
{
"hrsh7th/nvim-cmp",
dependencies = {
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"hrsh7th/cmp-nvim-lsp",
"L3MON4D3/LuaSnip",
"saadparwaiz1/cmp_luasnip",
},
config = function()
local cmp = require("cmp")
cmp.setup({
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm({ select = true }),
}),
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "luasnip" },
}, {
{ name = "buffer" },
{ name = "path" },
}),
})
end,
},
{
"neovim/nvim-lspconfig",
},
{
"nvim-treesitter/nvim-treesitter",
config = function()
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",
},
})
end,
},
}

View File

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

View File

@ -1,26 +1,41 @@
return {
'nvim-java/nvim-java',
dependencies = {
'nvim-java/lua-async-await',
'nvim-java/nvim-java-refactor',
'nvim-java/nvim-java-core',
'nvim-java/nvim-java-test',
'nvim-java/nvim-java-dap',
'MunifTanjim/nui.nvim',
'neovim/nvim-lspconfig',
'mfussenegger/nvim-dap',
{
'williamboman/mason.nvim',
opts = {
registries = {
'github:nvim-java/mason-registry',
'github:mason-org/mason-registry',
},
},
}
},
config = function()
require('java').setup({
})
end,
"nvim-java/nvim-java",
dependencies = {
"nvim-java/lua-async-await",
"nvim-java/nvim-java-refactor",
"nvim-java/nvim-java-core",
"nvim-java/nvim-java-test",
"nvim-java/nvim-java-dap",
"MunifTanjim/nui.nvim",
"neovim/nvim-lspconfig",
"mfussenegger/nvim-dap",
{
"williamboman/mason.nvim",
opts = {
registries = {
"github:nvim-java/mason-registry",
"github:mason-org/mason-registry",
},
},
},
},
config = function()
require("java").setup({
root_markers = {
"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 {
{
"ray-x/lsp_signature.nvim",
event = "BufRead",
config = function() require"lsp_signature".on_attach() end,
},
"ray-x/lsp_signature.nvim",
event = "BufRead",
config = function()
require("lsp_signature").on_attach()
end,
},
}

View File

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

View File

@ -1,161 +1,177 @@
return {
{
"nathom/filetype.nvim",
event = "User FileOpened",
config = function()
require("filetype").setup({
overrides = {
extensions = {
h = "cpp",
},
}
})
end
},
{
"HiPhish/nvim-ts-rainbow2",
-- Bracket pair rainbow colorize
event = { "User FileOpened" },
},
{
"romgrk/nvim-treesitter-context",
lazy = true,
event = { "User FileOpened" },
config = function()
require("treesitter-context").setup({
enable = true,
throttle = true,
max_lines = 0,
patterns = {
default = {
"class",
"function",
"method",
},
},
})
end,
},
{
"windwp/nvim-spectre",
cmd = { "Spectre" },
config = function()
require("spectre").setup()
end,
},
{
"andymass/vim-matchup",
-- Highlight, jump between pairs like if..else
event = { "User FileOpened" },
config = function()
vim.g.matchup_matchparen_offscreen = { method = "popup" }
lvim.builtin.treesitter.matchup.enable = true
end,
},
{
"rcarriga/nvim-notify",
lazy = true,
event = "VeryLazy",
config = function()
local notify = require("notify")
notify.setup({
-- "fade", "slide", "fade_in_slide_out", "static"
stages = "static",
on_open = nil,
on_close = nil,
timeout = 3000,
fps = 1,
render = "default",
background_colour = "Normal",
max_width = math.floor(vim.api.nvim_win_get_width(0) / 2),
max_height = math.floor(vim.api.nvim_win_get_height(0) / 4),
-- minimum_width = 50,
-- ERROR > WARN > INFO > DEBUG > 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 = {}}
{
"nathom/filetype.nvim",
event = "User FileOpened",
config = function()
require("filetype").setup({
overrides = {
extensions = {
h = "cpp",
},
},
})
end,
},
{
"HiPhish/nvim-ts-rainbow2",
-- Bracket pair rainbow colorize
event = { "User FileOpened" },
},
{
"romgrk/nvim-treesitter-context",
lazy = true,
event = { "User FileOpened" },
config = function()
require("treesitter-context").setup({
enable = true,
throttle = true,
max_lines = 0,
patterns = {
default = {
"class",
"function",
"method",
},
},
})
end,
},
{
"windwp/nvim-spectre",
cmd = { "Spectre" },
config = function()
require("spectre").setup()
end,
},
{
"andymass/vim-matchup",
-- Highlight, jump between pairs like if..else
event = { "User FileOpened" },
config = function()
vim.g.matchup_matchparen_offscreen = { method = "popup" }
lvim.builtin.treesitter.matchup.enable = true
end,
},
{
"rcarriga/nvim-notify",
lazy = true,
event = "VeryLazy",
config = function()
local notify = require("notify")
notify.setup({
-- "fade", "slide", "fade_in_slide_out", "static"
stages = "static",
on_open = nil,
on_close = nil,
timeout = 3000,
fps = 1,
render = "default",
background_colour = "Normal",
max_width = math.floor(vim.api.nvim_win_get_width(0) / 2),
max_height = math.floor(vim.api.nvim_win_get_height(0) / 4),
-- minimum_width = 50,
-- ERROR > WARN > INFO > DEBUG > 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 = {},
},
{
"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 {
{
"tpope/vim-fugitive",
}
{
"tpope/vim-fugitive",
},
}

View File

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

View File

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