plugins.lua 6.7 KB

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