plugins.lua 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399
  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. vim.cmd "autocmd BufWritePost plugins.lua PackerCompile" -- Auto compile when there are changes in plugins.lua
  10. return require("packer").startup(function(use)
  11. -- Packer can manage itself as an optional plugin
  12. use "wbthomason/packer.nvim"
  13. -- TODO refactor all of this (for now it works, but yes I know it could be wrapped in a simpler function)
  14. use {"neovim/nvim-lspconfig"}
  15. use {"glepnir/lspsaga.nvim", event = "BufRead"}
  16. use {"kabouzeid/nvim-lspinstall", event = "BufRead"}
  17. -- Telescope
  18. use {"nvim-lua/popup.nvim"}
  19. use {"nvim-lua/plenary.nvim"}
  20. use {
  21. "nvim-telescope/telescope.nvim",
  22. config = [[require('lv-telescope')]],
  23. cmd = "Telescope"
  24. }
  25. -- Autocomplete
  26. use {
  27. "hrsh7th/nvim-compe",
  28. event = "InsertEnter",
  29. config = function()
  30. require("lv-compe").config()
  31. end
  32. }
  33. use {"hrsh7th/vim-vsnip", event = "InsertEnter"}
  34. use {"rafamadriz/friendly-snippets", event = "InsertEnter"}
  35. -- Treesitter
  36. use {"nvim-treesitter/nvim-treesitter", run = ":TSUpdate"}
  37. use {
  38. "kyazdani42/nvim-tree.lua",
  39. -- cmd = "NvimTreeToggle",
  40. config = function()
  41. require("lv-nvimtree").config()
  42. end
  43. }
  44. use {
  45. "lewis6991/gitsigns.nvim",
  46. config = function()
  47. require("lv-gitsigns").config()
  48. end,
  49. event = "BufRead"
  50. }
  51. -- whichkey
  52. use {"folke/which-key.nvim"}
  53. -- Autopairs
  54. use {"windwp/nvim-autopairs"}
  55. -- Comments
  56. use {
  57. "terrortylor/nvim-comment",
  58. cmd = "CommentToggle",
  59. config = function()
  60. require('nvim_comment').setup()
  61. end
  62. }
  63. -- Color
  64. use {"christianchiarulli/nvcode-color-schemes.vim", opt = true}
  65. -- Icons
  66. use {"kyazdani42/nvim-web-devicons"}
  67. -- Status Line and Bufferline
  68. use {"glepnir/galaxyline.nvim"}
  69. use {
  70. "romgrk/barbar.nvim",
  71. config = function()
  72. vim.api.nvim_set_keymap('n', '<TAB>', ':BufferNext<CR>',
  73. {noremap = true, silent = true})
  74. vim.api.nvim_set_keymap('n', '<S-TAB>', ':BufferPrevious<CR>',
  75. {noremap = true, silent = true})
  76. vim.api.nvim_set_keymap('n', '<S-x>', ':BufferClose<CR>',
  77. {noremap = true, silent = true})
  78. end,
  79. event = "BufRead"
  80. }
  81. -- Extras, these do not load by default
  82. -- Better motions
  83. use {
  84. 'phaazon/hop.nvim',
  85. event = 'BufRead',
  86. config = function()
  87. require('lv-hop').config()
  88. end,
  89. disable = not O.plugin.hop.active,
  90. opt = true
  91. }
  92. -- Enhanced increment/decrement
  93. use {
  94. 'monaqa/dial.nvim',
  95. event = 'BufRead',
  96. config = function()
  97. require('lv-dial').config()
  98. end,
  99. disable = not O.plugin.dial.active,
  100. opt = true
  101. }
  102. -- Dashboard
  103. use {
  104. "ChristianChiarulli/dashboard-nvim",
  105. event = 'BufWinEnter',
  106. cmd = {"Dashboard", "DashboardNewFile", "DashboardJumpMarks"},
  107. config = function()
  108. require('lv-dashboard').config()
  109. end,
  110. disable = not O.plugin.dashboard.active,
  111. opt = true
  112. }
  113. -- Zen Mode
  114. use {
  115. "folke/zen-mode.nvim",
  116. cmd = "ZenMode",
  117. -- event = "BufRead",
  118. config = function()
  119. require('lv-zen').config()
  120. end,
  121. disable = not O.plugin.zen.active
  122. }
  123. -- Ranger
  124. use {
  125. "kevinhwang91/rnvimr",
  126. cmd = "Rnvimr",
  127. config = function()
  128. require('lv-rnvimr').config()
  129. end,
  130. disable = not O.plugin.ranger.active
  131. }
  132. -- matchup
  133. use {
  134. 'andymass/vim-matchup',
  135. event = "CursorMoved",
  136. config = function()
  137. require('lv-matchup').config()
  138. end,
  139. disable = not O.plugin.matchup.active
  140. }
  141. use {
  142. "norcalli/nvim-colorizer.lua",
  143. event = "BufRead",
  144. config = function()
  145. require("colorizer").setup()
  146. vim.cmd("ColorizerReloadAllBuffers")
  147. end,
  148. disable = not O.plugin.colorizer.active
  149. }
  150. use {
  151. "nacro90/numb.nvim",
  152. event = "BufRead",
  153. config = function()
  154. require('numb').setup {
  155. show_numbers = true, -- Enable 'number' for the window while peeking
  156. show_cursorline = true -- Enable 'cursorline' for the window while peeking
  157. }
  158. end,
  159. disable = not O.plugin.numb.active
  160. }
  161. -- Treesitter playground
  162. use {
  163. 'nvim-treesitter/playground',
  164. event = "BufRead",
  165. disable = not O.plugin.ts_playground.active
  166. }
  167. use {
  168. "lukas-reineke/indent-blankline.nvim",
  169. branch = "lua",
  170. event = "BufRead",
  171. setup = function()
  172. vim.g.indentLine_enabled = 1
  173. vim.g.indent_blankline_char = "▏"
  174. vim.g.indent_blankline_filetype_exclude =
  175. {"help", "terminal", "dashboard"}
  176. vim.g.indent_blankline_buftype_exclude = {"terminal"}
  177. vim.g.indent_blankline_show_trailing_blankline_indent = false
  178. vim.g.indent_blankline_show_first_indent_level = true
  179. end,
  180. disable = not O.plugin.indent_line.active
  181. }
  182. -- comments in context
  183. use {
  184. 'JoosepAlviste/nvim-ts-context-commentstring',
  185. event = "BufRead",
  186. disable = not O.plugin.ts_context_commentstring.active
  187. }
  188. -- Symbol Outline
  189. use {
  190. 'simrat39/symbols-outline.nvim',
  191. cmd = 'SymbolsOutline',
  192. disable = not O.plugin.symbol_outline.active
  193. }
  194. -- diagnostics
  195. use {
  196. "folke/trouble.nvim",
  197. cmd = 'TroubleToggle',
  198. disable = not O.plugin.trouble.active
  199. }
  200. -- Debugging
  201. use {
  202. "mfussenegger/nvim-dap",
  203. event = "BufRead",
  204. disable = not O.plugin.debug.active
  205. }
  206. -- Better quickfix
  207. use {
  208. "kevinhwang91/nvim-bqf",
  209. event = "BufRead",
  210. disable = not O.plugin.bqf.active
  211. }
  212. -- Floating terminal
  213. use {
  214. 'numToStr/FTerm.nvim',
  215. event = "BufRead",
  216. config = function()
  217. require'FTerm'.setup({
  218. dimensions = {height = 0.8, width = 0.8, x = 0.5, y = 0.5},
  219. border = 'single' -- or 'double'
  220. })
  221. end,
  222. disable = not O.plugin.floatterm.active
  223. }
  224. -- Search & Replace
  225. use {
  226. 'windwp/nvim-spectre',
  227. event = "BufRead",
  228. config = function()
  229. require('spectre').setup()
  230. end,
  231. disable = not O.plugin.spectre.active
  232. }
  233. -- lsp root with this nvim-tree will follow you
  234. use {
  235. "ahmedkhalf/lsp-rooter.nvim",
  236. event = "BufRead",
  237. config = function()
  238. require("lsp-rooter").setup()
  239. end,
  240. disable = not O.plugin.lsp_rooter.active
  241. }
  242. -- Markdown preview
  243. use {
  244. 'iamcco/markdown-preview.nvim',
  245. run = 'cd app && npm install',
  246. ft = 'markdown',
  247. disable = not O.plugin.markdown_preview.active
  248. }
  249. -- Interactive scratchpad
  250. use {
  251. 'metakirby5/codi.vim',
  252. cmd = 'Codi',
  253. disable = not O.plugin.codi.active
  254. }
  255. -- Use fzy for telescope
  256. use {
  257. "nvim-telescope/telescope-fzy-native.nvim",
  258. event = "BufRead",
  259. disable = not O.plugin.telescope_fzy.active
  260. }
  261. -- Use project for telescope
  262. use {
  263. "nvim-telescope/telescope-project.nvim",
  264. event = "BufRead",
  265. after = "telescope.nvim",
  266. disable = not O.plugin.telescope_project.active
  267. }
  268. -- Sane gx for netrw_gx bug
  269. use {
  270. "felipec/vim-sanegx",
  271. event = "BufRead",
  272. disable = not O.plugin.sanegx.active
  273. }
  274. -- Sane gx for netrw_gx bug
  275. use {
  276. "folke/todo-comments.nvim",
  277. event = "BufRead",
  278. disable = not O.plugin.todo_comments.active
  279. }
  280. -- LSP Colors
  281. use {
  282. "folke/lsp-colors.nvim",
  283. event = "BufRead",
  284. disable = not O.plugin.lsp_colors.active
  285. }
  286. -- Git Blame
  287. use {
  288. "f-person/git-blame.nvim",
  289. event = "BufRead",
  290. disable = not O.plugin.git_blame.active
  291. }
  292. use {
  293. 'ruifm/gitlinker.nvim',
  294. event = "BufRead",
  295. config = function()
  296. require"gitlinker".setup({
  297. opts = {
  298. -- remote = 'github', -- force the use of a specific remote
  299. -- adds current line nr in the url for normal mode
  300. add_current_line_on_normal_mode = true,
  301. -- callback for what to do with the url
  302. action_callback = require"gitlinker.actions".open_in_browser,
  303. -- print the url after performing the action
  304. print_url = false,
  305. -- mapping to call url generation
  306. mappings = "<leader>gy"
  307. }
  308. })
  309. end,
  310. disable = not O.plugin.gitlinker.active,
  311. requires = 'nvim-lua/plenary.nvim'
  312. }
  313. -- Lazygit
  314. use {
  315. "kdheepak/lazygit.nvim",
  316. cmd = "LazyGit",
  317. disable = not O.plugin.lazygit.active
  318. }
  319. -- Lazygit
  320. use {
  321. "pwntester/octo.nvim",
  322. event = "BufRead",
  323. disable = not O.plugin.octo.active
  324. }
  325. -- Diffview
  326. use {
  327. "sindrets/diffview.nvim",
  328. event = "BufRead",
  329. disable = not O.plugin.diffview.active
  330. }
  331. -- Easily Create Gists
  332. use {
  333. "mattn/vim-gist",
  334. event = "BufRead",
  335. disable = not O.plugin.gist.active,
  336. requires = 'mattn/webapi-vim'
  337. }
  338. -- Lush Create Color Schemes
  339. use {
  340. "rktjmp/lush.nvim",
  341. cmd = {"LushRunQuickstart", "LushRunTutorial", "Lushify"},
  342. disable = not O.plugin.lush.active,
  343. }
  344. -- HTML preview
  345. use {
  346. 'turbio/bracey.vim',
  347. event = "BufRead",
  348. run = 'npm install --prefix server',
  349. disable = not O.plugin.bracey.active
  350. }
  351. -- LANGUAGE SPECIFIC GOES HERE
  352. -- Latex TODO what filetypes should this be active for?
  353. use {"lervag/vimtex", ft = "latex", disable = not O.lang.latex.active}
  354. -- Rust tools
  355. -- TODO: use lazy loading maybe?
  356. use {"simrat39/rust-tools.nvim", disable = not O.lang.rust.active}
  357. -- Elixir
  358. use {"elixir-editors/vim-elixir",
  359. ft = {"elixir", "eelixir"},
  360. disable = not O.lang.elixir.active
  361. }
  362. end)