plugins.lua 6.5 KB

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