plugins.lua 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458
  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 " ..
  6. install_path)
  7. execute "packadd packer.nvim"
  8. end
  9. local packer_ok, packer = pcall(require, "packer")
  10. if not packer_ok then return end
  11. packer.init {
  12. -- compile_path = vim.fn.stdpath('data')..'/site/pack/loader/start/packer.nvim/plugin/packer_compiled.vim',
  13. compile_path = require("packer.util").join_paths(vim.fn.stdpath('config'),
  14. 'plugin',
  15. 'packer_compiled.vim'),
  16. git = {clone_timeout = 300},
  17. display = {
  18. open_fn = function()
  19. return require("packer.util").float {border = "single"}
  20. end
  21. }
  22. }
  23. vim.cmd "autocmd BufWritePost plugins.lua PackerCompile" -- Auto compile when there are changes in plugins.lua
  24. return require("packer").startup(function(use)
  25. -- Packer can manage itself as an optional plugin
  26. use "wbthomason/packer.nvim"
  27. -- TODO refactor all of this (for now it works, but yes I know it could be wrapped in a simpler function)
  28. use {"neovim/nvim-lspconfig"}
  29. use {"glepnir/lspsaga.nvim", cmd = "Lspsaga"}
  30. use {"kabouzeid/nvim-lspinstall", cmd = "LspInstall"}
  31. -- Telescope
  32. use {"nvim-lua/popup.nvim"}
  33. use {"nvim-lua/plenary.nvim"}
  34. use {"tjdevries/astronauta.nvim"}
  35. use {
  36. "nvim-telescope/telescope.nvim",
  37. config = [[require('lv-telescope')]],
  38. cmd = "Telescope"
  39. }
  40. -- Snap TODO disable for now, need to only install fzy when user specifies they want to use snap
  41. -- use {
  42. -- "camspiers/snap",
  43. -- rocks = "fzy",
  44. -- config = function()
  45. -- require("lv-snap").config()
  46. -- end,
  47. -- disable = not O.plugin.snap.active
  48. -- }
  49. -- Autocomplete
  50. use {
  51. "hrsh7th/nvim-compe",
  52. event = "InsertEnter",
  53. config = function()
  54. require("lv-compe").config()
  55. end
  56. }
  57. use {"hrsh7th/vim-vsnip", event = "InsertEnter"}
  58. use {"rafamadriz/friendly-snippets", event = "InsertEnter"}
  59. -- Treesitter
  60. use {"nvim-treesitter/nvim-treesitter", run = ":TSUpdate"}
  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 =
  200. {"help", "terminal", "dashboard"}
  201. vim.g.indent_blankline_buftype_exclude = {"terminal"}
  202. vim.g.indent_blankline_show_trailing_blankline_indent = false
  203. vim.g.indent_blankline_show_first_indent_level = true
  204. end,
  205. disable = not O.plugin.indent_line.active
  206. }
  207. -- comments in context
  208. use {
  209. 'JoosepAlviste/nvim-ts-context-commentstring',
  210. event = "BufRead",
  211. disable = not O.plugin.ts_context_commentstring.active
  212. }
  213. -- Symbol Outline
  214. use {
  215. 'simrat39/symbols-outline.nvim',
  216. cmd = 'SymbolsOutline',
  217. disable = not O.plugin.symbol_outline.active
  218. }
  219. -- diagnostics
  220. use {
  221. "folke/trouble.nvim",
  222. cmd = 'TroubleToggle',
  223. disable = not O.plugin.trouble.active
  224. }
  225. -- Debugging
  226. use {
  227. "mfussenegger/nvim-dap",
  228. event = "BufRead",
  229. disable = not O.plugin.debug.active
  230. }
  231. -- Better quickfix
  232. use {
  233. "kevinhwang91/nvim-bqf",
  234. event = "BufRead",
  235. disable = not O.plugin.bqf.active
  236. }
  237. -- Floating terminal
  238. use {
  239. 'numToStr/FTerm.nvim',
  240. event = "BufRead",
  241. config = function()
  242. require'FTerm'.setup({
  243. dimensions = {height = 0.8, width = 0.8, x = 0.5, y = 0.5},
  244. border = 'single' -- or 'double'
  245. })
  246. end,
  247. disable = not O.plugin.floatterm.active
  248. }
  249. -- Search & Replace
  250. use {
  251. 'windwp/nvim-spectre',
  252. event = "BufRead",
  253. config = function()
  254. require('spectre').setup()
  255. end,
  256. disable = not O.plugin.spectre.active
  257. }
  258. -- lsp root with this nvim-tree will follow you
  259. use {
  260. "ahmedkhalf/lsp-rooter.nvim",
  261. event = "BufRead",
  262. config = function()
  263. require("lsp-rooter").setup()
  264. end,
  265. disable = not O.plugin.lsp_rooter.active
  266. }
  267. -- Markdown preview
  268. use {
  269. 'iamcco/markdown-preview.nvim',
  270. run = 'cd app && npm install',
  271. ft = 'markdown',
  272. disable = not O.plugin.markdown_preview.active
  273. }
  274. -- Interactive scratchpad
  275. use {
  276. 'metakirby5/codi.vim',
  277. cmd = 'Codi',
  278. disable = not O.plugin.codi.active
  279. }
  280. -- Use fzy for telescope
  281. use {
  282. "nvim-telescope/telescope-fzy-native.nvim",
  283. event = "BufRead",
  284. disable = not O.plugin.telescope_fzy.active
  285. }
  286. -- Use project for telescope
  287. use {
  288. "nvim-telescope/telescope-project.nvim",
  289. event = "BufRead",
  290. after = "telescope.nvim",
  291. disable = not O.plugin.telescope_project.active
  292. }
  293. -- Sane gx for netrw_gx bug
  294. use {
  295. "felipec/vim-sanegx",
  296. event = "BufRead",
  297. disable = not O.plugin.sanegx.active
  298. }
  299. -- Sane gx for netrw_gx bug
  300. use {
  301. "folke/todo-comments.nvim",
  302. event = "BufRead",
  303. disable = not O.plugin.todo_comments.active
  304. }
  305. -- LSP Colors
  306. use {
  307. "folke/lsp-colors.nvim",
  308. event = "BufRead",
  309. disable = not O.plugin.lsp_colors.active
  310. }
  311. -- Git Blame
  312. use {
  313. "f-person/git-blame.nvim",
  314. event = "BufRead",
  315. disable = not O.plugin.git_blame.active
  316. }
  317. use {
  318. 'ruifm/gitlinker.nvim',
  319. event = "BufRead",
  320. config = function()
  321. require"gitlinker".setup({
  322. opts = {
  323. -- remote = 'github', -- force the use of a specific remote
  324. -- adds current line nr in the url for normal mode
  325. add_current_line_on_normal_mode = true,
  326. -- callback for what to do with the url
  327. action_callback = require"gitlinker.actions".open_in_browser,
  328. -- print the url after performing the action
  329. print_url = false,
  330. -- mapping to call url generation
  331. mappings = "<leader>gy"
  332. }
  333. })
  334. end,
  335. disable = not O.plugin.gitlinker.active,
  336. requires = 'nvim-lua/plenary.nvim'
  337. }
  338. -- Lazygit
  339. use {
  340. "kdheepak/lazygit.nvim",
  341. cmd = "LazyGit",
  342. disable = not O.plugin.lazygit.active
  343. }
  344. -- Octo
  345. use {
  346. "pwntester/octo.nvim",
  347. event = "BufRead",
  348. disable = not O.plugin.octo.active
  349. }
  350. -- Diffview
  351. use {
  352. "sindrets/diffview.nvim",
  353. event = "BufRead",
  354. disable = not O.plugin.diffview.active
  355. }
  356. -- Easily Create Gists
  357. use {
  358. "mattn/vim-gist",
  359. event = "BufRead",
  360. disable = not O.plugin.gist.active,
  361. requires = 'mattn/webapi-vim'
  362. }
  363. -- Lush Create Color Schemes
  364. use {
  365. "rktjmp/lush.nvim",
  366. -- cmd = {"LushRunQuickstart", "LushRunTutorial", "Lushify"},
  367. disable = not O.plugin.lush.active
  368. }
  369. -- HTML preview
  370. use {
  371. 'turbio/bracey.vim',
  372. event = "BufRead",
  373. run = 'npm install --prefix server',
  374. disable = not O.plugin.bracey.active
  375. }
  376. -- Debugger management
  377. use {
  378. 'Pocco81/DAPInstall.nvim',
  379. event = "BufRead",
  380. disable = not O.plugin.dap_install.active
  381. }
  382. -- LANGUAGE SPECIFIC GOES HERE
  383. -- Latex TODO what filetypes should this be active for?
  384. use {"lervag/vimtex", ft = "latex"}
  385. -- Rust tools
  386. -- TODO: use lazy loading maybe?
  387. use {
  388. "simrat39/rust-tools.nvim",
  389. disable = not O.lang.rust.rust_tools.active
  390. }
  391. -- Elixir
  392. use {"elixir-editors/vim-elixir", ft = {"elixir", "eelixir", "euphoria3"}}
  393. -- Javascript / Typescript
  394. use {
  395. "jose-elias-alvarez/nvim-lsp-ts-utils",
  396. ft = {
  397. "javascript", "javascriptreact", "javascript.jsx", "typescript",
  398. "typescriptreact", "typescript.tsx"
  399. }
  400. }
  401. use {
  402. "jose-elias-alvarez/null-ls.nvim",
  403. ft = {
  404. "javascript", "javascriptreact", "javascript.jsx", "typescript",
  405. "typescriptreact", "typescript.tsx"
  406. },
  407. config = function()
  408. require('null-ls').setup()
  409. end
  410. }
  411. -- Tabnine
  412. use {
  413. "tzachar/compe-tabnine",
  414. run = "./install.sh",
  415. requires = "hrsh7th/nvim-compe",
  416. disable = not O.plugin.tabnine.active
  417. }
  418. end)