plugins.lua 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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
  22. vim.cmd("packadd " .. plugin)
  23. end
  24. return ok, err, code
  25. end
  26. vim.cmd "autocmd BufWritePost plugins.lua PackerCompile" -- Auto compile when there are changes in plugins.lua
  27. return require("packer").startup(
  28. function(use)
  29. -- Packer can manage itself as an optional plugin
  30. use "wbthomason/packer.nvim"
  31. -- TODO refactor all of this (for now it works, but yes I know it could be wrapped in a simpler function)
  32. use {"neovim/nvim-lspconfig", opt = true}
  33. use {"glepnir/lspsaga.nvim", opt = true}
  34. use {"kabouzeid/nvim-lspinstall", opt = true}
  35. -- Telescope
  36. use {"nvim-lua/popup.nvim", opt = true}
  37. use {"nvim-lua/plenary.nvim", opt = true}
  38. use {"nvim-telescope/telescope.nvim", opt = true}
  39. -- Debugging
  40. use {"mfussenegger/nvim-dap", opt = true}
  41. -- Autocomplete
  42. use {"hrsh7th/nvim-compe", opt = true}
  43. use {"hrsh7th/vim-vsnip", opt = true}
  44. use {"rafamadriz/friendly-snippets", opt = true}
  45. -- Treesitter
  46. use {"nvim-treesitter/nvim-treesitter", run = ":TSUpdate"}
  47. use {"windwp/nvim-ts-autotag", opt = true}
  48. -- Explorer
  49. use "kyazdani42/nvim-tree.lua"
  50. -- TODO remove when open on dir is supported by nvimtree
  51. use "kevinhwang91/rnvimr"
  52. -- use {'lukas-reineke/indent-blankline.nvim', opt=true, branch = 'lua'}
  53. use {"lewis6991/gitsigns.nvim", opt = true}
  54. -- use {"liuchengxu/vim-which-key", opt = true}
  55. use {"folke/which-key.nvim", opt = true}
  56. use {"ChristianChiarulli/dashboard-nvim", opt = true}
  57. use {"windwp/nvim-autopairs", opt = true}
  58. use {"terrortylor/nvim-comment", opt = true}
  59. use {"kevinhwang91/nvim-bqf", opt = true}
  60. -- Color
  61. use {"christianchiarulli/nvcode-color-schemes.vim", opt = true}
  62. -- Icons
  63. use {"kyazdani42/nvim-web-devicons", opt = true}
  64. -- Status Line and Bufferline
  65. use {"glepnir/galaxyline.nvim", opt = true}
  66. use {"romgrk/barbar.nvim", opt = true}
  67. require_plugin("nvim-lspconfig")
  68. require_plugin("lspsaga.nvim")
  69. require_plugin("nvim-lspinstall")
  70. require_plugin("friendly-snippets")
  71. require_plugin("popup.nvim")
  72. require_plugin("plenary.nvim")
  73. require_plugin("telescope.nvim")
  74. require_plugin("nvim-dap")
  75. require_plugin("nvim-compe")
  76. require_plugin("vim-vsnip")
  77. require_plugin("nvim-treesitter")
  78. require_plugin("nvim-ts-autotag")
  79. require_plugin("nvim-tree.lua")
  80. require_plugin("gitsigns.nvim")
  81. require_plugin("which-key.nvim")
  82. require_plugin("dashboard-nvim")
  83. require_plugin("nvim-autopairs")
  84. require_plugin("nvim-comment")
  85. require_plugin("nvim-bqf")
  86. require_plugin("nvcode-color-schemes.vim")
  87. require_plugin("nvim-web-devicons")
  88. require_plugin("galaxyline.nvim")
  89. require_plugin("barbar.nvim")
  90. end
  91. )