plugins.lua 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  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 = "BufWinEnter",
  189. config = function()
  190. require('lv-floatterm').config()
  191. end,
  192. disable = not O.plugin.floatterm.active,
  193. }
  194. -- Use fzy for telescope
  195. use {
  196. "nvim-telescope/telescope-fzy-native.nvim",
  197. event = "BufRead",
  198. disable = not O.plugin.telescope_fzy.active,
  199. }
  200. -- Use project for telescope
  201. use {
  202. "nvim-telescope/telescope-project.nvim",
  203. event = "BufRead",
  204. setup = function () vim.cmd[[packadd telescope.nvim]] end,
  205. disable = not O.plugin.telescope_project.active,
  206. }
  207. -- Sane gx for netrw_gx bug
  208. use {
  209. "felipec/vim-sanegx",
  210. event = "BufRead",
  211. disable = not O.plugin.sanegx.active,
  212. }
  213. -- Diffview
  214. use {
  215. "sindrets/diffview.nvim",
  216. event = "BufRead",
  217. disable = not O.plugin.diffview.active,
  218. }
  219. -- Lush Create Color Schemes
  220. use {
  221. "rktjmp/lush.nvim",
  222. -- cmd = {"LushRunQuickstart", "LushRunTutorial", "Lushify"},
  223. disable = not O.plugin.lush.active,
  224. }
  225. -- Debugger management
  226. use {
  227. "Pocco81/DAPInstall.nvim",
  228. -- event = "BufRead",
  229. disable = not O.plugin.dap_install.active,
  230. }
  231. -- LANGUAGE SPECIFIC GOES HERE
  232. use {
  233. "lervag/vimtex",
  234. ft = "tex",
  235. config = function()
  236. require "lv-vimtex"
  237. end,
  238. }
  239. -- Rust tools
  240. -- TODO: use lazy loading maybe?
  241. use {
  242. "simrat39/rust-tools.nvim",
  243. disable = not O.lang.rust.rust_tools.active,
  244. }
  245. -- Elixir
  246. use { "elixir-editors/vim-elixir", ft = { "elixir", "eelixir", "euphoria3" } }
  247. -- Javascript / Typescript
  248. use {
  249. "jose-elias-alvarez/nvim-lsp-ts-utils",
  250. ft = {
  251. "javascript",
  252. "javascriptreact",
  253. "javascript.jsx",
  254. "typescript",
  255. "typescriptreact",
  256. "typescript.tsx",
  257. },
  258. }
  259. -- use {
  260. -- "jose-elias-alvarez/null-ls.nvim",
  261. -- ft = {
  262. -- "javascript",
  263. -- "javascriptreact",
  264. -- "javascript.jsx",
  265. -- "typescript",
  266. -- "typescriptreact",
  267. -- "typescript.tsx",
  268. -- },
  269. -- config = function()
  270. -- require("null-ls").setup()
  271. -- end,
  272. -- }
  273. -- Pretty parentheses
  274. use {
  275. "p00f/nvim-ts-rainbow",
  276. disable = not O.plugin.ts_rainbow.active,
  277. }
  278. -- Autotags <div>|</div>
  279. use {
  280. "windwp/nvim-ts-autotag",
  281. event = "InsertEnter",
  282. disable = not O.plugin.ts_autotag.active,
  283. }
  284. -- Custom semantic text objects
  285. use {
  286. "nvim-treesitter/nvim-treesitter-textobjects",
  287. disable = not O.plugin.ts_textobjects.active,
  288. }
  289. -- Smart text objects
  290. use {
  291. "RRethy/nvim-treesitter-textsubjects",
  292. disable = not O.plugin.ts_textsubjects.active,
  293. }
  294. -- Text objects using hint labels
  295. use {
  296. "mfussenegger/nvim-ts-hint-textobject",
  297. event = "BufRead",
  298. disable = not O.plugin.ts_hintobjects.active,
  299. }
  300. for _, plugin in pairs(O.custom_plugins) do
  301. packer.use(plugin)
  302. end
  303. end)