plugins.lua 11 KB

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