plugins.lua 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380
  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. -- matchup
  120. use {
  121. 'andymass/vim-matchup',
  122. event = "CursorMoved",
  123. config = function()
  124. require('lv-matchup').config()
  125. end,
  126. disable = not O.plugin.matchup.active
  127. }
  128. use {
  129. "norcalli/nvim-colorizer.lua",
  130. event = "BufRead",
  131. config = function()
  132. require("colorizer").setup()
  133. vim.cmd("ColorizerReloadAllBuffers")
  134. end,
  135. disable = not O.plugin.colorizer.active
  136. }
  137. use {
  138. "nacro90/numb.nvim",
  139. event = "BufRead",
  140. config = function()
  141. require('numb').setup {
  142. show_numbers = true, -- Enable 'number' for the window while peeking
  143. show_cursorline = true -- Enable 'cursorline' for the window while peeking
  144. }
  145. end,
  146. disable = not O.plugin.numb.active
  147. }
  148. -- Treesitter playground
  149. use {
  150. 'nvim-treesitter/playground',
  151. event = "BufRead",
  152. disable = not O.plugin.ts_playground.active
  153. }
  154. use {
  155. "lukas-reineke/indent-blankline.nvim",
  156. branch = "lua",
  157. event = "BufRead",
  158. setup = function()
  159. vim.g.indentLine_enabled = 1
  160. vim.g.indent_blankline_char = "▏"
  161. vim.g.indent_blankline_filetype_exclude = {
  162. "help", "terminal", "dashboard"
  163. }
  164. vim.g.indent_blankline_buftype_exclude = {"terminal"}
  165. vim.g.indent_blankline_show_trailing_blankline_indent = false
  166. vim.g.indent_blankline_show_first_indent_level = true
  167. end,
  168. disable = not O.plugin.indent_line.active
  169. }
  170. -- comments in context
  171. use {
  172. 'JoosepAlviste/nvim-ts-context-commentstring',
  173. event = "BufRead",
  174. disable = not O.plugin.ts_context_commentstring.active
  175. }
  176. -- Symbol Outline
  177. use {
  178. 'simrat39/symbols-outline.nvim',
  179. cmd = 'SymbolsOutline',
  180. disable = not O.plugin.symbol_outline.active
  181. }
  182. -- diagnostics
  183. use {
  184. "folke/trouble.nvim",
  185. cmd = 'TroubleToggle',
  186. disable = not O.plugin.trouble.active
  187. }
  188. -- Debugging
  189. use {
  190. "mfussenegger/nvim-dap",
  191. event = "BufRead",
  192. disable = not O.plugin.debug.active
  193. }
  194. -- Better quickfix
  195. use {
  196. "kevinhwang91/nvim-bqf",
  197. event = "BufRead",
  198. disable = not O.plugin.bqf.active
  199. }
  200. -- Floating terminal
  201. use {
  202. 'numToStr/FTerm.nvim',
  203. event = "BufRead",
  204. config = function()
  205. require'FTerm'.setup({
  206. dimensions = {height = 0.8, width = 0.8, x = 0.5, y = 0.5},
  207. border = 'single' -- or 'double'
  208. })
  209. end,
  210. disable = not O.plugin.floatterm.active
  211. }
  212. -- Search & Replace
  213. use {
  214. 'windwp/nvim-spectre',
  215. event = "BufRead",
  216. config = function()
  217. require('spectre').setup()
  218. end,
  219. disable = not O.plugin.spectre.active
  220. }
  221. -- lsp root with this nvim-tree will follow you
  222. use {
  223. "ahmedkhalf/lsp-rooter.nvim",
  224. event = "BufRead",
  225. config = function()
  226. require("lsp-rooter").setup()
  227. end,
  228. disable = not O.plugin.lsp_rooter.active
  229. }
  230. -- Markdown preview
  231. use {
  232. 'iamcco/markdown-preview.nvim',
  233. run = 'cd app && npm install',
  234. ft = 'markdown',
  235. disable = not O.plugin.markdown_preview.active
  236. }
  237. -- Interactive scratchpad
  238. use {
  239. 'metakirby5/codi.vim',
  240. cmd = 'Codi',
  241. disable = not O.plugin.codi.active
  242. }
  243. -- Use fzy for telescope
  244. use {
  245. "nvim-telescope/telescope-fzy-native.nvim",
  246. event = "BufRead",
  247. disable = not O.plugin.telescope_fzy.active
  248. }
  249. -- Use project for telescope
  250. use {
  251. "nvim-telescope/telescope-project.nvim",
  252. event = "BufRead",
  253. disable = not O.plugin.telescope_project.active
  254. }
  255. -- Sane gx for netrw_gx bug
  256. use {
  257. "felipec/vim-sanegx",
  258. event = "BufRead",
  259. disable = not O.plugin.sanegx.active
  260. }
  261. -- Sane gx for netrw_gx bug
  262. use {
  263. "folke/todo-comments.nvim",
  264. event = "BufRead",
  265. disable = not O.plugin.todo_comments.active
  266. }
  267. -- LSP Colors
  268. use {
  269. "folke/lsp-colors.nvim",
  270. event = "BufRead",
  271. disable = not O.plugin.lsp_colors.active
  272. }
  273. -- Git Blame
  274. use {
  275. "f-person/git-blame.nvim",
  276. event = "BufRead",
  277. disable = not O.plugin.git_blame.active
  278. }
  279. use {
  280. 'ruifm/gitlinker.nvim',
  281. event = "BufRead",
  282. config = function()
  283. require"gitlinker".setup({
  284. opts = {
  285. -- remote = 'github', -- force the use of a specific remote
  286. -- adds current line nr in the url for normal mode
  287. add_current_line_on_normal_mode = true,
  288. -- callback for what to do with the url
  289. action_callback = require"gitlinker.actions".open_in_browser,
  290. -- print the url after performing the action
  291. print_url = false,
  292. -- mapping to call url generation
  293. mappings = "<leader>gy"
  294. }
  295. })
  296. end,
  297. disable = not O.plugin.gitlinker.active,
  298. requires = 'nvim-lua/plenary.nvim'
  299. }
  300. -- Rust tools
  301. -- TODO: use lazy loading maybe?
  302. use {
  303. "simrat39/rust-tools.nvim",
  304. disable = not O.lang.rust.active
  305. }
  306. -- Lazygit
  307. use {
  308. "kdheepak/lazygit.nvim",
  309. cmd = "LazyGit",
  310. disable = not O.plugin.lazygit.active
  311. }
  312. -- Lazygit
  313. use {
  314. "pwntester/octo.nvim",
  315. event = "BufRead",
  316. disable = not O.plugin.octo.active
  317. }
  318. -- Diffview
  319. use {
  320. "sindrets/diffview.nvim",
  321. event = "BufRead",
  322. disable = not O.plugin.diffview.active
  323. }
  324. -- Easily Create Gists
  325. use {
  326. "mattn/vim-gist",
  327. event = "BufRead",
  328. disable = not O.plugin.gist.active,
  329. requires = 'mattn/webapi-vim'
  330. }
  331. -- HTML preview
  332. use {
  333. 'turbio/bracey.vim',
  334. event = "BufRead",
  335. run = 'npm install --prefix server',
  336. disable = not O.plugin.bracey.active
  337. }
  338. -- LANGUAGE SPECIFIC GOES HERE
  339. -- Latex TODO what filetypes should this be active for?
  340. use {
  341. "lervag/vimtex",
  342. ft = "latex",
  343. disable = not O.lang.latex.active
  344. }
  345. end)