plugins.lua 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  1. -- local require = require("lvim.utils.require").require
  2. local core_plugins = {
  3. { "folke/lazy.nvim", tag = "stable" },
  4. {
  5. "neovim/nvim-lspconfig",
  6. lazy = true,
  7. dependencies = { "mason-lspconfig.nvim", "nlsp-settings.nvim" },
  8. },
  9. { "williamboman/mason-lspconfig.nvim", lazy = true },
  10. { "tamago324/nlsp-settings.nvim", lazy = true },
  11. { "jose-elias-alvarez/null-ls.nvim", lazy = true },
  12. {
  13. "williamboman/mason.nvim",
  14. config = function()
  15. require("lvim.core.mason").setup()
  16. end,
  17. },
  18. {
  19. "folke/tokyonight.nvim",
  20. },
  21. {
  22. "lunarvim/lunar.nvim",
  23. },
  24. { "Tastyep/structlog.nvim" },
  25. { "nvim-lua/popup.nvim" },
  26. { "nvim-lua/plenary.nvim" },
  27. -- Telescope
  28. {
  29. "nvim-telescope/telescope.nvim",
  30. branch = "0.1.x",
  31. config = function()
  32. require("lvim.core.telescope").setup()
  33. end,
  34. dependencies = { "telescope-fzf-native.nvim" },
  35. lazy = true,
  36. cmd = "Telescope",
  37. enabled = lvim.builtin.telescope.active,
  38. },
  39. { "nvim-telescope/telescope-fzf-native.nvim", build = "make", lazy = true, enabled = lvim.builtin.telescope.active },
  40. -- Install nvim-cmp, and buffer source as a dependency
  41. {
  42. "hrsh7th/nvim-cmp",
  43. config = function()
  44. if lvim.builtin.cmp then
  45. require("lvim.core.cmp").setup()
  46. end
  47. end,
  48. event = { "InsertEnter", "CmdlineEnter" },
  49. dependencies = {
  50. "cmp-nvim-lsp",
  51. "cmp_luasnip",
  52. "cmp-buffer",
  53. "cmp-path",
  54. "cmp-cmdline",
  55. },
  56. },
  57. { "hrsh7th/cmp-nvim-lsp", lazy = true },
  58. { "saadparwaiz1/cmp_luasnip", lazy = true },
  59. { "hrsh7th/cmp-buffer", lazy = true },
  60. { "hrsh7th/cmp-path", lazy = true },
  61. {
  62. "hrsh7th/cmp-cmdline",
  63. lazy = true,
  64. enabled = lvim.builtin.cmp and lvim.builtin.cmp.cmdline.enable or false,
  65. },
  66. {
  67. "L3MON4D3/LuaSnip",
  68. config = function()
  69. local utils = require "lvim.utils"
  70. local paths = {}
  71. if lvim.builtin.luasnip.sources.friendly_snippets then
  72. paths[#paths + 1] = utils.join_paths(get_runtime_dir(), "site", "pack", "lazy", "opt", "friendly-snippets")
  73. end
  74. local user_snippets = utils.join_paths(get_config_dir(), "snippets")
  75. if utils.is_directory(user_snippets) then
  76. paths[#paths + 1] = user_snippets
  77. end
  78. require("luasnip.loaders.from_lua").lazy_load()
  79. require("luasnip.loaders.from_vscode").lazy_load {
  80. paths = paths,
  81. }
  82. require("luasnip.loaders.from_snipmate").lazy_load()
  83. end,
  84. event = "InsertEnter",
  85. dependencies = {
  86. "friendly-snippets",
  87. },
  88. },
  89. { "rafamadriz/friendly-snippets", lazy = true, cond = lvim.builtin.luasnip.sources.friendly_snippets },
  90. {
  91. "folke/neodev.nvim",
  92. lazy = true,
  93. },
  94. -- Autopairs
  95. {
  96. "windwp/nvim-autopairs",
  97. event = "InsertEnter",
  98. config = function()
  99. require("lvim.core.autopairs").setup()
  100. end,
  101. enabled = lvim.builtin.autopairs.active,
  102. },
  103. -- Treesitter
  104. {
  105. "nvim-treesitter/nvim-treesitter",
  106. -- run = ":TSUpdate",
  107. config = function()
  108. local utils = require "lvim.utils"
  109. local path = utils.join_paths(get_runtime_dir(), "site", "pack", "lazy", "opt", "nvim-treesitter")
  110. vim.opt.rtp:prepend(path) -- treesitter needs to be before nvim's runtime in rtp
  111. require("lvim.core.treesitter").setup()
  112. end,
  113. },
  114. {
  115. "JoosepAlviste/nvim-ts-context-commentstring",
  116. event = "VeryLazy",
  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. enabled = lvim.builtin.nvimtree.active,
  127. },
  128. -- Lir
  129. {
  130. "tamago324/lir.nvim",
  131. config = function()
  132. require("lvim.core.lir").setup()
  133. end,
  134. enabled = lvim.builtin.lir.active,
  135. },
  136. {
  137. "lewis6991/gitsigns.nvim",
  138. config = function()
  139. require("lvim.core.gitsigns").setup()
  140. end,
  141. event = "BufRead",
  142. enabled = lvim.builtin.gitsigns.active,
  143. },
  144. -- Whichkey
  145. {
  146. "folke/which-key.nvim",
  147. config = function()
  148. require("lvim.core.which-key").setup()
  149. end,
  150. event = "VeryLazy",
  151. enabled = lvim.builtin.which_key.active,
  152. },
  153. -- Comments
  154. {
  155. "numToStr/Comment.nvim",
  156. event = "BufRead",
  157. config = function()
  158. require("lvim.core.comment").setup()
  159. end,
  160. enabled = lvim.builtin.comment.active,
  161. },
  162. -- project.nvim
  163. {
  164. "ahmedkhalf/project.nvim",
  165. config = function()
  166. require("lvim.core.project").setup()
  167. end,
  168. enabled = lvim.builtin.project.active,
  169. },
  170. -- Icons
  171. {
  172. "nvim-tree/nvim-web-devicons",
  173. enabled = lvim.use_icons,
  174. },
  175. -- Status Line and Bufferline
  176. {
  177. -- "hoob3rt/lualine.nvim",
  178. "nvim-lualine/lualine.nvim",
  179. -- "Lunarvim/lualine.nvim",
  180. config = function()
  181. require("lvim.core.lualine").setup()
  182. end,
  183. enabled = lvim.builtin.lualine.active,
  184. },
  185. -- breadcrumbs
  186. {
  187. "SmiteshP/nvim-navic",
  188. config = function()
  189. require("lvim.core.breadcrumbs").setup()
  190. end,
  191. enabled = lvim.builtin.breadcrumbs.active,
  192. },
  193. {
  194. "akinsho/bufferline.nvim",
  195. config = function()
  196. require("lvim.core.bufferline").setup()
  197. end,
  198. branch = "main",
  199. enabled = lvim.builtin.bufferline.active,
  200. },
  201. -- Debugging
  202. {
  203. "mfussenegger/nvim-dap",
  204. -- event = "BufWinEnter",
  205. config = function()
  206. require("lvim.core.dap").setup()
  207. end,
  208. enabled = lvim.builtin.dap.active,
  209. },
  210. -- Debugger user interface
  211. {
  212. "rcarriga/nvim-dap-ui",
  213. config = function()
  214. require("lvim.core.dap").setup_ui()
  215. end,
  216. enabled = lvim.builtin.dap.active,
  217. },
  218. -- alpha
  219. {
  220. "goolord/alpha-nvim",
  221. config = function()
  222. require("lvim.core.alpha").setup()
  223. end,
  224. enabled = lvim.builtin.alpha.active,
  225. },
  226. -- Terminal
  227. {
  228. "akinsho/toggleterm.nvim",
  229. event = "VeryLazy",
  230. branch = "main",
  231. config = function()
  232. require("lvim.core.terminal").setup()
  233. end,
  234. enabled = lvim.builtin.terminal.active,
  235. },
  236. -- SchemaStore
  237. {
  238. "b0o/schemastore.nvim",
  239. lazy = true,
  240. },
  241. {
  242. "RRethy/vim-illuminate",
  243. config = function()
  244. require("lvim.core.illuminate").setup()
  245. end,
  246. event = "VeryLazy",
  247. enabled = lvim.builtin.illuminate.active,
  248. },
  249. {
  250. "lukas-reineke/indent-blankline.nvim",
  251. config = function()
  252. require("lvim.core.indentlines").setup()
  253. end,
  254. enabled = lvim.builtin.indentlines.active,
  255. },
  256. {
  257. "lunarvim/onedarker.nvim",
  258. branch = "freeze",
  259. config = function()
  260. pcall(function()
  261. if lvim and lvim.colorscheme == "onedarker" then
  262. require("onedarker").setup()
  263. lvim.builtin.lualine.options.theme = "onedarker"
  264. end
  265. end)
  266. end,
  267. enabled = lvim.colorscheme == "onedarker",
  268. },
  269. {
  270. "lunarvim/bigfile.nvim",
  271. config = function()
  272. pcall(function()
  273. require("bigfile").config(lvim.builtin.bigfile.config)
  274. end)
  275. end,
  276. enabled = lvim.builtin.bigfile.active,
  277. },
  278. }
  279. local default_snapshot_path = join_paths(get_lvim_base_dir(), "snapshots", "default.json")
  280. local content = vim.fn.readfile(default_snapshot_path)
  281. local default_sha1 = assert(vim.fn.json_decode(content))
  282. -- taken form <https://github.com/folke/lazy.nvim/blob/c7122d64cdf16766433588486adcee67571de6d0/lua/lazy/core/plugin.lua#L27>
  283. local get_short_name = function(long_name)
  284. local name = long_name:sub(-4) == ".git" and long_name:sub(1, -5) or long_name
  285. local slash = name:reverse():find("/", 1, true) --[[@as number?]]
  286. return slash and name:sub(#name - slash + 2) or long_name:gsub("%W+", "_")
  287. end
  288. local get_default_sha1 = function(spec)
  289. local short_name = get_short_name(spec[1])
  290. return default_sha1[short_name] and default_sha1[short_name].commit
  291. end
  292. if not vim.env.LVIM_DEV_MODE then
  293. -- Manually lock the commit hashes of core plugins
  294. for _, spec in ipairs(core_plugins) do
  295. spec["commit"] = get_default_sha1(spec)
  296. end
  297. end
  298. return core_plugins