diff --git a/lua/lazynvim-init.lua b/lua/lazynvim-init.lua index 0eae6f1..8df7de6 100644 --- a/lua/lazynvim-init.lua +++ b/lua/lazynvim-init.lua @@ -10,7 +10,7 @@ if not vim.loop.fs_stat(lazypath) then lazypath, }) end --- +-- -- 2. 将 lazypath 设置为运行时路径 -- rtp(runtime path) -- nvim进行路径搜索的时候,除已有的路径,还会从prepend的路径中查找 diff --git a/lua/plugins/auto-complete.lua b/lua/plugins/auto-complete.lua index f90063f..67935b1 100644 --- a/lua/plugins/auto-complete.lua +++ b/lua/plugins/auto-complete.lua @@ -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({ - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete(), - [''] = cmp.mapping.abort(), - [''] = 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({ + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.abort(), + [""] = 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, + }, } - diff --git a/lua/plugins/help.lua b/lua/plugins/help.lua index e21f1cf..a5dc7fb 100644 --- a/lua/plugins/help.lua +++ b/lua/plugins/help.lua @@ -9,7 +9,7 @@ return { -- 快捷键在这里定义 wk.register({ [""] = { - b = { + b = { name="Buffer", p={"BufferLineCyclePrev", "Go to pre buffer"}, n={"BufferLineCycleNext", "Go to next buffer"}, @@ -19,13 +19,24 @@ return { name="dirTree", s={"NvimTreeToggle", "show dir tree on left"}, c={"NvimTreeClose", "hidden dir tree on left"} - }, - l = { - name="Lazy", - s={"Lazy show", "Lazy show"}, - i={"Lazy install", "Lazy install"}, - u={"Lazy update", "Lazy update"}, - }, + }, + f = { + name="Search,Format", + s={ + name="search", + + f={"Telescope find_files", "Search file by name"}, + g={"Telescope live_grep", "Grep in files"}, + b={"Telescope buffers", "Grep in buffer"}, + }, + f={"Format", "Code Format"} + }, + l = { + name="Lazy", + s={"Lazy show", "Lazy show"}, + i={"Lazy install", "Lazy install"}, + u={"Lazy update", "Lazy update"}, + }, m = { name="Markdown", k={ @@ -38,9 +49,6 @@ return { name = "version", v={"version", "neovim version"}, }, - s = { - name="Search" - }, } }, {silent = true, noremap = true}) wk.setup() diff --git a/lua/plugins/java-plugin.lua b/lua/plugins/java-plugin.lua index 521636c..cc22f05 100644 --- a/lua/plugins/java-plugin.lua +++ b/lua/plugins/java-plugin.lua @@ -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, } diff --git a/lua/plugins/lsp_signature.lua b/lua/plugins/lsp_signature.lua index 3b6c66e..cbe277f 100644 --- a/lua/plugins/lsp_signature.lua +++ b/lua/plugins/lsp_signature.lua @@ -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, + }, } diff --git a/lua/plugins/markdown.lua b/lua/plugins/markdown.lua index 9058ab2..8ff46d3 100644 --- a/lua/plugins/markdown.lua +++ b/lua/plugins/markdown.lua @@ -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, } - diff --git a/lua/plugins/plugin-base.lua b/lua/plugins/plugin-base.lua index e8e3b42..0d10629 100644 --- a/lua/plugins/plugin-base.lua +++ b/lua/plugins/plugin-base.lua @@ -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, + }, } diff --git a/lua/plugins/plugin-git.lua b/lua/plugins/plugin-git.lua index 18878a0..321413a 100644 --- a/lua/plugins/plugin-git.lua +++ b/lua/plugins/plugin-git.lua @@ -1,6 +1,5 @@ return { - { - "tpope/vim-fugitive", - } + { + "tpope/vim-fugitive", + }, } - diff --git a/lua/plugins/plugin-nvim-tree.lua b/lua/plugins/plugin-nvim-tree.lua index 69bfeef..fde5de6 100644 --- a/lua/plugins/plugin-nvim-tree.lua +++ b/lua/plugins/plugin-nvim-tree.lua @@ -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, + }, } diff --git a/lua/plugins/search-plugin.lua b/lua/plugins/search-plugin.lua new file mode 100644 index 0000000..c60d4c6 --- /dev/null +++ b/lua/plugins/search-plugin.lua @@ -0,0 +1,7 @@ +return { + { + "nvim-telescope/telescope.nvim", + tag = "0.1.8", + dependencies = { "nvim-lua/plenary.nvim" }, + }, +} diff --git a/lua/plugins/symbols-outline.lua b/lua/plugins/symbols-outline.lua index 2037cce..120d068 100644 --- a/lua/plugins/symbols-outline.lua +++ b/lua/plugins/symbols-outline.lua @@ -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 = { "", "q" }, - goto_location = "", - focus_location = "o", - hover_symbol = "", - 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 = { "", "q" }, + goto_location = "", + focus_location = "o", + hover_symbol = "", + 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, + }, } diff --git a/lua/plugins/themes.lua b/lua/plugins/themes.lua index d2bf59f..14effeb 100644 --- a/lua/plugins/themes.lua +++ b/lua/plugins/themes.lua @@ -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, + }, }