plugins.lua 8.1 KB

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