plugins.lua 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359
  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. -- event = "BufEnter",
  53. -- cmd = "NvimTreeToggle",
  54. commit = "fd7f60e242205ea9efc9649101c81a07d5f458bb",
  55. config = function()
  56. require("lv-nvimtree").config()
  57. end,
  58. }
  59. use {
  60. "lewis6991/gitsigns.nvim",
  61. config = function()
  62. require("lv-gitsigns").config()
  63. end,
  64. event = "BufRead",
  65. }
  66. -- whichkey
  67. use {
  68. "folke/which-key.nvim",
  69. config = function()
  70. require "lv-which-key"
  71. end,
  72. event = "BufWinEnter",
  73. }
  74. -- Autopairs
  75. use {
  76. "windwp/nvim-autopairs",
  77. event = "InsertEnter",
  78. after = { "telescope.nvim" },
  79. config = function()
  80. require "lv-autopairs"
  81. end,
  82. }
  83. -- Comments
  84. use {
  85. "terrortylor/nvim-comment",
  86. event = "BufRead",
  87. -- cmd = "CommentToggle",
  88. config = function()
  89. local status_ok, nvim_comment = pcall(require, "nvim_comment")
  90. if not status_ok then
  91. return
  92. end
  93. nvim_comment.setup()
  94. end,
  95. }
  96. -- Color
  97. use { "christianchiarulli/nvcode-color-schemes.vim", opt = true }
  98. -- Icons
  99. use { "kyazdani42/nvim-web-devicons" }
  100. -- Status Line and Bufferline
  101. use { "glepnir/galaxyline.nvim" }
  102. use {
  103. "romgrk/barbar.nvim",
  104. config = function()
  105. vim.api.nvim_set_keymap("n", "<TAB>", ":BufferNext<CR>", { noremap = true, silent = true })
  106. vim.api.nvim_set_keymap("n", "<S-TAB>", ":BufferPrevious<CR>", { noremap = true, silent = true })
  107. vim.api.nvim_set_keymap("n", "<S-x>", ":BufferClose<CR>", { noremap = true, silent = true })
  108. end,
  109. -- event = "BufRead",
  110. }
  111. -- Builtins, these do not load by default
  112. -- Dashboard
  113. use {
  114. "ChristianChiarulli/dashboard-nvim",
  115. event = "BufWinEnter",
  116. -- cmd = { "Dashboard", "DashboardNewFile", "DashboardJumpMarks" },
  117. -- config = function()
  118. -- require("lv-dashboard").config()
  119. -- end,
  120. disable = not O.plugin.dashboard.active,
  121. -- opt = true,
  122. }
  123. -- Zen Mode
  124. use {
  125. "folke/zen-mode.nvim",
  126. cmd = "ZenMode",
  127. -- event = "BufRead",
  128. config = function()
  129. require("lv-zen").config()
  130. end,
  131. disable = not O.plugin.zen.active,
  132. }
  133. use {
  134. "norcalli/nvim-colorizer.lua",
  135. event = "BufRead",
  136. config = function()
  137. require "lv-colorizer"
  138. -- vim.cmd "ColorizerReloadAllBuffers"
  139. end,
  140. disable = not O.plugin.colorizer.active,
  141. }
  142. -- Treesitter playground
  143. use {
  144. "nvim-treesitter/playground",
  145. event = "BufRead",
  146. disable = not O.plugin.ts_playground.active,
  147. }
  148. use {
  149. "lukas-reineke/indent-blankline.nvim",
  150. event = "BufRead",
  151. setup = function()
  152. vim.g.indentLine_enabled = 1
  153. vim.g.indent_blankline_char = "▏"
  154. vim.g.indent_blankline_filetype_exclude = {
  155. "help",
  156. "terminal",
  157. "dashboard",
  158. }
  159. vim.g.indent_blankline_buftype_exclude = { "terminal" }
  160. vim.g.indent_blankline_show_trailing_blankline_indent = false
  161. vim.g.indent_blankline_show_first_indent_level = true
  162. end,
  163. disable = not O.plugin.indent_line.active,
  164. }
  165. -- comments in context
  166. use {
  167. "JoosepAlviste/nvim-ts-context-commentstring",
  168. event = "BufRead",
  169. disable = not O.plugin.ts_context_commentstring.active,
  170. }
  171. -- Symbol Outline
  172. use {
  173. "simrat39/symbols-outline.nvim",
  174. cmd = "SymbolsOutline",
  175. disable = not O.plugin.symbol_outline.active,
  176. }
  177. -- diagnostics
  178. use {
  179. "folke/trouble.nvim",
  180. cmd = "TroubleToggle",
  181. disable = not O.plugin.trouble.active,
  182. }
  183. -- Debugging
  184. use {
  185. "mfussenegger/nvim-dap",
  186. config = function()
  187. require "lv-dap"
  188. end,
  189. disable = not O.plugin.debug.active,
  190. }
  191. -- Floating terminal
  192. use {
  193. "numToStr/FTerm.nvim",
  194. event = "BufRead",
  195. config = function()
  196. require("lv-floatterm").config()
  197. end,
  198. disable = not O.plugin.floatterm.active,
  199. }
  200. -- Use fzy for telescope
  201. use {
  202. "nvim-telescope/telescope-fzy-native.nvim",
  203. event = "BufRead",
  204. disable = not O.plugin.telescope_fzy.active,
  205. }
  206. -- Use project for telescope
  207. use {
  208. "nvim-telescope/telescope-project.nvim",
  209. event = "BufRead",
  210. setup = function()
  211. vim.cmd [[packadd telescope.nvim]]
  212. end,
  213. disable = not O.plugin.telescope_project.active,
  214. }
  215. -- Sane gx for netrw_gx bug
  216. use {
  217. "felipec/vim-sanegx",
  218. event = "BufRead",
  219. disable = not O.plugin.sanegx.active,
  220. }
  221. -- Diffview
  222. use {
  223. "sindrets/diffview.nvim",
  224. event = "BufRead",
  225. disable = not O.plugin.diffview.active,
  226. }
  227. -- Lush Create Color Schemes
  228. use {
  229. "rktjmp/lush.nvim",
  230. -- cmd = {"LushRunQuickstart", "LushRunTutorial", "Lushify"},
  231. disable = not O.plugin.lush.active,
  232. }
  233. -- Debugger management
  234. use {
  235. "Pocco81/DAPInstall.nvim",
  236. -- event = "BufRead",
  237. disable = not O.plugin.dap_install.active,
  238. }
  239. -- LANGUAGE SPECIFIC GOES HERE
  240. use {
  241. "lervag/vimtex",
  242. ft = "tex",
  243. config = function()
  244. require "lv-vimtex"
  245. end,
  246. }
  247. -- Rust tools
  248. -- TODO: use lazy loading maybe?
  249. use {
  250. "simrat39/rust-tools.nvim",
  251. disable = not O.lang.rust.rust_tools.active,
  252. }
  253. -- Elixir
  254. use { "elixir-editors/vim-elixir", ft = { "elixir", "eelixir", "euphoria3" } }
  255. -- Javascript / Typescript
  256. use {
  257. "jose-elias-alvarez/nvim-lsp-ts-utils",
  258. ft = {
  259. "javascript",
  260. "javascriptreact",
  261. "javascript.jsx",
  262. "typescript",
  263. "typescriptreact",
  264. "typescript.tsx",
  265. },
  266. }
  267. -- use {
  268. -- "jose-elias-alvarez/null-ls.nvim",
  269. -- ft = {
  270. -- "javascript",
  271. -- "javascriptreact",
  272. -- "javascript.jsx",
  273. -- "typescript",
  274. -- "typescriptreact",
  275. -- "typescript.tsx",
  276. -- },
  277. -- config = function()
  278. -- require("null-ls").setup()
  279. -- end,
  280. -- }
  281. -- Pretty parentheses
  282. use {
  283. "p00f/nvim-ts-rainbow",
  284. disable = not O.plugin.ts_rainbow.active,
  285. }
  286. -- Autotags <div>|</div>
  287. use {
  288. "windwp/nvim-ts-autotag",
  289. event = "InsertEnter",
  290. disable = not O.plugin.ts_autotag.active,
  291. }
  292. -- Custom semantic text objects
  293. use {
  294. "nvim-treesitter/nvim-treesitter-textobjects",
  295. disable = not O.plugin.ts_textobjects.active,
  296. }
  297. -- Smart text objects
  298. use {
  299. "RRethy/nvim-treesitter-textsubjects",
  300. disable = not O.plugin.ts_textsubjects.active,
  301. }
  302. -- Text objects using hint labels
  303. use {
  304. "mfussenegger/nvim-ts-hint-textobject",
  305. event = "BufRead",
  306. disable = not O.plugin.ts_hintobjects.active,
  307. }
  308. for _, plugin in pairs(O.user_plugins) do
  309. packer.use(plugin)
  310. end
  311. end)