plugins.lua 7.1 KB

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