plugins.lua 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  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. },
  55. },
  56. { "hrsh7th/cmp-nvim-lsp", lazy = true },
  57. { "saadparwaiz1/cmp_luasnip", lazy = true },
  58. { "hrsh7th/cmp-buffer", lazy = true },
  59. { "hrsh7th/cmp-path", lazy = true },
  60. {
  61. "L3MON4D3/LuaSnip",
  62. config = function()
  63. local utils = require "lvim.utils"
  64. local paths = {}
  65. if lvim.builtin.luasnip.sources.friendly_snippets then
  66. paths[#paths + 1] = utils.join_paths(get_runtime_dir(), "site", "pack", "lazy", "opt", "friendly-snippets")
  67. end
  68. local user_snippets = utils.join_paths(get_config_dir(), "snippets")
  69. if utils.is_directory(user_snippets) then
  70. paths[#paths + 1] = user_snippets
  71. end
  72. require("luasnip.loaders.from_lua").lazy_load()
  73. require("luasnip.loaders.from_vscode").lazy_load {
  74. paths = paths,
  75. }
  76. require("luasnip.loaders.from_snipmate").lazy_load()
  77. end,
  78. event = "InsertEnter",
  79. dependencies = {
  80. "friendly-snippets",
  81. },
  82. },
  83. { "rafamadriz/friendly-snippets", lazy = true, cond = lvim.builtin.luasnip.sources.friendly_snippets },
  84. {
  85. "folke/neodev.nvim",
  86. lazy = true,
  87. },
  88. -- Autopairs
  89. {
  90. "windwp/nvim-autopairs",
  91. event = "InsertEnter",
  92. config = function()
  93. require("lvim.core.autopairs").setup()
  94. end,
  95. enabled = lvim.builtin.autopairs.active,
  96. },
  97. -- Treesitter
  98. {
  99. "nvim-treesitter/nvim-treesitter",
  100. -- run = ":TSUpdate",
  101. config = function()
  102. local utils = require "lvim.utils"
  103. local path = utils.join_paths(get_runtime_dir(), "site", "pack", "lazy", "opt", "nvim-treesitter")
  104. vim.opt.rtp:prepend(path) -- treesitter needs to be before nvim's runtime in rtp
  105. require("lvim.core.treesitter").setup()
  106. end,
  107. },
  108. {
  109. "JoosepAlviste/nvim-ts-context-commentstring",
  110. event = "VeryLazy",
  111. },
  112. -- NvimTree
  113. {
  114. "kyazdani42/nvim-tree.lua",
  115. -- event = "BufWinOpen",
  116. -- cmd = "NvimTreeToggle",
  117. config = function()
  118. require("lvim.core.nvimtree").setup()
  119. end,
  120. enabled = lvim.builtin.nvimtree.active,
  121. },
  122. -- Lir
  123. {
  124. "LunarVim/lir.nvim",
  125. config = function()
  126. require("lvim.core.lir").setup()
  127. end,
  128. enabled = lvim.builtin.lir.active,
  129. },
  130. {
  131. "lewis6991/gitsigns.nvim",
  132. config = function()
  133. require("lvim.core.gitsigns").setup()
  134. end,
  135. event = "BufRead",
  136. enabled = lvim.builtin.gitsigns.active,
  137. },
  138. -- Whichkey
  139. {
  140. "folke/which-key.nvim",
  141. config = function()
  142. require("lvim.core.which-key").setup()
  143. end,
  144. event = "VeryLazy",
  145. enabled = lvim.builtin.which_key.active,
  146. },
  147. -- Comments
  148. {
  149. "numToStr/Comment.nvim",
  150. event = "BufRead",
  151. config = function()
  152. require("lvim.core.comment").setup()
  153. end,
  154. enabled = lvim.builtin.comment.active,
  155. },
  156. -- project.nvim
  157. {
  158. "ahmedkhalf/project.nvim",
  159. config = function()
  160. require("lvim.core.project").setup()
  161. end,
  162. enabled = lvim.builtin.project.active,
  163. },
  164. -- Icons
  165. {
  166. "kyazdani42/nvim-web-devicons",
  167. enabled = lvim.use_icons,
  168. },
  169. -- Status Line and Bufferline
  170. {
  171. -- "hoob3rt/lualine.nvim",
  172. "nvim-lualine/lualine.nvim",
  173. -- "Lunarvim/lualine.nvim",
  174. config = function()
  175. require("lvim.core.lualine").setup()
  176. end,
  177. enabled = lvim.builtin.lualine.active,
  178. },
  179. -- breadcrumbs
  180. {
  181. "SmiteshP/nvim-navic",
  182. config = function()
  183. require("lvim.core.breadcrumbs").setup()
  184. end,
  185. enabled = lvim.builtin.breadcrumbs.active,
  186. },
  187. {
  188. "akinsho/bufferline.nvim",
  189. config = function()
  190. require("lvim.core.bufferline").setup()
  191. end,
  192. branch = "main",
  193. enabled = 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. enabled = 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. enabled = lvim.builtin.dap.active,
  211. },
  212. -- alpha
  213. {
  214. "goolord/alpha-nvim",
  215. config = function()
  216. require("lvim.core.alpha").setup()
  217. end,
  218. enabled = lvim.builtin.alpha.active,
  219. },
  220. -- Terminal
  221. {
  222. "akinsho/toggleterm.nvim",
  223. event = "VeryLazy",
  224. branch = "main",
  225. config = function()
  226. require("lvim.core.terminal").setup()
  227. end,
  228. enabled = lvim.builtin.terminal.active,
  229. },
  230. -- SchemaStore
  231. {
  232. "b0o/schemastore.nvim",
  233. lazy = true,
  234. },
  235. {
  236. "RRethy/vim-illuminate",
  237. config = function()
  238. require("lvim.core.illuminate").setup()
  239. end,
  240. event = "VeryLazy",
  241. enabled = lvim.builtin.illuminate.active,
  242. },
  243. {
  244. "lukas-reineke/indent-blankline.nvim",
  245. config = function()
  246. require("lvim.core.indentlines").setup()
  247. end,
  248. enabled = lvim.builtin.indentlines.active,
  249. },
  250. {
  251. "lunarvim/onedarker.nvim",
  252. branch = "freeze",
  253. config = function()
  254. pcall(function()
  255. if lvim and lvim.colorscheme == "onedarker" then
  256. require("onedarker").setup()
  257. lvim.builtin.lualine.options.theme = "onedarker"
  258. end
  259. end)
  260. end,
  261. enabled = lvim.colorscheme == "onedarker",
  262. },
  263. {
  264. "lunarvim/bigfile.nvim",
  265. config = function()
  266. pcall(function()
  267. require("bigfile").config(lvim.builtin.bigfile.config)
  268. end)
  269. end,
  270. enabled = lvim.builtin.bigfile.active,
  271. },
  272. }
  273. local default_snapshot_path = join_paths(get_lvim_base_dir(), "snapshots", "default.json")
  274. local content = vim.fn.readfile(default_snapshot_path)
  275. local default_sha1 = assert(vim.fn.json_decode(content))
  276. -- taken form <https://github.com/folke/lazy.nvim/blob/c7122d64cdf16766433588486adcee67571de6d0/lua/lazy/core/plugin.lua#L27>
  277. local get_short_name = function(long_name)
  278. local name = long_name:sub(-4) == ".git" and long_name:sub(1, -5) or long_name
  279. local slash = name:reverse():find("/", 1, true) --[[@as number?]]
  280. return slash and name:sub(#name - slash + 2) or long_name:gsub("%W+", "_")
  281. end
  282. local get_default_sha1 = function(spec)
  283. local short_name = get_short_name(spec[1])
  284. return default_sha1[short_name] and default_sha1[short_name].commit
  285. end
  286. if not vim.env.LVIM_DEV_MODE then
  287. -- Manually lock the commit hashes of core plugins
  288. for _, spec in ipairs(core_plugins) do
  289. spec["commit"] = get_default_sha1(spec)
  290. end
  291. end
  292. return core_plugins