plugins.lua 8.1 KB

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