plugins.lua 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431
  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 return end
  11. packer.init {
  12. -- compile_path = vim.fn.stdpath('data')..'/site/pack/loader/start/packer.nvim/plugin/packer_compiled.vim',
  13. compile_path = require("packer.util").join_paths(vim.fn.stdpath('config'),
  14. 'plugin',
  15. 'packer_compiled.vim'),
  16. git = {clone_timeout = 300},
  17. display = {
  18. open_fn = function()
  19. return require("packer.util").float {border = "single"}
  20. end
  21. }
  22. }
  23. vim.cmd "autocmd BufWritePost plugins.lua PackerCompile" -- Auto compile when there are changes in plugins.lua
  24. return require("packer").startup(function(use)
  25. -- Packer can manage itself as an optional plugin
  26. use "wbthomason/packer.nvim"
  27. -- TODO refactor all of this (for now it works, but yes I know it could be wrapped in a simpler function)
  28. use {"neovim/nvim-lspconfig"}
  29. use {"glepnir/lspsaga.nvim"}
  30. use {"kabouzeid/nvim-lspinstall"}
  31. -- Telescope
  32. use {"nvim-lua/popup.nvim"}
  33. use {"nvim-lua/plenary.nvim"}
  34. use {"tjdevries/astronauta.nvim"}
  35. use {
  36. "nvim-telescope/telescope.nvim",
  37. config = [[require('lv-telescope')]],
  38. cmd = "Telescope"
  39. }
  40. -- Snap TODO disable for now, need to only install fzy when user specifies they want to use snap
  41. -- use {
  42. -- "camspiers/snap",
  43. -- rocks = "fzy",
  44. -- config = function()
  45. -- require("lv-snap").config()
  46. -- end,
  47. -- disable = not O.plugin.snap.active
  48. -- }
  49. -- Autocomplete
  50. use {
  51. "hrsh7th/nvim-compe",
  52. config = function()
  53. require("lv-compe").config()
  54. end
  55. }
  56. use {"hrsh7th/vim-vsnip", event = "InsertEnter"}
  57. use {"rafamadriz/friendly-snippets", event = "InsertEnter"}
  58. -- Treesitter
  59. use {"nvim-treesitter/nvim-treesitter", run = ":TSUpdate"}
  60. use {
  61. "kyazdani42/nvim-tree.lua",
  62. -- cmd = "NvimTreeToggle",
  63. config = function()
  64. require("lv-nvimtree").config()
  65. end
  66. }
  67. use {
  68. "lewis6991/gitsigns.nvim",
  69. config = function()
  70. require("lv-gitsigns").config()
  71. end,
  72. event = "BufRead"
  73. }
  74. -- whichkey
  75. use {"folke/which-key.nvim"}
  76. -- Autopairs
  77. use {
  78. "windwp/nvim-autopairs",
  79. config = function()
  80. require 'lv-autopairs'
  81. end
  82. }
  83. -- Comments
  84. use {
  85. "terrortylor/nvim-comment",
  86. cmd = "CommentToggle",
  87. config = function()
  88. require('nvim_comment').setup()
  89. end
  90. }
  91. -- Color
  92. use {"christianchiarulli/nvcode-color-schemes.vim", opt = true}
  93. -- Icons
  94. use {"kyazdani42/nvim-web-devicons"}
  95. -- Status Line and Bufferline
  96. use {"glepnir/galaxyline.nvim"}
  97. use {
  98. "romgrk/barbar.nvim",
  99. config = function()
  100. vim.api.nvim_set_keymap('n', '<TAB>', ':BufferNext<CR>',
  101. {noremap = true, silent = true})
  102. vim.api.nvim_set_keymap('n', '<S-TAB>', ':BufferPrevious<CR>',
  103. {noremap = true, silent = true})
  104. vim.api.nvim_set_keymap('n', '<S-x>', ':BufferClose<CR>',
  105. {noremap = true, silent = true})
  106. end,
  107. event = "BufRead"
  108. }
  109. -- Extras, these do not load by default
  110. -- Better motions
  111. use {
  112. 'phaazon/hop.nvim',
  113. event = 'BufRead',
  114. config = function()
  115. require('lv-hop').config()
  116. end,
  117. disable = not O.plugin.hop.active,
  118. opt = true
  119. }
  120. -- Enhanced increment/decrement
  121. use {
  122. 'monaqa/dial.nvim',
  123. event = 'BufRead',
  124. config = function()
  125. require('lv-dial').config()
  126. end,
  127. disable = not O.plugin.dial.active,
  128. opt = true
  129. }
  130. -- Dashboard
  131. use {
  132. "ChristianChiarulli/dashboard-nvim",
  133. event = 'BufWinEnter',
  134. cmd = {"Dashboard", "DashboardNewFile", "DashboardJumpMarks"},
  135. config = function()
  136. require('lv-dashboard').config()
  137. end,
  138. disable = not O.plugin.dashboard.active,
  139. opt = true
  140. }
  141. -- Zen Mode
  142. use {
  143. "folke/zen-mode.nvim",
  144. cmd = "ZenMode",
  145. -- event = "BufRead",
  146. config = function()
  147. require('lv-zen').config()
  148. end,
  149. disable = not O.plugin.zen.active
  150. }
  151. -- Ranger
  152. use {
  153. "kevinhwang91/rnvimr",
  154. cmd = "Rnvimr",
  155. config = function()
  156. require('lv-rnvimr').config()
  157. end,
  158. disable = not O.plugin.ranger.active
  159. }
  160. -- matchup
  161. use {
  162. 'andymass/vim-matchup',
  163. event = "CursorMoved",
  164. config = function()
  165. require('lv-matchup').config()
  166. end,
  167. disable = not O.plugin.matchup.active
  168. }
  169. use {
  170. "norcalli/nvim-colorizer.lua",
  171. event = "BufRead",
  172. config = function()
  173. require("colorizer").setup()
  174. vim.cmd("ColorizerReloadAllBuffers")
  175. end,
  176. disable = not O.plugin.colorizer.active
  177. }
  178. use {
  179. "nacro90/numb.nvim",
  180. event = "BufRead",
  181. config = function()
  182. require('numb').setup {
  183. show_numbers = true, -- Enable 'number' for the window while peeking
  184. show_cursorline = true -- Enable 'cursorline' for the window while peeking
  185. }
  186. end,
  187. disable = not O.plugin.numb.active
  188. }
  189. -- Treesitter playground
  190. use {
  191. 'nvim-treesitter/playground',
  192. event = "BufRead",
  193. disable = not O.plugin.ts_playground.active
  194. }
  195. use {
  196. "lukas-reineke/indent-blankline.nvim",
  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. -- Octo
  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. -- 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"}
  387. -- Rust tools
  388. -- TODO: use lazy loading maybe?
  389. use {"simrat39/rust-tools.nvim", ft = "rust"}
  390. -- Elixir
  391. use {"elixir-editors/vim-elixir", ft = {"elixir", "eelixir", "euphoria3"}}
  392. end)