plugins.lua 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  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 {
  31. "neovim/nvim-lspconfig",
  32. -- event = "BufRead",
  33. -- opt = true
  34. }
  35. use {
  36. "glepnir/lspsaga.nvim",
  37. -- event = "BufRead",
  38. -- opt = true
  39. }
  40. use {"kabouzeid/nvim-lspinstall",
  41. -- opt = true
  42. }
  43. -- Telescope
  44. use {"nvim-lua/popup.nvim",
  45. -- opt = true
  46. }
  47. use {"nvim-lua/plenary.nvim",
  48. -- opt = true
  49. }
  50. use {
  51. "nvim-telescope/telescope.nvim",
  52. -- cmd = "Telescope",
  53. -- opt = true
  54. }
  55. -- Autocomplete
  56. use {
  57. "hrsh7th/nvim-compe",
  58. config = function()
  59. -- require_plugin("nvim-compe")
  60. require("lv-compe").config()
  61. end,
  62. -- event = "InsertEnter",
  63. -- opt = true
  64. }
  65. -- Treesitter
  66. use {
  67. "nvim-treesitter/nvim-treesitter",
  68. -- event = "BufRead",
  69. run = ":TSUpdate"
  70. }
  71. -- Explorer
  72. -- use {"kyazdani42/nvim-tree.lua", opt = true}
  73. use {
  74. "kyazdani42/nvim-tree.lua",
  75. -- cmd = "NvimTreeToggle",
  76. config = function()
  77. -- require_plugin("lv-nvimtree")
  78. require("lv-nvimtree").config()
  79. end,
  80. -- opt = true
  81. }
  82. -- use {'lukas-reineke/indent-blankline.nvim', opt=true, branch = 'lua'}
  83. use {"lewis6991/gitsigns.nvim",
  84. -- event = "BufRead",
  85. -- opt = true
  86. }
  87. use {"folke/which-key.nvim",
  88. -- opt = true
  89. }
  90. use {"windwp/nvim-autopairs",
  91. config = function()
  92. -- require_plugin("lv-nvimtree")
  93. require("lv-autopairs").config()
  94. end,
  95. -- event = "InsertEnter",
  96. -- opt = true
  97. }
  98. -- Comments
  99. use {
  100. "terrortylor/nvim-comment",
  101. cmd = "CommentToggle",
  102. config = function()
  103. require('nvim_comment').setup()
  104. end,
  105. -- opt = true
  106. }
  107. -- Color
  108. use {"christianchiarulli/nvcode-color-schemes.vim", opt = true}
  109. -- Icons
  110. use {"kyazdani42/nvim-web-devicons",
  111. -- opt = true
  112. }
  113. -- Status Line and Bufferline
  114. use {"glepnir/galaxyline.nvim",
  115. -- opt = true
  116. }
  117. use {"romgrk/barbar.nvim",
  118. config = function()
  119. -- require_plugin("barbar.nvim")
  120. vim.api.nvim_set_keymap('n', '<TAB>', ':BufferNext<CR>', { noremap = true, silent = true })
  121. vim.api.nvim_set_keymap('n', '<S-TAB>', ':BufferPrevious<CR>', { noremap = true, silent = true })
  122. vim.api.nvim_set_keymap('n', '<S-x>', ':BufferClose<CR>', { noremap = true, silent = true })
  123. end,
  124. -- opt = true
  125. }
  126. use {"hrsh7th/vim-vsnip",
  127. -- opt = true
  128. }
  129. -- require_plugin("nvim-lspconfig")
  130. -- require_plugin("lspsaga.nvim")
  131. -- require_plugin("nvim-lspinstall")
  132. -- require_plugin("popup.nvim")
  133. -- require_plugin("plenary.nvim")
  134. -- require_plugin("telescope.nvim")
  135. -- require_plugin("nvim-treesitter")
  136. -- require_plugin("nvim-comment")
  137. -- require_plugin("nvim-tree.lua")
  138. -- require_plugin("gitsigns.nvim")
  139. -- require_plugin("which-key.nvim")
  140. -- require_plugin("nvim-autopairs")
  141. -- require_plugin("nvim-web-devicons")
  142. -- require_plugin("galaxyline.nvim")
  143. -- require_plugin("vim-vsnip")
  144. -- Extras
  145. if O.extras then
  146. -- Interactive scratchpad
  147. use {'metakirby5/codi.vim', opt = true}
  148. require_plugin('codi.vim')
  149. -- Markdown preview
  150. use {
  151. 'iamcco/markdown-preview.nvim',
  152. run = 'cd app && npm install',
  153. opt = true
  154. }
  155. require_plugin('markdown-preview.nvim')
  156. -- Floating terminal
  157. use {'numToStr/FTerm.nvim', opt = true}
  158. require_plugin('FTerm.nvim')
  159. -- Enhanced increment/decrement
  160. use {'monaqa/dial.nvim', opt = true}
  161. require_plugin('dial.nvim')
  162. -- Peek lines
  163. use {'nacro90/numb.nvim', opt = true}
  164. require_plugin('numb.nvim')
  165. -- HTML preview
  166. use {
  167. 'turbio/bracey.vim',
  168. run = 'npm install --prefix server',
  169. opt = true
  170. }
  171. require_plugin('bracey.vim')
  172. -- Better motions
  173. use {'phaazon/hop.nvim', opt = true}
  174. require_plugin('hop.nvim')
  175. -- Colorizer
  176. use {'norcalli/nvim-colorizer.lua', opt = true}
  177. require_plugin('nvim-colorizer.lua')
  178. -- Search & Replace
  179. use {'windwp/nvim-spectre', opt = true}
  180. require_plugin('nvim-spectre')
  181. use {'simrat39/symbols-outline.nvim', opt = true}
  182. require_plugin('symbols-outline.nvim')
  183. -- Treesitter playground
  184. use {'nvim-treesitter/playground', opt = true}
  185. require_plugin('playground')
  186. -- Latex
  187. use {"lervag/vimtex", opt = true}
  188. require_plugin("vimtex")
  189. -- matchup
  190. use {'andymass/vim-matchup', opt = true}
  191. require_plugin('vim-matchup')
  192. -- comments in context
  193. use {'JoosepAlviste/nvim-ts-context-commentstring', opt = true}
  194. require_plugin("nvim-ts-context-commentstring")
  195. -- Zen Mode
  196. use {"Pocco81/TrueZen.nvim", opt = true}
  197. require_plugin("TrueZen.nvim")
  198. -- Git extras
  199. use {'f-person/git-blame.nvim', opt = true}
  200. require_plugin("git-blame.nvim")
  201. -- TODO remove when open on dir is supported by nvimtree
  202. -- use "kevinhwang91/rnvimr"
  203. use {"nvim-telescope/telescope-fzy-native.nvim", opt = true}
  204. use {"nvim-telescope/telescope-project.nvim", opt = true}
  205. require_plugin('telescope-project.nvim')
  206. -- Debugging
  207. use {"mfussenegger/nvim-dap", opt = true}
  208. require_plugin("nvim-dap")
  209. use {"rafamadriz/friendly-snippets", opt = true}
  210. require_plugin("friendly-snippets")
  211. use {"kevinhwang91/nvim-bqf", opt = true}
  212. require_plugin("nvim-bqf")
  213. use {"ahmedkhalf/lsp-rooter.nvim", opt = true} -- with this nvim-tree will follow you
  214. require_plugin('lsp-rooter.nvim')
  215. use {"ChristianChiarulli/dashboard-nvim", opt = true}
  216. require_plugin("dashboard-nvim")
  217. use {"folke/trouble.nvim", opt = true}
  218. require_plugin('trouble.nvim')
  219. -- Sane gx for netrw_gx bug
  220. use {"felipec/vim-sanegx", opt = true}
  221. -- Autotag
  222. -- use {"windwp/nvim-ts-autotag", opt = true}
  223. -- require_plugin("nvim-ts-autotag")
  224. -- folke/todo-comments.nvim
  225. -- gennaro-tedesco/nvim-jqx
  226. -- TimUntersberger/neogit
  227. -- folke/lsp-colors.nvim
  228. -- simrat39/symbols-outline.nvim
  229. -- Git
  230. -- use {'tpope/vim-fugitive', opt = true}
  231. -- use {'tpope/vim-rhubarb', opt = true}
  232. -- pwntester/octo.nvim
  233. -- Easily Create Gists
  234. -- use {'mattn/vim-gist', opt = true}
  235. -- use {'mattn/webapi-vim', opt = true}
  236. end
  237. end)