plugins.lua 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. -- 自动安装 Packer.nvim
  2. -- 插件安装目录
  3. -- ~/.local/share/nvim/site/pack/packer/
  4. local fn = vim.fn
  5. local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim"
  6. local paccker_bootstrap
  7. if fn.empty(fn.glob(install_path)) > 0 then
  8. vim.notify("正在安装Pakcer.nvim,请稍后...")
  9. paccker_bootstrap = fn.system({
  10. "git",
  11. "clone",
  12. "--depth",
  13. "1",
  14. "https://github.com/wbthomason/packer.nvim",
  15. -- "https://gitcode.net/mirrors/wbthomason/packer.nvim",
  16. install_path,
  17. })
  18. -- https://github.com/wbthomason/packer.nvim/issues/750
  19. local rtp_addition = vim.fn.stdpath("data") .. "/site/pack/*/start/*"
  20. if not string.find(vim.o.runtimepath, rtp_addition) then
  21. vim.o.runtimepath = rtp_addition .. "," .. vim.o.runtimepath
  22. end
  23. vim.notify("Pakcer.nvim 安装完毕")
  24. end
  25. -- Use a protected call so we don't error out on first use
  26. local status_ok, packer = pcall(require, "packer")
  27. if not status_ok then
  28. vim.notify("没有安装 packer.nvim")
  29. return
  30. end
  31. packer.startup({
  32. function(use)
  33. -- Packer 可以升级自己
  34. use("wbthomason/packer.nvim")
  35. -------------------------- plugins -------------------------------------------
  36. -- nvim-tree
  37. use({
  38. "kyazdani42/nvim-tree.lua",
  39. requires = "kyazdani42/nvim-web-devicons",
  40. })
  41. -- bufferline
  42. use({
  43. "akinsho/bufferline.nvim",
  44. requires = { "kyazdani42/nvim-web-devicons", "moll/vim-bbye" },
  45. })
  46. -- lualine
  47. use({
  48. "nvim-lualine/lualine.nvim",
  49. requires = { "kyazdani42/nvim-web-devicons" },
  50. })
  51. --------------------- LSP --------------------
  52. -- use({ "williamboman/nvim-lsp-installer", commit = "36b44679f7cc73968dbb3b09246798a19f7c14e0" })
  53. use({ "williamboman/nvim-lsp-installer" })
  54. -- Lspconfig
  55. use({ "neovim/nvim-lspconfig" })
  56. -- 补全引擎
  57. use("hrsh7th/nvim-cmp")
  58. -- Snippet 引擎
  59. use("hrsh7th/vim-vsnip")
  60. -- 补全源
  61. use("hrsh7th/cmp-vsnip")
  62. use("hrsh7th/cmp-nvim-lsp") -- { name = nvim_lsp }
  63. use("hrsh7th/cmp-buffer") -- { name = 'buffer' },
  64. use("hrsh7th/cmp-path") -- { name = 'path' }
  65. use("hrsh7th/cmp-cmdline") -- { name = 'cmdline' }
  66. use("hrsh7th/cmp-nvim-lsp-signature-help") -- { name = 'nvim_lsp_signature_help' }
  67. -- 常见编程语言代码段
  68. use("rafamadriz/friendly-snippets")
  69. -- UI 增强
  70. use("onsails/lspkind-nvim")
  71. use("tami5/lspsaga.nvim")
  72. -- 代码格式化
  73. use("mhartington/formatter.nvim")
  74. use({ "jose-elias-alvarez/null-ls.nvim", requires = "nvim-lua/plenary.nvim" })
  75. -- TypeScript 增强
  76. use({ "jose-elias-alvarez/nvim-lsp-ts-utils", requires = "nvim-lua/plenary.nvim" })
  77. -- Lua 增强
  78. use("folke/lua-dev.nvim")
  79. -- JSON 增强
  80. use("b0o/schemastore.nvim")
  81. -- Rust 增强
  82. use("simrat39/rust-tools.nvim")
  83. --------------------- colorschemes --------------------
  84. -- tokyonight
  85. use("folke/tokyonight.nvim")
  86. -- OceanicNext
  87. use("mhartington/oceanic-next")
  88. -- gruvbox
  89. use({
  90. "ellisonleao/gruvbox.nvim",
  91. requires = { "rktjmp/lush.nvim" },
  92. })
  93. -- zephyr
  94. -- use("glepnir/zephyr-nvim")
  95. -- nord
  96. use("shaunsingh/nord.nvim")
  97. -- onedark
  98. use("ful1e5/onedark.nvim")
  99. -- nightfox
  100. use("EdenEast/nightfox.nvim")
  101. -------------------------------------------------------
  102. use({ "akinsho/toggleterm.nvim" })
  103. -- surround
  104. use("ur4ltz/surround.nvim")
  105. -- Comment
  106. use("numToStr/Comment.nvim")
  107. -- nvim-autopairs
  108. use("windwp/nvim-autopairs")
  109. -- git
  110. use({ "lewis6991/gitsigns.nvim" })
  111. -- vimspector
  112. use("puremourning/vimspector")
  113. ----------------------------------------------
  114. use("mfussenegger/nvim-dap")
  115. use("theHamsta/nvim-dap-virtual-text")
  116. use("rcarriga/nvim-dap-ui")
  117. -- use("Pocco81/DAPInstall.nvim")
  118. -- use("jbyuki/one-small-step-for-vimkind")
  119. use("j-hui/fidget.nvim")
  120. if paccker_bootstrap then
  121. packer.sync()
  122. end
  123. end,
  124. config = {
  125. -- 最大并发数
  126. max_jobs = 16,
  127. -- 自定义源
  128. git = {
  129. -- default_url_format = "https://hub.fastgit.xyz/%s",
  130. -- default_url_format = "https://mirror.ghproxy.com/https://github.com/%s",
  131. -- default_url_format = "https://gitcode.net/mirrors/%s",
  132. -- default_url_format = "https://gitclone.com/github.com/%s",
  133. },
  134. display = {
  135. -- 使用浮动窗口显示
  136. open_fn = function()
  137. return require("packer.util").float({ border = "single" })
  138. end,
  139. },
  140. },
  141. })
  142. -- 每次保存 plugins.lua 自动安装插件
  143. -- move to autocmds.lua
  144. -- pcall(
  145. -- vim.cmd,
  146. -- [[
  147. -- augroup packer_user_config
  148. -- autocmd!
  149. -- autocmd BufWritePost plugins.lua source <afile> | PackerSync
  150. -- augroup end
  151. -- ]]
  152. -- )