plugins.lua 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467
  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. -- compile_path = vim.fn.stdpath('data')..'/site/pack/loader/start/packer.nvim/plugin/packer_compiled.vim',
  14. compile_path = require("packer.util").join_paths(vim.fn.stdpath "config", "plugin", "packer_compiled.vim"),
  15. git = { clone_timeout = 300 },
  16. display = {
  17. open_fn = function()
  18. return require("packer.util").float { border = "single" }
  19. end,
  20. },
  21. }
  22. vim.cmd "autocmd BufWritePost plugins.lua PackerCompile"
  23. return require("packer").startup(function(use)
  24. -- Packer can manage itself as an optional plugin
  25. use "wbthomason/packer.nvim"
  26. -- TODO refactor all of this (for now it works, but yes I know it could be wrapped in a simpler function)
  27. use { "neovim/nvim-lspconfig" }
  28. use { "kabouzeid/nvim-lspinstall", cmd = "LspInstall" }
  29. -- Telescope
  30. use { "nvim-lua/popup.nvim" }
  31. use { "nvim-lua/plenary.nvim" }
  32. use { "tjdevries/astronauta.nvim" }
  33. use {
  34. "nvim-telescope/telescope.nvim",
  35. config = [[require('lv-telescope')]],
  36. cmd = "Telescope",
  37. }
  38. -- Snap TODO disable for now, need to only install fzy when user specifies they want to use snap
  39. -- use {
  40. -- "camspiers/snap",
  41. -- rocks = "fzy",
  42. -- config = function()
  43. -- require("lv-snap").config()
  44. -- end,
  45. -- disable = not O.plugin.snap.active
  46. -- }
  47. -- Autocomplete
  48. use {
  49. "hrsh7th/nvim-compe",
  50. event = "InsertEnter",
  51. config = function()
  52. require("lv-compe").config()
  53. end,
  54. }
  55. use { "hrsh7th/vim-vsnip", event = "InsertEnter" }
  56. use { "rafamadriz/friendly-snippets", event = "InsertEnter" }
  57. -- Treesitter
  58. use { "nvim-treesitter/nvim-treesitter", run = ":TSUpdate" }
  59. -- Neoformat
  60. use { "sbdchd/neoformat", event = "BufEnter" }
  61. use {
  62. "kyazdani42/nvim-tree.lua",
  63. -- cmd = "NvimTreeToggle",
  64. config = function()
  65. require("lv-nvimtree").config()
  66. end,
  67. }
  68. use {
  69. "lewis6991/gitsigns.nvim",
  70. config = function()
  71. require("lv-gitsigns").config()
  72. end,
  73. event = "BufRead",
  74. }
  75. -- whichkey
  76. use { "folke/which-key.nvim" }
  77. -- Autopairs
  78. use {
  79. "windwp/nvim-autopairs",
  80. event = "InsertEnter",
  81. after = { "telescope.nvim", "nvim-compe" },
  82. config = function()
  83. require "lv-autopairs"
  84. end,
  85. }
  86. -- Comments
  87. use {
  88. "terrortylor/nvim-comment",
  89. cmd = "CommentToggle",
  90. config = function()
  91. require("nvim_comment").setup()
  92. end,
  93. }
  94. -- Color
  95. use { "christianchiarulli/nvcode-color-schemes.vim", opt = true }
  96. -- Icons
  97. use { "kyazdani42/nvim-web-devicons" }
  98. -- Status Line and Bufferline
  99. use { "glepnir/galaxyline.nvim" }
  100. use {
  101. "akinsho/nvim-bufferline.lua",
  102. config = function()
  103. require("lv-bufferline").config()
  104. end,
  105. event = "BufRead",
  106. }
  107. -- Extras, these do not load by default
  108. -- Better motions
  109. use {
  110. "phaazon/hop.nvim",
  111. event = "BufRead",
  112. config = function()
  113. require("lv-hop").config()
  114. end,
  115. disable = not O.plugin.hop.active,
  116. opt = true,
  117. }
  118. -- Enhanced increment/decrement
  119. use {
  120. "monaqa/dial.nvim",
  121. event = "BufRead",
  122. config = function()
  123. require("lv-dial").config()
  124. end,
  125. disable = not O.plugin.dial.active,
  126. opt = true,
  127. }
  128. -- Dashboard
  129. use {
  130. "ChristianChiarulli/dashboard-nvim",
  131. event = "BufWinEnter",
  132. cmd = { "Dashboard", "DashboardNewFile", "DashboardJumpMarks" },
  133. config = function()
  134. require("lv-dashboard").config()
  135. end,
  136. disable = not O.plugin.dashboard.active,
  137. opt = true,
  138. }
  139. -- Zen Mode
  140. use {
  141. "folke/zen-mode.nvim",
  142. cmd = "ZenMode",
  143. -- event = "BufRead",
  144. config = function()
  145. require("lv-zen").config()
  146. end,
  147. disable = not O.plugin.zen.active,
  148. }
  149. -- Ranger
  150. use {
  151. "kevinhwang91/rnvimr",
  152. cmd = "Rnvimr",
  153. config = function()
  154. require("lv-rnvimr").config()
  155. end,
  156. disable = not O.plugin.ranger.active,
  157. }
  158. -- matchup
  159. use {
  160. "andymass/vim-matchup",
  161. event = "CursorMoved",
  162. config = function()
  163. require("lv-matchup").config()
  164. end,
  165. disable = not O.plugin.matchup.active,
  166. }
  167. use {
  168. "norcalli/nvim-colorizer.lua",
  169. event = "BufRead",
  170. config = function()
  171. require("colorizer").setup()
  172. vim.cmd "ColorizerReloadAllBuffers"
  173. end,
  174. disable = not O.plugin.colorizer.active,
  175. }
  176. use {
  177. "nacro90/numb.nvim",
  178. event = "BufRead",
  179. config = function()
  180. require("numb").setup {
  181. show_numbers = true, -- Enable 'number' for the window while peeking
  182. show_cursorline = true, -- Enable 'cursorline' for the window while peeking
  183. }
  184. end,
  185. disable = not O.plugin.numb.active,
  186. }
  187. -- Treesitter playground
  188. use {
  189. "nvim-treesitter/playground",
  190. event = "BufRead",
  191. disable = not O.plugin.ts_playground.active,
  192. }
  193. use {
  194. "lukas-reineke/indent-blankline.nvim",
  195. event = "BufRead",
  196. setup = function()
  197. vim.g.indentLine_enabled = 1
  198. vim.g.indent_blankline_char = "▏"
  199. vim.g.indent_blankline_filetype_exclude = { "help", "terminal", "dashboard" }
  200. vim.g.indent_blankline_buftype_exclude = { "terminal" }
  201. vim.g.indent_blankline_show_trailing_blankline_indent = false
  202. vim.g.indent_blankline_show_first_indent_level = true
  203. end,
  204. disable = not O.plugin.indent_line.active,
  205. }
  206. -- comments in context
  207. use {
  208. "JoosepAlviste/nvim-ts-context-commentstring",
  209. event = "BufRead",
  210. disable = not O.plugin.ts_context_commentstring.active,
  211. }
  212. -- Symbol Outline
  213. use {
  214. "simrat39/symbols-outline.nvim",
  215. cmd = "SymbolsOutline",
  216. disable = not O.plugin.symbol_outline.active,
  217. }
  218. -- diagnostics
  219. use {
  220. "folke/trouble.nvim",
  221. cmd = "TroubleToggle",
  222. disable = not O.plugin.trouble.active,
  223. }
  224. -- Debugging
  225. use {
  226. "mfussenegger/nvim-dap",
  227. config = function()
  228. require('dap')
  229. vim.fn.sign_define('DapBreakpoint', {text='', texthl='LspDiagnosticsSignError', linehl='', numhl=''})
  230. require('dap').defaults.fallback.terminal_win_cmd = '50vsplit new'
  231. end,
  232. disable = not O.plugin.debug.active,
  233. }
  234. -- Better quickfix
  235. use {
  236. "kevinhwang91/nvim-bqf",
  237. event = "BufRead",
  238. disable = not O.plugin.bqf.active,
  239. }
  240. -- Floating terminal
  241. use {
  242. "numToStr/FTerm.nvim",
  243. event = "BufRead",
  244. config = function()
  245. require("FTerm").setup {
  246. dimensions = { height = 0.8, width = 0.8, x = 0.5, y = 0.5 },
  247. border = "single", -- or 'double'
  248. }
  249. end,
  250. disable = not O.plugin.floatterm.active,
  251. }
  252. -- Search & Replace
  253. use {
  254. "windwp/nvim-spectre",
  255. event = "BufRead",
  256. config = function()
  257. require("spectre").setup()
  258. end,
  259. disable = not O.plugin.spectre.active,
  260. }
  261. -- lsp root with this nvim-tree will follow you
  262. use {
  263. "ahmedkhalf/lsp-rooter.nvim",
  264. event = "BufRead",
  265. config = function()
  266. require("lsp-rooter").setup()
  267. end,
  268. disable = not O.plugin.lsp_rooter.active,
  269. }
  270. -- Markdown preview
  271. use {
  272. "iamcco/markdown-preview.nvim",
  273. run = "cd app && npm install",
  274. ft = "markdown",
  275. disable = not O.plugin.markdown_preview.active,
  276. }
  277. -- Interactive scratchpad
  278. use {
  279. "metakirby5/codi.vim",
  280. cmd = "Codi",
  281. disable = not O.plugin.codi.active,
  282. }
  283. -- Use fzy for telescope
  284. use {
  285. "nvim-telescope/telescope-fzy-native.nvim",
  286. event = "BufRead",
  287. disable = not O.plugin.telescope_fzy.active,
  288. }
  289. -- Use project for telescope
  290. use {
  291. "nvim-telescope/telescope-project.nvim",
  292. event = "BufRead",
  293. after = "telescope.nvim",
  294. disable = not O.plugin.telescope_project.active,
  295. }
  296. -- Sane gx for netrw_gx bug
  297. use {
  298. "felipec/vim-sanegx",
  299. event = "BufRead",
  300. disable = not O.plugin.sanegx.active,
  301. }
  302. -- Sane gx for netrw_gx bug
  303. use {
  304. "folke/todo-comments.nvim",
  305. event = "BufRead",
  306. disable = not O.plugin.todo_comments.active,
  307. }
  308. -- LSP Colors
  309. use {
  310. "folke/lsp-colors.nvim",
  311. event = "BufRead",
  312. disable = not O.plugin.lsp_colors.active,
  313. }
  314. -- Git Blame
  315. use {
  316. "f-person/git-blame.nvim",
  317. event = "BufRead",
  318. disable = not O.plugin.git_blame.active,
  319. }
  320. use {
  321. "ruifm/gitlinker.nvim",
  322. event = "BufRead",
  323. config = function()
  324. require("gitlinker").setup {
  325. opts = {
  326. -- remote = 'github', -- force the use of a specific remote
  327. -- adds current line nr in the url for normal mode
  328. add_current_line_on_normal_mode = true,
  329. -- callback for what to do with the url
  330. action_callback = require("gitlinker.actions").open_in_browser,
  331. -- print the url after performing the action
  332. print_url = false,
  333. -- mapping to call url generation
  334. mappings = "<leader>gy",
  335. },
  336. }
  337. end,
  338. disable = not O.plugin.gitlinker.active,
  339. requires = "nvim-lua/plenary.nvim",
  340. }
  341. -- Lazygit
  342. use {
  343. "kdheepak/lazygit.nvim",
  344. cmd = "LazyGit",
  345. disable = not O.plugin.lazygit.active,
  346. }
  347. -- Octo
  348. use {
  349. "pwntester/octo.nvim",
  350. event = "BufRead",
  351. disable = not O.plugin.octo.active,
  352. }
  353. -- Diffview
  354. use {
  355. "sindrets/diffview.nvim",
  356. event = "BufRead",
  357. disable = not O.plugin.diffview.active,
  358. }
  359. -- Easily Create Gists
  360. use {
  361. "mattn/vim-gist",
  362. event = "BufRead",
  363. disable = not O.plugin.gist.active,
  364. requires = "mattn/webapi-vim",
  365. }
  366. -- Lush Create Color Schemes
  367. use {
  368. "rktjmp/lush.nvim",
  369. -- cmd = {"LushRunQuickstart", "LushRunTutorial", "Lushify"},
  370. disable = not O.plugin.lush.active,
  371. }
  372. -- HTML preview
  373. use {
  374. "turbio/bracey.vim",
  375. event = "BufRead",
  376. run = "npm install --prefix server",
  377. disable = not O.plugin.bracey.active,
  378. }
  379. -- Debugger management
  380. use {
  381. "Pocco81/DAPInstall.nvim",
  382. -- event = "BufRead",
  383. disable = not O.plugin.dap_install.active,
  384. }
  385. -- LANGUAGE SPECIFIC GOES HERE
  386. use { "lervag/vimtex", ft = "tex" }
  387. -- Rust tools
  388. -- TODO: use lazy loading maybe?
  389. use {
  390. "simrat39/rust-tools.nvim",
  391. disable = not O.lang.rust.rust_tools.active,
  392. }
  393. -- Elixir
  394. use { "elixir-editors/vim-elixir", ft = { "elixir", "eelixir", "euphoria3" } }
  395. -- Javascript / Typescript
  396. use {
  397. "jose-elias-alvarez/nvim-lsp-ts-utils",
  398. ft = {
  399. "javascript",
  400. "javascriptreact",
  401. "javascript.jsx",
  402. "typescript",
  403. "typescriptreact",
  404. "typescript.tsx",
  405. },
  406. }
  407. -- use {
  408. -- "jose-elias-alvarez/null-ls.nvim",
  409. -- ft = {
  410. -- "javascript",
  411. -- "javascriptreact",
  412. -- "javascript.jsx",
  413. -- "typescript",
  414. -- "typescriptreact",
  415. -- "typescript.tsx",
  416. -- },
  417. -- config = function()
  418. -- require("null-ls").setup()
  419. -- end,
  420. -- }
  421. -- Tabnine
  422. use {
  423. "tzachar/compe-tabnine",
  424. run = "./install.sh",
  425. requires = "hrsh7th/nvim-compe",
  426. disable = not O.plugin.tabnine.active,
  427. }
  428. for _, plugin in pairs(O.custom_plugins) do packer.use(plugin) end
  429. end)