plugins.lua 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428
  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. cmd = "LspInstall",
  32. }
  33. -- Telescope
  34. use {"nvim-lua/popup.nvim"}
  35. use {"nvim-lua/plenary.nvim"}
  36. use {"tjdevries/astronauta.nvim"}
  37. use {
  38. "nvim-telescope/telescope.nvim",
  39. config = [[require('lv-telescope')]],
  40. cmd = "Telescope"
  41. }
  42. -- Snap TODO disable for now, need to only install fzy when user specifies they want to use snap
  43. -- use {
  44. -- "camspiers/snap",
  45. -- rocks = "fzy",
  46. -- config = function()
  47. -- require("lv-snap").config()
  48. -- end,
  49. -- disable = not O.plugin.snap.active
  50. -- }
  51. -- Autocomplete
  52. use {
  53. "hrsh7th/nvim-compe",
  54. config = function()
  55. require("lv-compe").config()
  56. end
  57. }
  58. use {"hrsh7th/vim-vsnip", event = "InsertEnter"}
  59. use {"rafamadriz/friendly-snippets", event = "InsertEnter"}
  60. -- Treesitter
  61. use {"nvim-treesitter/nvim-treesitter", run = ":TSUpdate"}
  62. use {
  63. "kyazdani42/nvim-tree.lua",
  64. -- cmd = "NvimTreeToggle",
  65. config = function()
  66. require("lv-nvimtree").config()
  67. end
  68. }
  69. use {
  70. "lewis6991/gitsigns.nvim",
  71. config = function()
  72. require("lv-gitsigns").config()
  73. end,
  74. event = "BufRead"
  75. }
  76. -- whichkey
  77. use {"folke/which-key.nvim"}
  78. -- Autopairs
  79. use {
  80. "windwp/nvim-autopairs",
  81. config = function()
  82. require 'lv-autopairs'
  83. end
  84. }
  85. -- Comments
  86. use {
  87. "terrortylor/nvim-comment",
  88. cmd = "CommentToggle",
  89. config = function()
  90. require('nvim_comment').setup()
  91. end
  92. }
  93. -- Color
  94. use {"christianchiarulli/nvcode-color-schemes.vim", opt = true}
  95. -- Icons
  96. use {"kyazdani42/nvim-web-devicons"}
  97. -- Status Line and Bufferline
  98. use {"glepnir/galaxyline.nvim"}
  99. use {
  100. "akinsho/nvim-bufferline.lua",
  101. config = function()
  102. require("lv-bufferline").config()
  103. end,
  104. event = "BufRead"
  105. }
  106. -- Extras, these do not load by default
  107. -- Better motions
  108. use {
  109. 'phaazon/hop.nvim',
  110. event = 'BufRead',
  111. config = function()
  112. require('lv-hop').config()
  113. end,
  114. disable = not O.plugin.hop.active,
  115. opt = true
  116. }
  117. -- Enhanced increment/decrement
  118. use {
  119. 'monaqa/dial.nvim',
  120. event = 'BufRead',
  121. config = function()
  122. require('lv-dial').config()
  123. end,
  124. disable = not O.plugin.dial.active,
  125. opt = true
  126. }
  127. -- Dashboard
  128. use {
  129. "ChristianChiarulli/dashboard-nvim",
  130. event = 'BufWinEnter',
  131. cmd = {"Dashboard", "DashboardNewFile", "DashboardJumpMarks"},
  132. config = function()
  133. require('lv-dashboard').config()
  134. end,
  135. disable = not O.plugin.dashboard.active,
  136. opt = true
  137. }
  138. -- Zen Mode
  139. use {
  140. "folke/zen-mode.nvim",
  141. cmd = "ZenMode",
  142. -- event = "BufRead",
  143. config = function()
  144. require('lv-zen').config()
  145. end,
  146. disable = not O.plugin.zen.active
  147. }
  148. -- Ranger
  149. use {
  150. "kevinhwang91/rnvimr",
  151. cmd = "Rnvimr",
  152. config = function()
  153. require('lv-rnvimr').config()
  154. end,
  155. disable = not O.plugin.ranger.active
  156. }
  157. -- matchup
  158. use {
  159. 'andymass/vim-matchup',
  160. event = "CursorMoved",
  161. config = function()
  162. require('lv-matchup').config()
  163. end,
  164. disable = not O.plugin.matchup.active
  165. }
  166. use {
  167. "norcalli/nvim-colorizer.lua",
  168. event = "BufRead",
  169. config = function()
  170. require("colorizer").setup()
  171. vim.cmd("ColorizerReloadAllBuffers")
  172. end,
  173. disable = not O.plugin.colorizer.active
  174. }
  175. use {
  176. "nacro90/numb.nvim",
  177. event = "BufRead",
  178. config = function()
  179. require('numb').setup {
  180. show_numbers = true, -- Enable 'number' for the window while peeking
  181. show_cursorline = true -- Enable 'cursorline' for the window while peeking
  182. }
  183. end,
  184. disable = not O.plugin.numb.active
  185. }
  186. -- Treesitter playground
  187. use {
  188. 'nvim-treesitter/playground',
  189. event = "BufRead",
  190. disable = not O.plugin.ts_playground.active
  191. }
  192. use {
  193. "lukas-reineke/indent-blankline.nvim",
  194. event = "BufRead",
  195. setup = function()
  196. vim.g.indentLine_enabled = 1
  197. vim.g.indent_blankline_char = "▏"
  198. vim.g.indent_blankline_filetype_exclude = {
  199. "help", "terminal", "dashboard"
  200. }
  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 {"simrat39/rust-tools.nvim", disable = not O.lang.rust.rust_tools.active}
  388. -- Elixir
  389. use {"elixir-editors/vim-elixir", ft = {"elixir", "eelixir", "euphoria3"}}
  390. end)