plugins.lua 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  1. local execute = vim.api.nvim_command
  2. local fn = vim.fn
  3. local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim"
  4. if fn.empty(fn.glob(install_path)) > 0 then
  5. execute("!git clone https://github.com/wbthomason/packer.nvim " .. install_path)
  6. execute("packadd packer.nvim")
  7. end
  8. local packer_ok, packer = pcall(require, "packer")
  9. if not packer_ok then
  10. return
  11. end
  12. packer.init({
  13. git = { clone_timeout = 300 },
  14. display = {
  15. open_fn = function()
  16. return require("packer.util").float({ border = "single" })
  17. end,
  18. },
  19. })
  20. vim.cmd("autocmd BufWritePost plugins.lua PackerCompile")
  21. return require("packer").startup(function(use)
  22. -- Packer can manage itself as an optional plugin
  23. use("wbthomason/packer.nvim")
  24. -- TODO refactor all of this (for now it works, but yes I know it could be wrapped in a simpler function)
  25. use({ "neovim/nvim-lspconfig" })
  26. use({ "kabouzeid/nvim-lspinstall", event = "BufRead" })
  27. -- Telescope
  28. use({ "nvim-lua/popup.nvim" })
  29. use({ "nvim-lua/plenary.nvim" })
  30. use({ "tjdevries/astronauta.nvim" })
  31. use({
  32. "nvim-telescope/telescope.nvim",
  33. config = [[require('lv-telescope')]],
  34. event = "BufEnter",
  35. })
  36. -- Autocomplete
  37. use({
  38. "hrsh7th/nvim-compe",
  39. event = "InsertEnter",
  40. config = function()
  41. require("lv-compe").config()
  42. end,
  43. })
  44. use({ "hrsh7th/vim-vsnip", event = "InsertEnter" })
  45. use({ "rafamadriz/friendly-snippets", event = "InsertEnter" })
  46. -- Treesitter
  47. use({ "nvim-treesitter/nvim-treesitter", run = ":TSUpdate" })
  48. -- Neoformat
  49. use({ "sbdchd/neoformat" })
  50. use({
  51. "kyazdani42/nvim-tree.lua",
  52. -- cmd = "NvimTreeToggle",
  53. config = function()
  54. require("lv-nvimtree").config()
  55. end,
  56. })
  57. use({
  58. "lewis6991/gitsigns.nvim",
  59. config = function()
  60. require("lv-gitsigns").config()
  61. end,
  62. event = "BufRead",
  63. })
  64. -- whichkey
  65. use({ "folke/which-key.nvim" })
  66. -- Autopairs
  67. use({
  68. "windwp/nvim-autopairs",
  69. event = "InsertEnter",
  70. after = { "telescope.nvim" },
  71. config = function()
  72. require("lv-autopairs")
  73. end,
  74. })
  75. -- Comments
  76. use({
  77. "terrortylor/nvim-comment",
  78. cmd = "CommentToggle",
  79. config = function()
  80. local status_ok, nvim_comment = pcall(require, "nvim_comment")
  81. if not status_ok then
  82. return
  83. end
  84. nvim_comment.setup()
  85. end,
  86. })
  87. -- Color
  88. use({ "christianchiarulli/nvcode-color-schemes.vim", opt = true })
  89. -- Icons
  90. use({ "kyazdani42/nvim-web-devicons" })
  91. -- Status Line and Bufferline
  92. use({ "glepnir/galaxyline.nvim" })
  93. use({
  94. "romgrk/barbar.nvim",
  95. config = function()
  96. vim.api.nvim_set_keymap("n", "<TAB>", ":BufferNext<CR>", { noremap = true, silent = true })
  97. vim.api.nvim_set_keymap("n", "<S-TAB>", ":BufferPrevious<CR>", { noremap = true, silent = true })
  98. vim.api.nvim_set_keymap("n", "<S-x>", ":BufferClose<CR>", { noremap = true, silent = true })
  99. end,
  100. -- event = "BufRead",
  101. })
  102. -- Builtins, these do not load by default
  103. -- Dashboard
  104. use({
  105. "ChristianChiarulli/dashboard-nvim",
  106. -- event = "BufWinEnter",
  107. -- cmd = { "Dashboard", "DashboardNewFile", "DashboardJumpMarks" },
  108. config = function()
  109. require("lv-dashboard").config()
  110. end,
  111. disable = not O.plugin.dashboard.active,
  112. -- opt = true,
  113. })
  114. -- Zen Mode
  115. use({
  116. "folke/zen-mode.nvim",
  117. cmd = "ZenMode",
  118. -- event = "BufRead",
  119. config = function()
  120. require("lv-zen").config()
  121. end,
  122. disable = not O.plugin.zen.active,
  123. })
  124. use({
  125. "norcalli/nvim-colorizer.lua",
  126. event = "BufRead",
  127. config = function()
  128. require("lv-colorizer")
  129. -- vim.cmd "ColorizerReloadAllBuffers"
  130. end,
  131. disable = not O.plugin.colorizer.active,
  132. })
  133. -- Treesitter playground
  134. use({
  135. "nvim-treesitter/playground",
  136. event = "BufRead",
  137. disable = not O.plugin.ts_playground.active,
  138. })
  139. use({
  140. "lukas-reineke/indent-blankline.nvim",
  141. event = "BufRead",
  142. setup = function()
  143. vim.g.indentLine_enabled = 1
  144. vim.g.indent_blankline_char = "▏"
  145. vim.g.indent_blankline_filetype_exclude = {
  146. "help",
  147. "terminal",
  148. "dashboard",
  149. }
  150. vim.g.indent_blankline_buftype_exclude = { "terminal" }
  151. vim.g.indent_blankline_show_trailing_blankline_indent = false
  152. vim.g.indent_blankline_show_first_indent_level = true
  153. end,
  154. disable = not O.plugin.indent_line.active,
  155. })
  156. -- comments in context
  157. use({
  158. "JoosepAlviste/nvim-ts-context-commentstring",
  159. event = "BufRead",
  160. disable = not O.plugin.ts_context_commentstring.active,
  161. })
  162. -- Symbol Outline
  163. use({
  164. "simrat39/symbols-outline.nvim",
  165. cmd = "SymbolsOutline",
  166. disable = not O.plugin.symbol_outline.active,
  167. })
  168. -- diagnostics
  169. use({
  170. "folke/trouble.nvim",
  171. cmd = "TroubleToggle",
  172. disable = not O.plugin.trouble.active,
  173. })
  174. -- Debugging
  175. use({
  176. "mfussenegger/nvim-dap",
  177. config = function()
  178. local status_ok, dap = pcall(require, "dap")
  179. if not status_ok then
  180. return
  181. end
  182. -- require "dap"
  183. vim.fn.sign_define("DapBreakpoint", {
  184. text = "",
  185. texthl = "LspDiagnosticsSignError",
  186. linehl = "",
  187. numhl = "",
  188. })
  189. dap.defaults.fallback.terminal_win_cmd = "50vsplit new"
  190. end,
  191. disable = not O.plugin.debug.active,
  192. })
  193. -- Floating terminal
  194. use({
  195. "numToStr/FTerm.nvim",
  196. event = "BufWinEnter",
  197. config = function()
  198. require("lv-floatterm").config()
  199. end,
  200. disable = not O.plugin.floatterm.active,
  201. })
  202. -- Use fzy for telescope
  203. use({
  204. "nvim-telescope/telescope-fzy-native.nvim",
  205. event = "BufRead",
  206. disable = not O.plugin.telescope_fzy.active,
  207. })
  208. -- Use project for telescope
  209. use({
  210. "nvim-telescope/telescope-project.nvim",
  211. event = "BufRead",
  212. setup = function()
  213. vim.cmd([[packadd telescope.nvim]])
  214. end,
  215. disable = not O.plugin.telescope_project.active,
  216. })
  217. -- Sane gx for netrw_gx bug
  218. use({
  219. "felipec/vim-sanegx",
  220. event = "BufRead",
  221. disable = not O.plugin.sanegx.active,
  222. })
  223. -- Diffview
  224. use({
  225. "sindrets/diffview.nvim",
  226. event = "BufRead",
  227. disable = not O.plugin.diffview.active,
  228. })
  229. -- Lush Create Color Schemes
  230. use({
  231. "rktjmp/lush.nvim",
  232. -- cmd = {"LushRunQuickstart", "LushRunTutorial", "Lushify"},
  233. disable = not O.plugin.lush.active,
  234. })
  235. -- Debugger management
  236. use({
  237. "Pocco81/DAPInstall.nvim",
  238. -- event = "BufRead",
  239. disable = not O.plugin.dap_install.active,
  240. })
  241. -- LANGUAGE SPECIFIC GOES HERE
  242. use({
  243. "lervag/vimtex",
  244. ft = "tex",
  245. config = function()
  246. require("lv-vimtex")
  247. end,
  248. })
  249. -- Rust tools
  250. -- TODO: use lazy loading maybe?
  251. use({
  252. "simrat39/rust-tools.nvim",
  253. disable = not O.lang.rust.rust_tools.active,
  254. })
  255. -- Elixir
  256. use({ "elixir-editors/vim-elixir", ft = { "elixir", "eelixir", "euphoria3" } })
  257. -- Javascript / Typescript
  258. use({
  259. "jose-elias-alvarez/nvim-lsp-ts-utils",
  260. ft = {
  261. "javascript",
  262. "javascriptreact",
  263. "javascript.jsx",
  264. "typescript",
  265. "typescriptreact",
  266. "typescript.tsx",
  267. },
  268. })
  269. -- use {
  270. -- "jose-elias-alvarez/null-ls.nvim",
  271. -- ft = {
  272. -- "javascript",
  273. -- "javascriptreact",
  274. -- "javascript.jsx",
  275. -- "typescript",
  276. -- "typescriptreact",
  277. -- "typescript.tsx",
  278. -- },
  279. -- config = function()
  280. -- require("null-ls").setup()
  281. -- end,
  282. -- }
  283. -- Pretty parentheses
  284. use({
  285. "p00f/nvim-ts-rainbow",
  286. disable = not O.plugin.ts_rainbow.active,
  287. })
  288. -- Autotags <div>|</div>
  289. use({
  290. "windwp/nvim-ts-autotag",
  291. event = "InsertEnter",
  292. disable = not O.plugin.ts_autotag.active,
  293. })
  294. -- Custom semantic text objects
  295. use({
  296. "nvim-treesitter/nvim-treesitter-textobjects",
  297. disable = not O.plugin.ts_textobjects.active,
  298. })
  299. -- Smart text objects
  300. use({
  301. "RRethy/nvim-treesitter-textsubjects",
  302. disable = not O.plugin.ts_textsubjects.active,
  303. })
  304. -- Text objects using hint labels
  305. use({
  306. "mfussenegger/nvim-ts-hint-textobject",
  307. event = "BufRead",
  308. disable = not O.plugin.ts_hintobjects.active,
  309. })
  310. for _, plugin in pairs(O.user_plugins) do
  311. packer.use(plugin)
  312. end
  313. end)