plugins.lua 7.4 KB

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