plugins.lua 6.6 KB

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