plugins.lua 6.9 KB

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