plugins.lua 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426
  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"}
  30. use {"kabouzeid/nvim-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. config = function()
  53. require("lv-compe").config()
  54. end
  55. }
  56. use {"hrsh7th/vim-vsnip", event = "InsertEnter"}
  57. use {"rafamadriz/friendly-snippets", event = "InsertEnter"}
  58. -- Treesitter
  59. use {"nvim-treesitter/nvim-treesitter", run = ":TSUpdate"}
  60. use {
  61. "kyazdani42/nvim-tree.lua",
  62. -- cmd = "NvimTreeToggle",
  63. config = function()
  64. require("lv-nvimtree").config()
  65. end
  66. }
  67. use {
  68. "lewis6991/gitsigns.nvim",
  69. config = function()
  70. require("lv-gitsigns").config()
  71. end,
  72. event = "BufRead"
  73. }
  74. -- whichkey
  75. use {"folke/which-key.nvim"}
  76. -- Autopairs
  77. use {
  78. "windwp/nvim-autopairs",
  79. config = function()
  80. require 'lv-autopairs'
  81. end
  82. }
  83. -- Comments
  84. use {
  85. "terrortylor/nvim-comment",
  86. cmd = "CommentToggle",
  87. config = function()
  88. require('nvim_comment').setup()
  89. end
  90. }
  91. -- Color
  92. use {"christianchiarulli/nvcode-color-schemes.vim", opt = true}
  93. -- Icons
  94. use {"kyazdani42/nvim-web-devicons"}
  95. -- Status Line and Bufferline
  96. use {"glepnir/galaxyline.nvim"}
  97. use {
  98. "akinsho/nvim-bufferline.lua",
  99. config = function()
  100. require("lv-bufferline").config()
  101. end,
  102. event = "BufRead"
  103. }
  104. -- Extras, these do not load by default
  105. -- Better motions
  106. use {
  107. 'phaazon/hop.nvim',
  108. event = 'BufRead',
  109. config = function()
  110. require('lv-hop').config()
  111. end,
  112. disable = not O.plugin.hop.active,
  113. opt = true
  114. }
  115. -- Enhanced increment/decrement
  116. use {
  117. 'monaqa/dial.nvim',
  118. event = 'BufRead',
  119. config = function()
  120. require('lv-dial').config()
  121. end,
  122. disable = not O.plugin.dial.active,
  123. opt = true
  124. }
  125. -- Dashboard
  126. use {
  127. "ChristianChiarulli/dashboard-nvim",
  128. event = 'BufWinEnter',
  129. cmd = {"Dashboard", "DashboardNewFile", "DashboardJumpMarks"},
  130. config = function()
  131. require('lv-dashboard').config()
  132. end,
  133. disable = not O.plugin.dashboard.active,
  134. opt = true
  135. }
  136. -- Zen Mode
  137. use {
  138. "folke/zen-mode.nvim",
  139. cmd = "ZenMode",
  140. -- event = "BufRead",
  141. config = function()
  142. require('lv-zen').config()
  143. end,
  144. disable = not O.plugin.zen.active
  145. }
  146. -- Ranger
  147. use {
  148. "kevinhwang91/rnvimr",
  149. cmd = "Rnvimr",
  150. config = function()
  151. require('lv-rnvimr').config()
  152. end,
  153. disable = not O.plugin.ranger.active
  154. }
  155. -- matchup
  156. use {
  157. 'andymass/vim-matchup',
  158. event = "CursorMoved",
  159. config = function()
  160. require('lv-matchup').config()
  161. end,
  162. disable = not O.plugin.matchup.active
  163. }
  164. use {
  165. "norcalli/nvim-colorizer.lua",
  166. event = "BufRead",
  167. config = function()
  168. require("colorizer").setup()
  169. vim.cmd("ColorizerReloadAllBuffers")
  170. end,
  171. disable = not O.plugin.colorizer.active
  172. }
  173. use {
  174. "nacro90/numb.nvim",
  175. event = "BufRead",
  176. config = function()
  177. require('numb').setup {
  178. show_numbers = true, -- Enable 'number' for the window while peeking
  179. show_cursorline = true -- Enable 'cursorline' for the window while peeking
  180. }
  181. end,
  182. disable = not O.plugin.numb.active
  183. }
  184. -- Treesitter playground
  185. use {
  186. 'nvim-treesitter/playground',
  187. event = "BufRead",
  188. disable = not O.plugin.ts_playground.active
  189. }
  190. use {
  191. "lukas-reineke/indent-blankline.nvim",
  192. event = "BufRead",
  193. setup = function()
  194. vim.g.indentLine_enabled = 1
  195. vim.g.indent_blankline_char = "▏"
  196. vim.g.indent_blankline_filetype_exclude = {
  197. "help", "terminal", "dashboard"
  198. }
  199. vim.g.indent_blankline_buftype_exclude = {"terminal"}
  200. vim.g.indent_blankline_show_trailing_blankline_indent = false
  201. vim.g.indent_blankline_show_first_indent_level = true
  202. end,
  203. disable = not O.plugin.indent_line.active
  204. }
  205. -- comments in context
  206. use {
  207. 'JoosepAlviste/nvim-ts-context-commentstring',
  208. event = "BufRead",
  209. disable = not O.plugin.ts_context_commentstring.active
  210. }
  211. -- Symbol Outline
  212. use {
  213. 'simrat39/symbols-outline.nvim',
  214. cmd = 'SymbolsOutline',
  215. disable = not O.plugin.symbol_outline.active
  216. }
  217. -- diagnostics
  218. use {
  219. "folke/trouble.nvim",
  220. cmd = 'TroubleToggle',
  221. disable = not O.plugin.trouble.active
  222. }
  223. -- Debugging
  224. use {
  225. "mfussenegger/nvim-dap",
  226. event = "BufRead",
  227. disable = not O.plugin.debug.active
  228. }
  229. -- Better quickfix
  230. use {
  231. "kevinhwang91/nvim-bqf",
  232. event = "BufRead",
  233. disable = not O.plugin.bqf.active
  234. }
  235. -- Floating terminal
  236. use {
  237. 'numToStr/FTerm.nvim',
  238. event = "BufRead",
  239. config = function()
  240. require'FTerm'.setup({
  241. dimensions = {height = 0.8, width = 0.8, x = 0.5, y = 0.5},
  242. border = 'single' -- or 'double'
  243. })
  244. end,
  245. disable = not O.plugin.floatterm.active
  246. }
  247. -- Search & Replace
  248. use {
  249. 'windwp/nvim-spectre',
  250. event = "BufRead",
  251. config = function()
  252. require('spectre').setup()
  253. end,
  254. disable = not O.plugin.spectre.active
  255. }
  256. -- lsp root with this nvim-tree will follow you
  257. use {
  258. "ahmedkhalf/lsp-rooter.nvim",
  259. event = "BufRead",
  260. config = function()
  261. require("lsp-rooter").setup()
  262. end,
  263. disable = not O.plugin.lsp_rooter.active
  264. }
  265. -- Markdown preview
  266. use {
  267. 'iamcco/markdown-preview.nvim',
  268. run = 'cd app && npm install',
  269. ft = 'markdown',
  270. disable = not O.plugin.markdown_preview.active
  271. }
  272. -- Interactive scratchpad
  273. use {
  274. 'metakirby5/codi.vim',
  275. cmd = 'Codi',
  276. disable = not O.plugin.codi.active
  277. }
  278. -- Use fzy for telescope
  279. use {
  280. "nvim-telescope/telescope-fzy-native.nvim",
  281. event = "BufRead",
  282. disable = not O.plugin.telescope_fzy.active
  283. }
  284. -- Use project for telescope
  285. use {
  286. "nvim-telescope/telescope-project.nvim",
  287. event = "BufRead",
  288. after = "telescope.nvim",
  289. disable = not O.plugin.telescope_project.active
  290. }
  291. -- Sane gx for netrw_gx bug
  292. use {
  293. "felipec/vim-sanegx",
  294. event = "BufRead",
  295. disable = not O.plugin.sanegx.active
  296. }
  297. -- Sane gx for netrw_gx bug
  298. use {
  299. "folke/todo-comments.nvim",
  300. event = "BufRead",
  301. disable = not O.plugin.todo_comments.active
  302. }
  303. -- LSP Colors
  304. use {
  305. "folke/lsp-colors.nvim",
  306. event = "BufRead",
  307. disable = not O.plugin.lsp_colors.active
  308. }
  309. -- Git Blame
  310. use {
  311. "f-person/git-blame.nvim",
  312. event = "BufRead",
  313. disable = not O.plugin.git_blame.active
  314. }
  315. use {
  316. 'ruifm/gitlinker.nvim',
  317. event = "BufRead",
  318. config = function()
  319. require"gitlinker".setup({
  320. opts = {
  321. -- remote = 'github', -- force the use of a specific remote
  322. -- adds current line nr in the url for normal mode
  323. add_current_line_on_normal_mode = true,
  324. -- callback for what to do with the url
  325. action_callback = require"gitlinker.actions".open_in_browser,
  326. -- print the url after performing the action
  327. print_url = false,
  328. -- mapping to call url generation
  329. mappings = "<leader>gy"
  330. }
  331. })
  332. end,
  333. disable = not O.plugin.gitlinker.active,
  334. requires = 'nvim-lua/plenary.nvim'
  335. }
  336. -- Lazygit
  337. use {
  338. "kdheepak/lazygit.nvim",
  339. cmd = "LazyGit",
  340. disable = not O.plugin.lazygit.active
  341. }
  342. -- Lazygit
  343. use {
  344. "pwntester/octo.nvim",
  345. event = "BufRead",
  346. disable = not O.plugin.octo.active
  347. }
  348. -- Diffview
  349. use {
  350. "sindrets/diffview.nvim",
  351. event = "BufRead",
  352. disable = not O.plugin.diffview.active
  353. }
  354. -- Easily Create Gists
  355. use {
  356. "mattn/vim-gist",
  357. event = "BufRead",
  358. disable = not O.plugin.gist.active,
  359. requires = 'mattn/webapi-vim'
  360. }
  361. -- Lush Create Color Schemes
  362. use {
  363. "rktjmp/lush.nvim",
  364. -- cmd = {"LushRunQuickstart", "LushRunTutorial", "Lushify"},
  365. disable = not O.plugin.lush.active
  366. }
  367. -- HTML preview
  368. use {
  369. 'turbio/bracey.vim',
  370. event = "BufRead",
  371. run = 'npm install --prefix server',
  372. disable = not O.plugin.bracey.active
  373. }
  374. -- Debugger management
  375. use {
  376. 'Pocco81/DAPInstall.nvim',
  377. event = "BufRead",
  378. disable = not O.plugin.dap_install.active
  379. }
  380. -- LANGUAGE SPECIFIC GOES HERE
  381. -- Latex TODO what filetypes should this be active for?
  382. use {"lervag/vimtex", ft = "latex"}
  383. -- Rust tools
  384. -- TODO: use lazy loading maybe?
  385. use {"simrat39/rust-tools.nvim", ft = "rust"}
  386. -- Elixir
  387. use {"elixir-editors/vim-elixir", ft = {"elixir", "eelixir", "euphoria3"}}
  388. end)