plugins.lua 6.2 KB

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