plugins.lua 8.3 KB

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