plugins.lua 8.2 KB

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