plugins.lua 6.9 KB

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