plugins.lua 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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 " .. install_path)
  6. execute "packadd packer.nvim"
  7. end
  8. --- Check if a file or directory exists in this path
  9. local function require_plugin(plugin)
  10. local plugin_prefix = fn.stdpath("data") .. "/site/pack/packer/opt/"
  11. local plugin_path = plugin_prefix .. plugin .. "/"
  12. -- print('test '..plugin_path)
  13. local ok, err, code = os.rename(plugin_path, plugin_path)
  14. if not ok then
  15. if code == 13 then
  16. -- Permission denied, but it exists
  17. return true
  18. end
  19. end
  20. -- print(ok, err, code)
  21. if ok then vim.cmd("packadd " .. plugin) end
  22. return ok, err, code
  23. end
  24. vim.cmd "autocmd BufWritePost plugins.lua PackerCompile" -- Auto compile when there are changes in plugins.lua
  25. return require("packer").startup(function(use)
  26. -- Packer can manage itself as an optional plugin
  27. use "wbthomason/packer.nvim"
  28. -- TODO refactor all of this (for now it works, but yes I know it could be wrapped in a simpler function)
  29. use {"neovim/nvim-lspconfig", config = require_plugin("nvim-lspconfig"), opt = true}
  30. use {"kabouzeid/nvim-lspinstall", config = require_plugin("nvim-lspinstall"), opt = true}
  31. -- Telescope
  32. use {"nvim-lua/popup.nvim", config = require_plugin("popup.nvim"), opt = true}
  33. use {"nvim-lua/plenary.nvim", config = require_plugin("plenary.nvim"), opt = true}
  34. use {"nvim-telescope/telescope.nvim", config = require_plugin("telescope.nvim"), opt = true}
  35. -- Autocomplete
  36. use {"hrsh7th/nvim-compe", config = require_plugin("nvim-compe"), event = "InsertEnter", opt = true}
  37. -- Treesitter
  38. use {
  39. "nvim-treesitter/nvim-treesitter",
  40. config = require_plugin("nvim-treesitter"),
  41. event = "BufRead"
  42. -- run = ":TSUpdate"
  43. }
  44. -- Explorer
  45. -- use {"kyazdani42/nvim-tree.lua", opt = true}
  46. use {"kyazdani42/nvim-tree.lua", opt = true, cmd = "NvimTreeToggle", config = require_plugin("nvim-tree.lua")}
  47. -- use {'lukas-reineke/indent-blankline.nvim', opt=true, branch = 'lua'}
  48. use {"lewis6991/gitsigns.nvim", config = require_plugin("gitsigns.nvim"), event = "BufRead", opt = true}
  49. use {"folke/which-key.nvim", config = require_plugin("which-key.nvim"), opt = true}
  50. use {"windwp/nvim-autopairs", config = require_plugin("nvim-autopairs"), event = "InsertEnter", opt = true}
  51. -- Comments
  52. use {"terrortylor/nvim-comment", config = require_plugin("nvim-comment"), opt = true}
  53. -- Color
  54. use {"christianchiarulli/nvcode-color-schemes.vim", config = require_plugin("nvcode-color-schemes.vim"), opt = true}
  55. -- Icons
  56. use {"kyazdani42/nvim-web-devicons", config = require_plugin("nvim-web-devicons"), opt = true}
  57. -- Status Line and Bufferline
  58. use {"glepnir/galaxyline.nvim", config = require_plugin("galaxyline.nvim"), opt = true}
  59. use {"romgrk/barbar.nvim", config = require_plugin("barbar.nvim"), opt = true}
  60. use {"hrsh7th/vim-vsnip", config = require_plugin("vim-vsnip"), opt = true}
  61. -- Extras
  62. if O.extras then
  63. -- Interactive scratchpad
  64. use {'metakirby5/codi.vim', opt = true}
  65. require_plugin('codi.vim')
  66. -- Markdown preview
  67. use {'iamcco/markdown-preview.nvim', run = 'cd app && npm install', opt = true}
  68. require_plugin('markdown-preview.nvim')
  69. -- Floating terminal
  70. use {'numToStr/FTerm.nvim', opt = true}
  71. require_plugin('FTerm.nvim')
  72. -- Enhanced increment/decrement
  73. use {'monaqa/dial.nvim', opt = true}
  74. require_plugin('dial.nvim')
  75. -- Peek lines
  76. use {'nacro90/numb.nvim', opt = true}
  77. require_plugin('numb.nvim')
  78. -- HTML preview
  79. use {'turbio/bracey.vim', run = 'npm install --prefix server', opt = true}
  80. require_plugin('bracey.vim')
  81. -- Better motions
  82. use {'phaazon/hop.nvim', opt = true}
  83. require_plugin('hop.nvim')
  84. -- Colorizer
  85. use {'norcalli/nvim-colorizer.lua', opt = true}
  86. require_plugin('nvim-colorizer.lua')
  87. -- Search & Replace
  88. use {'windwp/nvim-spectre', opt = true}
  89. require_plugin('nvim-spectre')
  90. use {'simrat39/symbols-outline.nvim', opt = true}
  91. require_plugin('symbols-outline.nvim')
  92. -- Treesitter playground
  93. use {'nvim-treesitter/playground', opt = true}
  94. require_plugin('playground')
  95. -- Latex
  96. use {"lervag/vimtex", opt = true}
  97. require_plugin("vimtex")
  98. -- matchup
  99. use {'andymass/vim-matchup', opt = true}
  100. require_plugin('vim-matchup')
  101. -- comments in context
  102. use {'JoosepAlviste/nvim-ts-context-commentstring', opt = true}
  103. require_plugin("nvim-ts-context-commentstring")
  104. -- Zen Mode
  105. use {"Pocco81/TrueZen.nvim", opt = true}
  106. require_plugin("TrueZen.nvim")
  107. -- Git extras
  108. use {'f-person/git-blame.nvim', opt = true}
  109. require_plugin("git-blame.nvim")
  110. -- TODO remove when open on dir is supported by nvimtree
  111. -- use "kevinhwang91/rnvimr"
  112. use {"nvim-telescope/telescope-fzy-native.nvim", opt = true}
  113. use {"nvim-telescope/telescope-project.nvim", opt = true}
  114. require_plugin('telescope-project.nvim')
  115. -- Debugging
  116. use {"mfussenegger/nvim-dap", opt = true}
  117. require_plugin("nvim-dap")
  118. use {"rafamadriz/friendly-snippets", opt = true}
  119. require_plugin("friendly-snippets")
  120. use {"kevinhwang91/nvim-bqf", opt = true}
  121. require_plugin("nvim-bqf")
  122. use {"ahmedkhalf/lsp-rooter.nvim", opt = true} -- with this nvim-tree will follow you
  123. require_plugin('lsp-rooter.nvim')
  124. use {"glepnir/lspsaga.nvim", opt = true}
  125. require_plugin("lspsaga.nvim")
  126. use {"ChristianChiarulli/dashboard-nvim", opt = true}
  127. require_plugin("dashboard-nvim")
  128. use {"folke/trouble.nvim", opt = true}
  129. require_plugin('trouble.nvim')
  130. -- Sane gx for netrw_gx bug
  131. use {"felipec/vim-sanegx", opt = true}
  132. -- Autotag
  133. -- use {"windwp/nvim-ts-autotag", opt = true}
  134. -- require_plugin("nvim-ts-autotag")
  135. -- folke/todo-comments.nvim
  136. -- gennaro-tedesco/nvim-jqx
  137. -- TimUntersberger/neogit
  138. -- folke/lsp-colors.nvim
  139. -- simrat39/symbols-outline.nvim
  140. -- Git
  141. -- use {'tpope/vim-fugitive', opt = true}
  142. -- use {'tpope/vim-rhubarb', opt = true}
  143. -- pwntester/octo.nvim
  144. -- Easily Create Gists
  145. -- use {'mattn/vim-gist', opt = true}
  146. -- use {'mattn/webapi-vim', opt = true}
  147. end
  148. end)