plugins.lua 12 KB

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