From 83feb53e9845b95e9c4917e2d34f83103f5bd104 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=8A=80=E6=9C=AF=E8=9B=8B=E8=80=81=E5=B8=88?= <230444994@qq.com> Date: Tue, 30 May 2023 10:07:43 +0800 Subject: [PATCH 1/4] =?UTF-8?q?1.=20=E5=A4=87=E4=BB=BDplugins-setup.lua?= =?UTF-8?q?=E6=96=87=E4=BB=B6=202.=20=E6=96=B0=E5=A2=9Eplugins-setup.lua?= =?UTF-8?q?=E6=96=87=E4=BB=B6=EF=BC=8C=E9=85=8D=E7=BD=AElazy=EF=BC=8C?= =?UTF-8?q?=E4=BF=9D=E7=95=99=E5=8E=9F=E6=9D=A5=E6=8F=92=E4=BB=B6=203.=20?= =?UTF-8?q?=E5=88=A0=E9=99=A4nvim/plugin=E6=96=87=E4=BB=B6=E5=A4=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nvim/lua/plugins/plugins-setup.lua" | 106 +++++---- .../lua/plugins/plugins-setup.lua.backup" | 68 ++++++ .../nvim/plugin/packer_compiled.lua" | 210 ------------------ 3 files changed, 118 insertions(+), 266 deletions(-) create mode 100644 "\345\256\214\346\225\264\351\205\215\347\275\256\344\273\243\347\240\201/nvim/lua/plugins/plugins-setup.lua.backup" delete mode 100644 "\345\256\214\346\225\264\351\205\215\347\275\256\344\273\243\347\240\201/nvim/plugin/packer_compiled.lua" diff --git "a/\345\256\214\346\225\264\351\205\215\347\275\256\344\273\243\347\240\201/nvim/lua/plugins/plugins-setup.lua" "b/\345\256\214\346\225\264\351\205\215\347\275\256\344\273\243\347\240\201/nvim/lua/plugins/plugins-setup.lua" index 29aa850..de2657e 100644 --- "a/\345\256\214\346\225\264\351\205\215\347\275\256\344\273\243\347\240\201/nvim/lua/plugins/plugins-setup.lua" +++ "b/\345\256\214\346\225\264\351\205\215\347\275\256\344\273\243\347\240\201/nvim/lua/plugins/plugins-setup.lua" @@ -1,68 +1,62 @@ --- 自动安装packer -local ensure_packer = function() - local fn = vim.fn - local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim' - if fn.empty(fn.glob(install_path)) > 0 then - fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path}) - vim.cmd [[packadd packer.nvim]] - return true - end - return false +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", -- latest stable release + lazypath, + }) end +vim.opt.rtp:prepend(lazypath) -local packer_bootstrap = ensure_packer() --- 保存此文件自动更新安装软件 --- 注意PackerCompile改成了PackerSync --- plugins.lua改成了plugins-setup.lua,适应本地文件名字 -vim.cmd([[ - augroup packer_user_config - autocmd! - autocmd BufWritePost plugins-setup.lua source | PackerSync - augroup end -]]) +local plugins = { + "folke/tokyonight.nvim", -- 主题 -return require('packer').startup(function(use) - use 'wbthomason/packer.nvim' - use 'folke/tokyonight.nvim' -- 主题 - use { - 'nvim-lualine/lualine.nvim', -- 状态栏 - requires = { 'kyazdani42/nvim-web-devicons', opt = true } -- 状态栏图标 - } - use { - 'nvim-tree/nvim-tree.lua', -- 文档树 + { + "nvim-lualine/lualine.nvim", -- 状态栏 + requires = { "kyazdani42/nvim-web-devicons", opt = true } -- 状态栏图标 + }, + + { + "nvim-tree/nvim-tree.lua", -- 文档树 requires = { - 'nvim-tree/nvim-web-devicons', -- 文档树图标 + "nvim-tree/nvim-web-devicons", -- 文档树图标 } - } - use "christoomey/vim-tmux-navigator" -- 用ctl-hjkl来定位窗口 - use "nvim-treesitter/nvim-treesitter" -- 语法高亮 - use "p00f/nvim-ts-rainbow" -- 配合treesitter,不同括号颜色区分 - use { + }, + + "christoomey/vim-tmux-navigator", -- 用ctl-hjkl来定位窗口 + "nvim-treesitter/nvim-treesitter", -- 语法高亮 + "p00f/nvim-ts-rainbow", -- 配合treesitter,不同括号颜色区分 + + { "williamboman/mason.nvim", - "williamboman/mason-lspconfig.nvim", -- 这个相当于mason.nvim和lspconfig的桥梁 + "williamboman/mason-lspconfig.nvim", -- 这个相当于mason.nvim和lspconfig的桥梁 "neovim/nvim-lspconfig" - } - -- 自动补全 - use "hrsh7th/nvim-cmp" - use "hrsh7th/cmp-nvim-lsp" - use "L3MON4D3/LuaSnip" -- snippets引擎,不装这个自动补全会出问题 - use "saadparwaiz1/cmp_luasnip" - use "rafamadriz/friendly-snippets" - use "hrsh7th/cmp-path" -- 文件路径 + }, + + -- 自动补全 + "hrsh7th/nvim-cmp", + "hrsh7th/cmp-nvim-lsp", + "L3MON4D3/LuaSnip", -- snippets引擎,不装这个自动补全会出问题 + "saadparwaiz1/cmp_luasnip", + "rafamadriz/friendly-snippets", + "hrsh7th/cmp-path", -- 文件路径 + + "numToStr/Comment.nvim", -- gcc和gc注释 + "windwp/nvim-autopairs", -- 自动补全括号 - use "numToStr/Comment.nvim" -- gcc和gc注释 - use "windwp/nvim-autopairs" -- 自动补全括号 + "akinsho/bufferline.nvim", -- buffer分割线 + "lewis6991/gitsigns.nvim", -- 左则git提示 - use "akinsho/bufferline.nvim" -- buffer分割线 - use "lewis6991/gitsigns.nvim" -- 左则git提示 + { + 'nvim-telescope/telescope.nvim', tag = '0.1.1', -- 文件检索 + dependencies = { {'nvim-lua/plenary.nvim'} } -- requires要改为dependencies + }, - use { - 'nvim-telescope/telescope.nvim', tag = '0.1.1', -- 文件检索 - requires = { {'nvim-lua/plenary.nvim'} } - } +} +local opts = {} -- 注意要定义这个变量 - if packer_bootstrap then - require('packer').sync() - end -end) +require("lazy").setup(plugins, opts) diff --git "a/\345\256\214\346\225\264\351\205\215\347\275\256\344\273\243\347\240\201/nvim/lua/plugins/plugins-setup.lua.backup" "b/\345\256\214\346\225\264\351\205\215\347\275\256\344\273\243\347\240\201/nvim/lua/plugins/plugins-setup.lua.backup" new file mode 100644 index 0000000..29aa850 --- /dev/null +++ "b/\345\256\214\346\225\264\351\205\215\347\275\256\344\273\243\347\240\201/nvim/lua/plugins/plugins-setup.lua.backup" @@ -0,0 +1,68 @@ +-- 自动安装packer +local ensure_packer = function() + local fn = vim.fn + local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim' + if fn.empty(fn.glob(install_path)) > 0 then + fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path}) + vim.cmd [[packadd packer.nvim]] + return true + end + return false +end + +local packer_bootstrap = ensure_packer() + +-- 保存此文件自动更新安装软件 +-- 注意PackerCompile改成了PackerSync +-- plugins.lua改成了plugins-setup.lua,适应本地文件名字 +vim.cmd([[ + augroup packer_user_config + autocmd! + autocmd BufWritePost plugins-setup.lua source | PackerSync + augroup end +]]) + +return require('packer').startup(function(use) + use 'wbthomason/packer.nvim' + use 'folke/tokyonight.nvim' -- 主题 + use { + 'nvim-lualine/lualine.nvim', -- 状态栏 + requires = { 'kyazdani42/nvim-web-devicons', opt = true } -- 状态栏图标 + } + use { + 'nvim-tree/nvim-tree.lua', -- 文档树 + requires = { + 'nvim-tree/nvim-web-devicons', -- 文档树图标 + } + } + use "christoomey/vim-tmux-navigator" -- 用ctl-hjkl来定位窗口 + use "nvim-treesitter/nvim-treesitter" -- 语法高亮 + use "p00f/nvim-ts-rainbow" -- 配合treesitter,不同括号颜色区分 + use { + "williamboman/mason.nvim", + "williamboman/mason-lspconfig.nvim", -- 这个相当于mason.nvim和lspconfig的桥梁 + "neovim/nvim-lspconfig" + } + -- 自动补全 + use "hrsh7th/nvim-cmp" + use "hrsh7th/cmp-nvim-lsp" + use "L3MON4D3/LuaSnip" -- snippets引擎,不装这个自动补全会出问题 + use "saadparwaiz1/cmp_luasnip" + use "rafamadriz/friendly-snippets" + use "hrsh7th/cmp-path" -- 文件路径 + + use "numToStr/Comment.nvim" -- gcc和gc注释 + use "windwp/nvim-autopairs" -- 自动补全括号 + + use "akinsho/bufferline.nvim" -- buffer分割线 + use "lewis6991/gitsigns.nvim" -- 左则git提示 + + use { + 'nvim-telescope/telescope.nvim', tag = '0.1.1', -- 文件检索 + requires = { {'nvim-lua/plenary.nvim'} } + } + + if packer_bootstrap then + require('packer').sync() + end +end) diff --git "a/\345\256\214\346\225\264\351\205\215\347\275\256\344\273\243\347\240\201/nvim/plugin/packer_compiled.lua" "b/\345\256\214\346\225\264\351\205\215\347\275\256\344\273\243\347\240\201/nvim/plugin/packer_compiled.lua" deleted file mode 100644 index 6569474..0000000 --- "a/\345\256\214\346\225\264\351\205\215\347\275\256\344\273\243\347\240\201/nvim/plugin/packer_compiled.lua" +++ /dev/null @@ -1,210 +0,0 @@ --- Automatically generated packer.nvim plugin loader code - -if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then - vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"') - return -end - -vim.api.nvim_command('packadd packer.nvim') - -local no_errors, error_msg = pcall(function() - -_G._packer = _G._packer or {} -_G._packer.inside_compile = true - -local time -local profile_info -local should_profile = false -if should_profile then - local hrtime = vim.loop.hrtime - profile_info = {} - time = function(chunk, start) - if start then - profile_info[chunk] = hrtime() - else - profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6 - end - end -else - time = function(chunk, start) end -end - -local function save_profiles(threshold) - local sorted_times = {} - for chunk_name, time_taken in pairs(profile_info) do - sorted_times[#sorted_times + 1] = {chunk_name, time_taken} - end - table.sort(sorted_times, function(a, b) return a[2] > b[2] end) - local results = {} - for i, elem in ipairs(sorted_times) do - if not threshold or threshold and elem[2] > threshold then - results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms' - end - end - if threshold then - table.insert(results, '(Only showing plugins that took longer than ' .. threshold .. ' ms ' .. 'to load)') - end - - _G._packer.profile_output = results -end - -time([[Luarocks path setup]], true) -local package_path_str = "/root/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/root/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/root/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/root/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua" -local install_cpath_pattern = "/root/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so" -if not string.find(package.path, package_path_str, 1, true) then - package.path = package.path .. ';' .. package_path_str -end - -if not string.find(package.cpath, install_cpath_pattern, 1, true) then - package.cpath = package.cpath .. ';' .. install_cpath_pattern -end - -time([[Luarocks path setup]], false) -time([[try_loadstring definition]], true) -local function try_loadstring(s, component, name) - local success, result = pcall(loadstring(s), name, _G.packer_plugins[name]) - if not success then - vim.schedule(function() - vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {}) - end) - end - return result -end - -time([[try_loadstring definition]], false) -time([[Defining packer_plugins]], true) -_G.packer_plugins = { - ["Comment.nvim"] = { - loaded = true, - path = "/root/.local/share/nvim/site/pack/packer/start/Comment.nvim", - url = "https://github.com/numToStr/Comment.nvim" - }, - LuaSnip = { - loaded = true, - path = "/root/.local/share/nvim/site/pack/packer/start/LuaSnip", - url = "https://github.com/L3MON4D3/LuaSnip" - }, - ["bufferline.nvim"] = { - loaded = true, - path = "/root/.local/share/nvim/site/pack/packer/start/bufferline.nvim", - url = "https://github.com/akinsho/bufferline.nvim" - }, - ["cmp-nvim-lsp"] = { - loaded = true, - path = "/root/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp", - url = "https://github.com/hrsh7th/cmp-nvim-lsp" - }, - ["cmp-path"] = { - loaded = true, - path = "/root/.local/share/nvim/site/pack/packer/start/cmp-path", - url = "https://github.com/hrsh7th/cmp-path" - }, - cmp_luasnip = { - loaded = true, - path = "/root/.local/share/nvim/site/pack/packer/start/cmp_luasnip", - url = "https://github.com/saadparwaiz1/cmp_luasnip" - }, - ["friendly-snippets"] = { - loaded = true, - path = "/root/.local/share/nvim/site/pack/packer/start/friendly-snippets", - url = "https://github.com/rafamadriz/friendly-snippets" - }, - ["gitsigns.nvim"] = { - loaded = true, - path = "/root/.local/share/nvim/site/pack/packer/start/gitsigns.nvim", - url = "https://github.com/lewis6991/gitsigns.nvim" - }, - ["lualine.nvim"] = { - loaded = true, - path = "/root/.local/share/nvim/site/pack/packer/start/lualine.nvim", - url = "https://github.com/nvim-lualine/lualine.nvim" - }, - ["mason-lspconfig.nvim"] = { - loaded = true, - path = "/root/.local/share/nvim/site/pack/packer/start/mason-lspconfig.nvim", - url = "https://github.com/williamboman/mason-lspconfig.nvim" - }, - ["mason.nvim"] = { - loaded = true, - path = "/root/.local/share/nvim/site/pack/packer/start/mason.nvim", - url = "https://github.com/williamboman/mason.nvim" - }, - ["nvim-autopairs"] = { - loaded = true, - path = "/root/.local/share/nvim/site/pack/packer/start/nvim-autopairs", - url = "https://github.com/windwp/nvim-autopairs" - }, - ["nvim-cmp"] = { - loaded = true, - path = "/root/.local/share/nvim/site/pack/packer/start/nvim-cmp", - url = "https://github.com/hrsh7th/nvim-cmp" - }, - ["nvim-lspconfig"] = { - loaded = true, - path = "/root/.local/share/nvim/site/pack/packer/start/nvim-lspconfig", - url = "https://github.com/neovim/nvim-lspconfig" - }, - ["nvim-tree.lua"] = { - loaded = true, - path = "/root/.local/share/nvim/site/pack/packer/start/nvim-tree.lua", - url = "https://github.com/nvim-tree/nvim-tree.lua" - }, - ["nvim-treesitter"] = { - loaded = true, - path = "/root/.local/share/nvim/site/pack/packer/start/nvim-treesitter", - url = "https://github.com/nvim-treesitter/nvim-treesitter" - }, - ["nvim-ts-rainbow"] = { - loaded = true, - path = "/root/.local/share/nvim/site/pack/packer/start/nvim-ts-rainbow", - url = "https://github.com/p00f/nvim-ts-rainbow" - }, - ["nvim-web-devicons"] = { - loaded = false, - needs_bufread = false, - path = "/root/.local/share/nvim/site/pack/packer/opt/nvim-web-devicons", - url = "https://github.com/kyazdani42/nvim-web-devicons" - }, - ["packer.nvim"] = { - loaded = true, - path = "/root/.local/share/nvim/site/pack/packer/start/packer.nvim", - url = "https://github.com/wbthomason/packer.nvim" - }, - ["plenary.nvim"] = { - loaded = true, - path = "/root/.local/share/nvim/site/pack/packer/start/plenary.nvim", - url = "https://github.com/nvim-lua/plenary.nvim" - }, - ["telescope.nvim"] = { - loaded = true, - path = "/root/.local/share/nvim/site/pack/packer/start/telescope.nvim", - url = "https://github.com/nvim-telescope/telescope.nvim" - }, - ["tokyonight.nvim"] = { - loaded = true, - path = "/root/.local/share/nvim/site/pack/packer/start/tokyonight.nvim", - url = "https://github.com/folke/tokyonight.nvim" - }, - ["vim-tmux-navigator"] = { - loaded = true, - path = "/root/.local/share/nvim/site/pack/packer/start/vim-tmux-navigator", - url = "https://github.com/christoomey/vim-tmux-navigator" - } -} - -time([[Defining packer_plugins]], false) - -_G._packer.inside_compile = false -if _G._packer.needs_bufread == true then - vim.cmd("doautocmd BufRead") -end -_G._packer.needs_bufread = false - -if should_profile then save_profiles() end - -end) - -if not no_errors then - error_msg = error_msg:gsub('"', '\\"') - vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None') -end From ee2eb4a40c0b663c4cf96c452c32d317867de17a Mon Sep 17 00:00:00 2001 From: eggtoopain <42341074+eggtoopain@users.noreply.github.com> Date: Tue, 30 May 2023 11:21:24 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=9B=B4=E6=96=B0treesitter.lua?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit “help”需要改为"vimdoc",不然在使用lazy的时候会出错 --- .../nvim/lua/plugins/treesitter.lua" | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git "a/\345\256\214\346\225\264\351\205\215\347\275\256\344\273\243\347\240\201/nvim/lua/plugins/treesitter.lua" "b/\345\256\214\346\225\264\351\205\215\347\275\256\344\273\243\347\240\201/nvim/lua/plugins/treesitter.lua" index 6160ba3..623d4b1 100644 --- "a/\345\256\214\346\225\264\351\205\215\347\275\256\344\273\243\347\240\201/nvim/lua/plugins/treesitter.lua" +++ "b/\345\256\214\346\225\264\351\205\215\347\275\256\344\273\243\347\240\201/nvim/lua/plugins/treesitter.lua" @@ -1,6 +1,6 @@ require'nvim-treesitter.configs'.setup { -- 添加不同语言 - ensure_installed = { "vim", "help", "bash", "c", "cpp", "javascript", "json", "lua", "python", "typescript", "tsx", "css", "rust", "markdown", "markdown_inline" }, -- one of "all" or a list of languages + ensure_installed = { "vim", "vimdoc", "bash", "c", "cpp", "javascript", "json", "lua", "python", "typescript", "tsx", "css", "rust", "markdown", "markdown_inline" }, -- one of "all" or a list of languages highlight = { enable = true }, indent = { enable = true }, From b2e6138e25d1ad9dc07c84d0bdcd8c509ccb1417 Mon Sep 17 00:00:00 2001 From: eggtoopain <42341074+eggtoopain@users.noreply.github.com> Date: Wed, 31 May 2023 12:31:23 +0800 Subject: [PATCH 3/4] Update plugins-setup.lua MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit requires修改为dependencies --- .../nvim/lua/plugins/plugins-setup.lua" | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git "a/\345\256\214\346\225\264\351\205\215\347\275\256\344\273\243\347\240\201/nvim/lua/plugins/plugins-setup.lua" "b/\345\256\214\346\225\264\351\205\215\347\275\256\344\273\243\347\240\201/nvim/lua/plugins/plugins-setup.lua" index de2657e..322153a 100644 --- "a/\345\256\214\346\225\264\351\205\215\347\275\256\344\273\243\347\240\201/nvim/lua/plugins/plugins-setup.lua" +++ "b/\345\256\214\346\225\264\351\205\215\347\275\256\344\273\243\347\240\201/nvim/lua/plugins/plugins-setup.lua" @@ -17,12 +17,12 @@ local plugins = { { "nvim-lualine/lualine.nvim", -- 状态栏 - requires = { "kyazdani42/nvim-web-devicons", opt = true } -- 状态栏图标 + dependencies = { "kyazdani42/nvim-web-devicons", opt = true } -- 状态栏图标 }, { "nvim-tree/nvim-tree.lua", -- 文档树 - requires = { + dependencies = { "nvim-tree/nvim-web-devicons", -- 文档树图标 } }, From 8a061b388246a5638559af76bae221c336944679 Mon Sep 17 00:00:00 2001 From: eggtoopain <42341074+eggtoopain@users.noreply.github.com> Date: Wed, 31 May 2023 12:40:14 +0800 Subject: [PATCH 4/4] Update plugins-setup.lua MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 删除其中一个nvim-web-devicons,不然会报错 --- .../nvim/lua/plugins/plugins-setup.lua" | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git "a/\345\256\214\346\225\264\351\205\215\347\275\256\344\273\243\347\240\201/nvim/lua/plugins/plugins-setup.lua" "b/\345\256\214\346\225\264\351\205\215\347\275\256\344\273\243\347\240\201/nvim/lua/plugins/plugins-setup.lua" index 322153a..0537df8 100644 --- "a/\345\256\214\346\225\264\351\205\215\347\275\256\344\273\243\347\240\201/nvim/lua/plugins/plugins-setup.lua" +++ "b/\345\256\214\346\225\264\351\205\215\347\275\256\344\273\243\347\240\201/nvim/lua/plugins/plugins-setup.lua" @@ -14,18 +14,9 @@ vim.opt.rtp:prepend(lazypath) local plugins = { "folke/tokyonight.nvim", -- 主题 - - { - "nvim-lualine/lualine.nvim", -- 状态栏 - dependencies = { "kyazdani42/nvim-web-devicons", opt = true } -- 状态栏图标 - }, - - { - "nvim-tree/nvim-tree.lua", -- 文档树 - dependencies = { - "nvim-tree/nvim-web-devicons", -- 文档树图标 - } - }, + "nvim-lualine/lualine.nvim", -- 状态栏 + "nvim-tree/nvim-tree.lua", -- 文档树 + "nvim-tree/nvim-web-devicons", -- 文档树图标 "christoomey/vim-tmux-navigator", -- 用ctl-hjkl来定位窗口 "nvim-treesitter/nvim-treesitter", -- 语法高亮