plugins.lua 11 KB

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