plugins.lua 7.0 KB

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