plugins.lua 7.2 KB

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