plugins.lua 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  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. {
  139. "lewis6991/gitsigns.nvim",
  140. config = function()
  141. require("lvim.core.gitsigns").setup()
  142. end,
  143. event = "BufRead",
  144. disable = not lvim.builtin.gitsigns.active,
  145. },
  146. -- Whichkey
  147. {
  148. "folke/which-key.nvim",
  149. config = function()
  150. require("lvim.core.which-key").setup()
  151. end,
  152. event = "BufWinEnter",
  153. disable = not lvim.builtin.which_key.active,
  154. },
  155. -- Comments
  156. {
  157. "numToStr/Comment.nvim",
  158. event = "BufRead",
  159. config = function()
  160. require("lvim.core.comment").setup()
  161. end,
  162. disable = not lvim.builtin.comment.active,
  163. },
  164. -- project.nvim
  165. {
  166. "ahmedkhalf/project.nvim",
  167. config = function()
  168. require("lvim.core.project").setup()
  169. end,
  170. disable = not lvim.builtin.project.active,
  171. },
  172. -- Icons
  173. {
  174. "kyazdani42/nvim-web-devicons",
  175. disable = not lvim.use_icons,
  176. },
  177. -- Status Line and Bufferline
  178. {
  179. -- "hoob3rt/lualine.nvim",
  180. "nvim-lualine/lualine.nvim",
  181. -- "Lunarvim/lualine.nvim",
  182. config = function()
  183. require("lvim.core.lualine").setup()
  184. end,
  185. disable = not lvim.builtin.lualine.active,
  186. },
  187. {
  188. "akinsho/bufferline.nvim",
  189. config = function()
  190. require("lvim.core.bufferline").setup()
  191. end,
  192. branch = "main",
  193. event = "BufWinEnter",
  194. disable = not lvim.builtin.bufferline.active,
  195. },
  196. -- Debugging
  197. {
  198. "mfussenegger/nvim-dap",
  199. -- event = "BufWinEnter",
  200. config = function()
  201. require("lvim.core.dap").setup()
  202. end,
  203. disable = not lvim.builtin.dap.active,
  204. },
  205. -- Debugger management
  206. {
  207. "Pocco81/dap-buddy.nvim",
  208. branch = "dev",
  209. -- event = "BufWinEnter",
  210. -- event = "BufRead",
  211. disable = not lvim.builtin.dap.active,
  212. },
  213. -- alpha
  214. {
  215. "goolord/alpha-nvim",
  216. config = function()
  217. require("lvim.core.alpha").setup()
  218. end,
  219. disable = not lvim.builtin.alpha.active,
  220. },
  221. -- Terminal
  222. {
  223. "akinsho/toggleterm.nvim",
  224. event = "BufWinEnter",
  225. branch = "main",
  226. config = function()
  227. require("lvim.core.terminal").setup()
  228. end,
  229. disable = not lvim.builtin.terminal.active,
  230. },
  231. -- SchemaStore
  232. {
  233. "b0o/schemastore.nvim",
  234. },
  235. }
  236. local default_snapshot_path = join_paths(get_lvim_base_dir(), "snapshots", "default.json")
  237. local content = vim.fn.readfile(default_snapshot_path)
  238. local default_sha1 = vim.fn.json_decode(content)
  239. local get_default_sha1 = function(spec)
  240. local short_name, _ = require("packer.util").get_plugin_short_name(spec)
  241. return default_sha1[short_name] and default_sha1[short_name].commit
  242. end
  243. for _, spec in ipairs(core_plugins) do
  244. if not vim.env.LVIM_DEV_MODE then
  245. -- Manually lock the commit hash since Packer's snapshots are unreliable in headless mode
  246. spec["commit"] = get_default_sha1(spec)
  247. end
  248. end
  249. return core_plugins