plugins.lua 7.9 KB

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