plugins.lua 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. local core_plugins = {
  2. -- Packer can manage itself as an optional plugin
  3. { "wbthomason/packer.nvim" },
  4. { "neovim/nvim-lspconfig" },
  5. { "tamago324/nlsp-settings.nvim" },
  6. {
  7. "jose-elias-alvarez/null-ls.nvim",
  8. },
  9. { "antoinemadec/FixCursorHold.nvim" }, -- Needed while issue https://github.com/neovim/neovim/issues/12587 is still open
  10. { "williamboman/mason-lspconfig.nvim" },
  11. {
  12. "williamboman/mason.nvim",
  13. config = function()
  14. require("lvim.core.mason").setup()
  15. end,
  16. },
  17. {
  18. "lunarvim/onedarker.nvim",
  19. branch = "freeze",
  20. config = function()
  21. pcall(function()
  22. if lvim and lvim.colorscheme == "onedarker" then
  23. require("onedarker").setup()
  24. lvim.builtin.lualine.options.theme = "onedarker"
  25. end
  26. end)
  27. end,
  28. disable = lvim.colorscheme ~= "onedarker",
  29. },
  30. {
  31. "rcarriga/nvim-notify",
  32. config = function()
  33. require("lvim.core.notify").setup()
  34. end,
  35. requires = { "nvim-telescope/telescope.nvim" },
  36. disable = not lvim.builtin.notify.active or not lvim.builtin.telescope.active,
  37. },
  38. { "Tastyep/structlog.nvim" },
  39. { "nvim-lua/popup.nvim" },
  40. { "nvim-lua/plenary.nvim" },
  41. -- Telescope
  42. {
  43. "nvim-telescope/telescope.nvim",
  44. branch = "0.1.x",
  45. config = function()
  46. require("lvim.core.telescope").setup()
  47. end,
  48. disable = not lvim.builtin.telescope.active,
  49. },
  50. {
  51. "nvim-telescope/telescope-fzf-native.nvim",
  52. requires = { "nvim-telescope/telescope.nvim" },
  53. run = "make",
  54. disable = not lvim.builtin.telescope.active,
  55. },
  56. -- Install nvim-cmp, and buffer source as a dependency
  57. {
  58. "hrsh7th/nvim-cmp",
  59. config = function()
  60. if lvim.builtin.cmp then
  61. require("lvim.core.cmp").setup()
  62. end
  63. end,
  64. requires = {
  65. "L3MON4D3/LuaSnip",
  66. },
  67. },
  68. {
  69. "rafamadriz/friendly-snippets",
  70. disable = not lvim.builtin.luasnip.sources.friendly_snippets,
  71. },
  72. {
  73. "L3MON4D3/LuaSnip",
  74. config = function()
  75. local utils = require "lvim.utils"
  76. local paths = {}
  77. if lvim.builtin.luasnip.sources.friendly_snippets then
  78. paths[#paths + 1] = utils.join_paths(get_runtime_dir(), "site", "pack", "packer", "start", "friendly-snippets")
  79. end
  80. local user_snippets = utils.join_paths(get_config_dir(), "snippets")
  81. if utils.is_directory(user_snippets) then
  82. paths[#paths + 1] = user_snippets
  83. end
  84. require("luasnip.loaders.from_lua").lazy_load()
  85. require("luasnip.loaders.from_vscode").lazy_load {
  86. paths = paths,
  87. }
  88. require("luasnip.loaders.from_snipmate").lazy_load()
  89. end,
  90. },
  91. {
  92. "hrsh7th/cmp-nvim-lsp",
  93. },
  94. {
  95. "saadparwaiz1/cmp_luasnip",
  96. },
  97. {
  98. "hrsh7th/cmp-buffer",
  99. },
  100. {
  101. "hrsh7th/cmp-path",
  102. },
  103. {
  104. "folke/lua-dev.nvim",
  105. module = "lua-dev",
  106. },
  107. -- Autopairs
  108. {
  109. "windwp/nvim-autopairs",
  110. -- event = "InsertEnter",
  111. config = function()
  112. require("lvim.core.autopairs").setup()
  113. end,
  114. disable = not lvim.builtin.autopairs.active,
  115. },
  116. -- Treesitter
  117. {
  118. "nvim-treesitter/nvim-treesitter",
  119. -- run = ":TSUpdate",
  120. config = function()
  121. require("lvim.core.treesitter").setup()
  122. end,
  123. },
  124. {
  125. "JoosepAlviste/nvim-ts-context-commentstring",
  126. event = "BufReadPost",
  127. },
  128. -- NvimTree
  129. {
  130. "kyazdani42/nvim-tree.lua",
  131. -- event = "BufWinOpen",
  132. -- cmd = "NvimTreeToggle",
  133. config = function()
  134. require("lvim.core.nvimtree").setup()
  135. end,
  136. disable = not lvim.builtin.nvimtree.active,
  137. },
  138. -- Lir
  139. {
  140. "christianchiarulli/lir.nvim",
  141. config = function()
  142. require("lvim.core.lir").setup()
  143. end,
  144. disable = not lvim.builtin.lir.active,
  145. },
  146. {
  147. "lewis6991/gitsigns.nvim",
  148. config = function()
  149. require("lvim.core.gitsigns").setup()
  150. end,
  151. event = "BufRead",
  152. disable = not lvim.builtin.gitsigns.active,
  153. },
  154. -- Whichkey
  155. {
  156. "folke/which-key.nvim",
  157. config = function()
  158. require("lvim.core.which-key").setup()
  159. end,
  160. event = "BufWinEnter",
  161. disable = not lvim.builtin.which_key.active,
  162. },
  163. -- Comments
  164. {
  165. "numToStr/Comment.nvim",
  166. event = "BufRead",
  167. config = function()
  168. require("lvim.core.comment").setup()
  169. end,
  170. disable = not lvim.builtin.comment.active,
  171. },
  172. -- project.nvim
  173. {
  174. "ahmedkhalf/project.nvim",
  175. config = function()
  176. require("lvim.core.project").setup()
  177. end,
  178. disable = not lvim.builtin.project.active,
  179. },
  180. -- Icons
  181. {
  182. "kyazdani42/nvim-web-devicons",
  183. disable = not lvim.use_icons,
  184. },
  185. -- Status Line and Bufferline
  186. {
  187. -- "hoob3rt/lualine.nvim",
  188. "nvim-lualine/lualine.nvim",
  189. -- "Lunarvim/lualine.nvim",
  190. config = function()
  191. require("lvim.core.lualine").setup()
  192. end,
  193. disable = not lvim.builtin.lualine.active,
  194. },
  195. {
  196. "akinsho/bufferline.nvim",
  197. config = function()
  198. require("lvim.core.bufferline").setup()
  199. end,
  200. branch = "main",
  201. event = "BufWinEnter",
  202. disable = not lvim.builtin.bufferline.active,
  203. },
  204. -- Debugging
  205. {
  206. "mfussenegger/nvim-dap",
  207. -- event = "BufWinEnter",
  208. config = function()
  209. require("lvim.core.dap").setup()
  210. end,
  211. disable = not lvim.builtin.dap.active,
  212. },
  213. -- Debugger management
  214. {
  215. "Pocco81/dap-buddy.nvim",
  216. branch = "dev",
  217. -- event = "BufWinEnter",
  218. -- event = "BufRead",
  219. disable = not lvim.builtin.dap.active,
  220. },
  221. -- alpha
  222. {
  223. "goolord/alpha-nvim",
  224. config = function()
  225. require("lvim.core.alpha").setup()
  226. end,
  227. disable = not lvim.builtin.alpha.active,
  228. },
  229. -- Terminal
  230. {
  231. "akinsho/toggleterm.nvim",
  232. event = "BufWinEnter",
  233. branch = "main",
  234. config = function()
  235. require("lvim.core.terminal").setup()
  236. end,
  237. disable = not lvim.builtin.terminal.active,
  238. },
  239. -- SchemaStore
  240. {
  241. "b0o/schemastore.nvim",
  242. },
  243. }
  244. local default_snapshot_path = join_paths(get_lvim_base_dir(), "snapshots", "default.json")
  245. local content = vim.fn.readfile(default_snapshot_path)
  246. local default_sha1 = vim.fn.json_decode(content)
  247. local get_default_sha1 = function(spec)
  248. local short_name, _ = require("packer.util").get_plugin_short_name(spec)
  249. return default_sha1[short_name] and default_sha1[short_name].commit
  250. end
  251. for _, spec in ipairs(core_plugins) do
  252. if not vim.env.LVIM_DEV_MODE then
  253. -- Manually lock the commit hash since Packer's snapshots are unreliable in headless mode
  254. spec["commit"] = get_default_sha1(spec)
  255. end
  256. end
  257. return core_plugins