plugins.lua 10 KB

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