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