plugins.lua 7.1 KB

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