plugins.lua 11 KB

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