plugins.lua 11 KB

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