plugins.lua 12 KB

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