plugins.lua 8.2 KB

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