plugins.lua 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  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. --- Check if a file or directory exists in this path
  9. local function require_plugin(plugin)
  10. local plugin_prefix = fn.stdpath("data") .. "/site/pack/packer/opt/"
  11. local plugin_path = plugin_prefix .. plugin .. "/"
  12. -- print('test '..plugin_path)
  13. local ok, err, code = os.rename(plugin_path, plugin_path)
  14. if not ok then
  15. if code == 13 then
  16. -- Permission denied, but it exists
  17. return true
  18. end
  19. end
  20. -- print(ok, err, code)
  21. if ok then vim.cmd("packadd " .. plugin) end
  22. return ok, err, code
  23. end
  24. vim.cmd "autocmd BufWritePost plugins.lua PackerCompile" -- Auto compile when there are changes in plugins.lua
  25. return require("packer").startup(function(use)
  26. -- Packer can manage itself as an optional plugin
  27. use "wbthomason/packer.nvim"
  28. -- TODO refactor all of this (for now it works, but yes I know it could be wrapped in a simpler function)
  29. use {"neovim/nvim-lspconfig", opt = true}
  30. use {"kabouzeid/nvim-lspinstall", opt = true}
  31. -- Telescope
  32. use {"nvim-lua/popup.nvim", opt = true}
  33. use {"nvim-lua/plenary.nvim", opt = true}
  34. use {"nvim-telescope/telescope.nvim", opt = true}
  35. -- Autocomplete
  36. use {"hrsh7th/nvim-compe", event = "InsertEnter", opt = true}
  37. -- Treesitter
  38. use {
  39. "nvim-treesitter/nvim-treesitter",
  40. -- event = "BufRead"
  41. run = ":TSUpdate"
  42. }
  43. -- Explorer
  44. -- use {"kyazdani42/nvim-tree.lua", opt = true}
  45. use {"kyazdani42/nvim-tree.lua", opt = true, cmd = "NvimTreeToggle", config = require_plugin("nvim-tree.lua")}
  46. -- use {'lukas-reineke/indent-blankline.nvim', opt=true, branch = 'lua'}
  47. use {"lewis6991/gitsigns.nvim", config = require_plugin("gitsigns.nvim"), event = "BufRead", opt = true}
  48. use {"folke/which-key.nvim", config = require_plugin("which-key.nvim"), opt = true}
  49. use {"windwp/nvim-autopairs", config = require_plugin("nvim-autopairs"), event = "InsertEnter", opt = true}
  50. -- Comments
  51. use {"terrortylor/nvim-comment", config = require_plugin("nvim-comment"), opt = true}
  52. -- Color
  53. use {"christianchiarulli/nvcode-color-schemes.vim", config = require_plugin("nvcode-color-schemes.vim"), opt = true}
  54. -- Icons
  55. use {"kyazdani42/nvim-web-devicons", config = require_plugin("nvim-web-devicons"), opt = true}
  56. -- Status Line and Bufferline
  57. use {"glepnir/galaxyline.nvim", config = require_plugin("galaxyline.nvim"), opt = true}
  58. use {"romgrk/barbar.nvim", config = require_plugin("barbar.nvim"), opt = true}
  59. use {"hrsh7th/vim-vsnip", config = require_plugin("vim-vsnip"), opt = true}
  60. require_plugin("nvim-lspconfig")
  61. require_plugin("nvim-lspinstall")
  62. require_plugin("popup.nvim")
  63. require_plugin("plenary.nvim")
  64. require_plugin("telescope.nvim")
  65. require_plugin("nvim-compe")
  66. require_plugin("nvim-treesitter")
  67. -- Extras
  68. if O.extras then
  69. -- Interactive scratchpad
  70. use {'metakirby5/codi.vim', opt = true}
  71. require_plugin('codi.vim')
  72. -- Markdown preview
  73. use {'iamcco/markdown-preview.nvim', run = 'cd app && npm install', opt = true}
  74. require_plugin('markdown-preview.nvim')
  75. -- Floating terminal
  76. use {'numToStr/FTerm.nvim', opt = true}
  77. require_plugin('FTerm.nvim')
  78. -- Enhanced increment/decrement
  79. use {'monaqa/dial.nvim', opt = true}
  80. require_plugin('dial.nvim')
  81. -- Peek lines
  82. use {'nacro90/numb.nvim', opt = true}
  83. require_plugin('numb.nvim')
  84. -- HTML preview
  85. use {'turbio/bracey.vim', run = 'npm install --prefix server', opt = true}
  86. require_plugin('bracey.vim')
  87. -- Better motions
  88. use {'phaazon/hop.nvim', opt = true}
  89. require_plugin('hop.nvim')
  90. -- Colorizer
  91. use {'norcalli/nvim-colorizer.lua', opt = true}
  92. require_plugin('nvim-colorizer.lua')
  93. -- Search & Replace
  94. use {'windwp/nvim-spectre', opt = true}
  95. require_plugin('nvim-spectre')
  96. use {'simrat39/symbols-outline.nvim', opt = true}
  97. require_plugin('symbols-outline.nvim')
  98. -- Treesitter playground
  99. use {'nvim-treesitter/playground', opt = true}
  100. require_plugin('playground')
  101. -- Latex
  102. use {"lervag/vimtex", opt = true}
  103. require_plugin("vimtex")
  104. -- matchup
  105. use {'andymass/vim-matchup', opt = true}
  106. require_plugin('vim-matchup')
  107. -- comments in context
  108. use {'JoosepAlviste/nvim-ts-context-commentstring', opt = true}
  109. require_plugin("nvim-ts-context-commentstring")
  110. -- Zen Mode
  111. use {"Pocco81/TrueZen.nvim", opt = true}
  112. require_plugin("TrueZen.nvim")
  113. -- Git extras
  114. use {'f-person/git-blame.nvim', opt = true}
  115. require_plugin("git-blame.nvim")
  116. -- TODO remove when open on dir is supported by nvimtree
  117. -- use "kevinhwang91/rnvimr"
  118. use {"nvim-telescope/telescope-fzy-native.nvim", opt = true}
  119. use {"nvim-telescope/telescope-project.nvim", opt = true}
  120. require_plugin('telescope-project.nvim')
  121. -- Debugging
  122. use {"mfussenegger/nvim-dap", opt = true}
  123. require_plugin("nvim-dap")
  124. use {"rafamadriz/friendly-snippets", opt = true}
  125. require_plugin("friendly-snippets")
  126. use {"kevinhwang91/nvim-bqf", opt = true}
  127. require_plugin("nvim-bqf")
  128. use {"ahmedkhalf/lsp-rooter.nvim", opt = true} -- with this nvim-tree will follow you
  129. require_plugin('lsp-rooter.nvim')
  130. use {"glepnir/lspsaga.nvim", opt = true}
  131. require_plugin("lspsaga.nvim")
  132. use {"ChristianChiarulli/dashboard-nvim", opt = true}
  133. require_plugin("dashboard-nvim")
  134. use {"folke/trouble.nvim", opt = true}
  135. require_plugin('trouble.nvim')
  136. -- Sane gx for netrw_gx bug
  137. use {"felipec/vim-sanegx", opt = true}
  138. -- Autotag
  139. -- use {"windwp/nvim-ts-autotag", opt = true}
  140. -- require_plugin("nvim-ts-autotag")
  141. -- folke/todo-comments.nvim
  142. -- gennaro-tedesco/nvim-jqx
  143. -- TimUntersberger/neogit
  144. -- folke/lsp-colors.nvim
  145. -- simrat39/symbols-outline.nvim
  146. -- Git
  147. -- use {'tpope/vim-fugitive', opt = true}
  148. -- use {'tpope/vim-rhubarb', opt = true}
  149. -- pwntester/octo.nvim
  150. -- Easily Create Gists
  151. -- use {'mattn/vim-gist', opt = true}
  152. -- use {'mattn/webapi-vim', opt = true}
  153. end
  154. end)