plugins.lua 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  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. -- extras, these do not load by default
  92. -- Better motions
  93. use {
  94. 'phaazon/hop.nvim',
  95. event = 'BufRead',
  96. config = function()
  97. require('lv-hop').config()
  98. end,
  99. disable = not O.plugin.hop.active,
  100. opt = true
  101. }
  102. -- Enhanced increment/decrement
  103. use {
  104. 'monaqa/dial.nvim',
  105. event = 'BufRead',
  106. config = function()
  107. require('lv-dial').config()
  108. end,
  109. disable = not O.plugin.dial.active,
  110. opt = true
  111. }
  112. -- Dashboard
  113. use {
  114. "ChristianChiarulli/dashboard-nvim",
  115. event = 'BufWinEnter',
  116. cmd = {"Dashboard", "DashboardNewFile", "DashboardJumpMarks"},
  117. config = function()
  118. require('lv-dashboard').config()
  119. end,
  120. disable = not O.plugin.dashboard.active,
  121. opt = true
  122. }
  123. -- Zen Mode TODO this don't work with whichkey might gave to make this built in
  124. use {
  125. "Pocco81/TrueZen.nvim",
  126. event = 'BufRead',
  127. -- cmd = {"TZAtaraxis", "TZMinimalist"},
  128. config = function()
  129. require('lv-zen').config()
  130. end,
  131. -- disable = not O.plugin.zen.active,
  132. }
  133. -- matchup
  134. use {'andymass/vim-matchup',
  135. event = "CursorMoved",
  136. config = function()
  137. require('lv-matchup').config()
  138. end,
  139. disable = not O.plugin.matchup.active,
  140. opt = true
  141. }
  142. -- -- Snippets
  143. -- use {"rafamadriz/friendly-snippets", opt = true}
  144. -- -- Colorizer
  145. -- use {'norcalli/nvim-colorizer.lua', opt = true}
  146. -- -- Peek lines
  147. -- use {'nacro90/numb.nvim', opt = true}
  148. --
  149. -- -- Treesitter playground
  150. -- use {'nvim-treesitter/playground', opt = true}
  151. --
  152. --
  153. --
  154. -- -- Latex
  155. -- use {"lervag/vimtex", opt = true}
  156. --
  157. -- -- comments in context
  158. -- use {'JoosepAlviste/nvim-ts-context-commentstring', opt = true}
  159. --
  160. --
  161. -- -- Git extras
  162. -- use {'f-person/git-blame.nvim', opt = true}
  163. --
  164. --
  165. -- -- diagnostics
  166. -- use {"folke/trouble.nvim", opt = true}
  167. --
  168. -- -- Debugging
  169. -- use {"mfussenegger/nvim-dap", opt = true}
  170. --
  171. --
  172. -- -- Better quickfix
  173. -- use {"kevinhwang91/nvim-bqf", opt = true}
  174. --
  175. -- -- Search & Replace
  176. -- use {'windwp/nvim-spectre', opt = true}
  177. --
  178. -- -- Symbol Outline
  179. -- use {'simrat39/symbols-outline.nvim', opt = true}
  180. --
  181. -- -- Interactive scratchpad
  182. -- use {'metakirby5/codi.vim', opt = true}
  183. --
  184. -- -- Markdown preview
  185. -- use {
  186. -- 'iamcco/markdown-preview.nvim',
  187. -- run = 'cd app && npm install',
  188. -- opt = true
  189. -- }
  190. --
  191. -- -- Floating terminal
  192. -- use {'numToStr/FTerm.nvim', opt = true}
  193. --
  194. -- -- Sane gx for netrw_gx bug
  195. -- use {"felipec/vim-sanegx", opt = true}
  196. -- lsp root
  197. -- use {"ahmedkhalf/lsp-rooter.nvim", opt = true} -- with this nvim-tree will follow you
  198. -- Extras
  199. if O.extras then
  200. -- HTML preview
  201. use {
  202. 'turbio/bracey.vim',
  203. run = 'npm install --prefix server',
  204. opt = true
  205. }
  206. require_plugin('bracey.vim')
  207. use {"nvim-telescope/telescope-fzy-native.nvim", opt = true}
  208. use {"nvim-telescope/telescope-project.nvim", opt = true}
  209. require_plugin('telescope-project.nvim')
  210. -- Autotag
  211. -- use {"windwp/nvim-ts-autotag", opt = true}
  212. -- require_plugin("nvim-ts-autotag")
  213. -- folke/todo-comments.nvim
  214. -- gennaro-tedesco/nvim-jqx
  215. -- TimUntersberger/neogit
  216. -- folke/lsp-colors.nvim
  217. -- simrat39/symbols-outline.nvim
  218. -- Git
  219. -- use {'tpope/vim-fugitive', opt = true}
  220. -- use {'tpope/vim-rhubarb', opt = true}
  221. -- pwntester/octo.nvim
  222. -- Easily Create Gists
  223. -- use {'mattn/vim-gist', opt = true}
  224. -- use {'mattn/webapi-vim', opt = true}
  225. end
  226. end)