plugins.lua 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  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. require("lvim.core.treesitter").setup()
  103. end,
  104. },
  105. {
  106. "JoosepAlviste/nvim-ts-context-commentstring",
  107. event = "VeryLazy",
  108. },
  109. -- NvimTree
  110. {
  111. "kyazdani42/nvim-tree.lua",
  112. -- event = "BufWinOpen",
  113. -- cmd = "NvimTreeToggle",
  114. config = function()
  115. require("lvim.core.nvimtree").setup()
  116. end,
  117. enabled = lvim.builtin.nvimtree.active,
  118. },
  119. -- Lir
  120. {
  121. "LunarVim/lir.nvim",
  122. config = function()
  123. require("lvim.core.lir").setup()
  124. end,
  125. enabled = lvim.builtin.lir.active,
  126. },
  127. {
  128. "lewis6991/gitsigns.nvim",
  129. config = function()
  130. require("lvim.core.gitsigns").setup()
  131. end,
  132. event = "BufRead",
  133. enabled = lvim.builtin.gitsigns.active,
  134. },
  135. -- Whichkey
  136. {
  137. "folke/which-key.nvim",
  138. config = function()
  139. require("lvim.core.which-key").setup()
  140. end,
  141. event = "VeryLazy",
  142. enabled = lvim.builtin.which_key.active,
  143. },
  144. -- Comments
  145. {
  146. "numToStr/Comment.nvim",
  147. event = "BufRead",
  148. config = function()
  149. require("lvim.core.comment").setup()
  150. end,
  151. enabled = lvim.builtin.comment.active,
  152. },
  153. -- project.nvim
  154. {
  155. "ahmedkhalf/project.nvim",
  156. config = function()
  157. require("lvim.core.project").setup()
  158. end,
  159. enabled = lvim.builtin.project.active,
  160. },
  161. -- Icons
  162. {
  163. "kyazdani42/nvim-web-devicons",
  164. enabled = lvim.use_icons,
  165. },
  166. -- Status Line and Bufferline
  167. {
  168. -- "hoob3rt/lualine.nvim",
  169. "nvim-lualine/lualine.nvim",
  170. -- "Lunarvim/lualine.nvim",
  171. config = function()
  172. require("lvim.core.lualine").setup()
  173. end,
  174. enabled = lvim.builtin.lualine.active,
  175. },
  176. -- breadcrumbs
  177. {
  178. "SmiteshP/nvim-navic",
  179. config = function()
  180. require("lvim.core.breadcrumbs").setup()
  181. end,
  182. enabled = lvim.builtin.breadcrumbs.active,
  183. },
  184. {
  185. "akinsho/bufferline.nvim",
  186. config = function()
  187. require("lvim.core.bufferline").setup()
  188. end,
  189. branch = "main",
  190. enabled = lvim.builtin.bufferline.active,
  191. },
  192. -- Debugging
  193. {
  194. "mfussenegger/nvim-dap",
  195. -- event = "BufWinEnter",
  196. config = function()
  197. require("lvim.core.dap").setup()
  198. end,
  199. enabled = lvim.builtin.dap.active,
  200. },
  201. -- Debugger user interface
  202. {
  203. "rcarriga/nvim-dap-ui",
  204. config = function()
  205. require("lvim.core.dap").setup_ui()
  206. end,
  207. enabled = lvim.builtin.dap.active,
  208. },
  209. -- alpha
  210. {
  211. "goolord/alpha-nvim",
  212. config = function()
  213. require("lvim.core.alpha").setup()
  214. end,
  215. enabled = lvim.builtin.alpha.active,
  216. },
  217. -- Terminal
  218. {
  219. "akinsho/toggleterm.nvim",
  220. event = "VeryLazy",
  221. branch = "main",
  222. config = function()
  223. require("lvim.core.terminal").setup()
  224. end,
  225. enabled = lvim.builtin.terminal.active,
  226. },
  227. -- SchemaStore
  228. {
  229. "b0o/schemastore.nvim",
  230. lazy = true,
  231. },
  232. {
  233. "RRethy/vim-illuminate",
  234. config = function()
  235. require("lvim.core.illuminate").setup()
  236. end,
  237. event = "VeryLazy",
  238. enabled = lvim.builtin.illuminate.active,
  239. },
  240. {
  241. "lukas-reineke/indent-blankline.nvim",
  242. config = function()
  243. require("lvim.core.indentlines").setup()
  244. end,
  245. enabled = lvim.builtin.indentlines.active,
  246. },
  247. {
  248. "lunarvim/onedarker.nvim",
  249. branch = "freeze",
  250. config = function()
  251. pcall(function()
  252. if lvim and lvim.colorscheme == "onedarker" then
  253. require("onedarker").setup()
  254. lvim.builtin.lualine.options.theme = "onedarker"
  255. end
  256. end)
  257. end,
  258. enabled = lvim.colorscheme == "onedarker",
  259. },
  260. {
  261. "lunarvim/bigfile.nvim",
  262. config = function()
  263. pcall(function()
  264. require("bigfile").config(lvim.builtin.bigfile.config)
  265. end)
  266. end,
  267. enabled = lvim.builtin.bigfile.active,
  268. },
  269. }
  270. local default_snapshot_path = join_paths(get_lvim_base_dir(), "snapshots", "default.json")
  271. local content = vim.fn.readfile(default_snapshot_path)
  272. local default_sha1 = assert(vim.fn.json_decode(content))
  273. -- taken form <https://github.com/folke/lazy.nvim/blob/c7122d64cdf16766433588486adcee67571de6d0/lua/lazy/core/plugin.lua#L27>
  274. local get_short_name = function(long_name)
  275. local name = long_name:sub(-4) == ".git" and long_name:sub(1, -5) or long_name
  276. local slash = name:reverse():find("/", 1, true) --[[@as number?]]
  277. return slash and name:sub(#name - slash + 2) or long_name:gsub("%W+", "_")
  278. end
  279. local get_default_sha1 = function(spec)
  280. local short_name = get_short_name(spec[1])
  281. return default_sha1[short_name] and default_sha1[short_name].commit
  282. end
  283. if not vim.env.LVIM_DEV_MODE then
  284. -- Manually lock the commit hashes of core plugins
  285. for _, spec in ipairs(core_plugins) do
  286. spec["commit"] = get_default_sha1(spec)
  287. end
  288. end
  289. return core_plugins