plugins.lua 11 KB

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