lazy.lua 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. -- [[ Install `lazy.nvim` plugin manager ]]
  2. -- https://github.com/folke/lazy.nvim
  3. -- `:help lazy.nvim.txt` for more info
  4. local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
  5. if not vim.loop.fs_stat(lazypath) then
  6. vim.fn.system {
  7. 'git',
  8. 'clone',
  9. '--filter=blob:none',
  10. 'https://github.com/folke/lazy.nvim.git',
  11. '--branch=stable', -- latest stable release
  12. lazypath,
  13. }
  14. end
  15. vim.opt.rtp:prepend(lazypath)
  16. -- [[ Configure plugins ]]
  17. -- NOTE: Here is where you install your plugins.
  18. -- You can configure plugins using the `config` key.
  19. --
  20. -- You can also configure plugins after the setup call,
  21. -- as they will be available in your neovim runtime.
  22. require('lazy').setup({
  23. -- NOTE: First, some plugins that don't require any configuration
  24. -- Git related plugins
  25. 'tpope/vim-fugitive',
  26. 'tpope/vim-rhubarb',
  27. -- Detect tabstop and shiftwidth automatically
  28. 'tpope/vim-sleuth',
  29. -- Autoformat on save
  30. 'jose-elias-alvarez/null-ls.nvim',
  31. {
  32. 'kdheepak/lazygit.nvim',
  33. -- optional for floating window border decoration
  34. dependencies = {
  35. 'nvim-lua/plenary.nvim',
  36. },
  37. },
  38. -- When life gets too hard
  39. 'eandrju/cellular-automaton.nvim',
  40. 'leafOfTree/vim-svelte-plugin',
  41. -- NOTE: This is where your plugins related to LSP can be installed.
  42. -- The configuration is done below. Search for lspconfig to find it below.
  43. {
  44. -- LSP Configuration & Plugins
  45. 'neovim/nvim-lspconfig',
  46. config = require('kickstart.plugins.autoformat').config,
  47. dependencies = {
  48. -- Automatically install LSPs to stdpath for neovim
  49. { 'williamboman/mason.nvim', config = true },
  50. 'williamboman/mason-lspconfig.nvim',
  51. -- Useful status updates for LSP
  52. -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
  53. { 'j-hui/fidget.nvim', opts = {} },
  54. -- Additional lua configuration, makes nvim stuff amazing!
  55. 'folke/neodev.nvim',
  56. },
  57. },
  58. {
  59. -- Autocompletion
  60. 'hrsh7th/nvim-cmp',
  61. dependencies = {
  62. -- Snippet Engine & its associated nvim-cmp source
  63. {
  64. 'L3MON4D3/LuaSnip',
  65. build = (function()
  66. -- Build Step is needed for regex support in snippets
  67. -- This step is not supported in many windows environments
  68. -- Remove the below condition to re-enable on windows
  69. if vim.fn.has 'win32' == 1 then
  70. return
  71. end
  72. return 'make install_jsregexp'
  73. end)(),
  74. },
  75. 'saadparwaiz1/cmp_luasnip',
  76. -- Adds LSP completion capabilities
  77. 'hrsh7th/cmp-nvim-lsp',
  78. 'hrsh7th/cmp-path',
  79. -- Adds a number of user-friendly snippets
  80. -- 'rafamadriz/friendly-snippets',
  81. },
  82. },
  83. -- Useful plugin to show you pending keybinds.
  84. { 'folke/which-key.nvim', opts = {} },
  85. {
  86. -- Adds git related signs to the gutter, as well as utilities for managing changes
  87. 'lewis6991/gitsigns.nvim',
  88. opts = {
  89. -- See `:help gitsigns.txt`
  90. signs = {
  91. add = { text = '+' },
  92. change = { text = '~' },
  93. delete = { text = '_' },
  94. topdelete = { text = '‾' },
  95. changedelete = { text = '~' },
  96. },
  97. on_attach = function(bufnr)
  98. local gs = package.loaded.gitsigns
  99. local function map(mode, l, r, opts)
  100. opts = opts or {}
  101. opts.buffer = bufnr
  102. vim.keymap.set(mode, l, r, opts)
  103. end
  104. -- Navigation
  105. map({ 'n', 'v' }, ']c', function()
  106. if vim.wo.diff then
  107. return ']c'
  108. end
  109. vim.schedule(function()
  110. gs.next_hunk()
  111. end)
  112. return '<Ignore>'
  113. end, { expr = true, desc = 'Jump to next hunk' })
  114. map({ 'n', 'v' }, '[c', function()
  115. if vim.wo.diff then
  116. return '[c'
  117. end
  118. vim.schedule(function()
  119. gs.prev_hunk()
  120. end)
  121. return '<Ignore>'
  122. end, { expr = true, desc = 'Jump to previous hunk' })
  123. -- Actions
  124. -- visual mode
  125. map('v', '<leader>hs', function()
  126. gs.stage_hunk { vim.fn.line '.', vim.fn.line 'v' }
  127. end, { desc = 'stage git hunk' })
  128. map('v', '<leader>hr', function()
  129. gs.reset_hunk { vim.fn.line '.', vim.fn.line 'v' }
  130. end, { desc = 'reset git hunk' })
  131. -- normal mode
  132. map('n', '<leader>hs', gs.stage_hunk, { desc = 'git stage hunk' })
  133. map('n', '<leader>hr', gs.reset_hunk, { desc = 'git reset hunk' })
  134. map('n', '<leader>hS', gs.stage_buffer, { desc = 'git Stage buffer' })
  135. map('n', '<leader>hu', gs.undo_stage_hunk, { desc = 'undo stage hunk' })
  136. map('n', '<leader>hR', gs.reset_buffer, { desc = 'git Reset buffer' })
  137. map('n', '<leader>hp', gs.preview_hunk, { desc = 'preview git hunk' })
  138. map('n', '<leader>hb', function()
  139. gs.blame_line { full = false }
  140. end, { desc = 'git blame line' })
  141. map('n', '<leader>hd', gs.diffthis, { desc = 'git diff against index' })
  142. map('n', '<leader>hD', function()
  143. gs.diffthis '~'
  144. end, { desc = 'git diff against last commit' })
  145. -- Toggles
  146. map('n', '<leader>tb', gs.toggle_current_line_blame, { desc = 'toggle git blame line' })
  147. map('n', '<leader>td', gs.toggle_deleted, { desc = 'toggle git show deleted' })
  148. -- Text object
  149. map({ 'o', 'x' }, 'ih', ':<C-U>Gitsigns select_hunk<CR>', { desc = 'select git hunk' })
  150. end,
  151. },
  152. },
  153. {
  154. 'folke/tokyonight.nvim',
  155. lazy = false,
  156. priority = 1000,
  157. config = function()
  158. require('tokyonight').setup {
  159. style = 'night',
  160. }
  161. end,
  162. },
  163. {
  164. -- Theme inspired by Atom
  165. 'navarasu/onedark.nvim',
  166. lazy = false,
  167. priority = 0,
  168. config = function()
  169. require('onedark').setup {
  170. -- Set a style preset. 'dark' is default.
  171. style = 'dark', -- dark, darker, cool, deep, warm, warmer, light
  172. }
  173. require('onedark').load()
  174. end,
  175. },
  176. {
  177. -- Set lualine as statusline
  178. 'nvim-lualine/lualine.nvim',
  179. -- See `:help lualine.txt`
  180. opts = {
  181. options = {
  182. icons_enabled = true,
  183. theme = 'tokyonight',
  184. component_separators = '|',
  185. section_separators = '',
  186. },
  187. },
  188. },
  189. {
  190. -- Add indentation guides even on blank lines
  191. 'lukas-reineke/indent-blankline.nvim',
  192. -- Enable `lukas-reineke/indent-blankline.nvim`
  193. -- See `:help ibl`
  194. main = 'ibl',
  195. opts = {
  196. indent = {
  197. char = '▏',
  198. },
  199. },
  200. },
  201. -- "gc" to comment visual regions/lines
  202. { 'numToStr/Comment.nvim', opts = {} },
  203. -- Fuzzy Finder (files, lsp, etc)
  204. {
  205. 'nvim-telescope/telescope.nvim',
  206. branch = '0.1.x',
  207. dependencies = {
  208. 'nvim-lua/plenary.nvim',
  209. -- Fuzzy Finder Algorithm which requires local dependencies to be built.
  210. -- Only load if `make` is available. Make sure you have the system
  211. -- requirements installed.
  212. {
  213. 'nvim-telescope/telescope-fzf-native.nvim',
  214. -- NOTE: If you are having trouble with this installation,
  215. -- refer to the README for telescope-fzf-native for more instructions.
  216. build = 'make',
  217. cond = function()
  218. return vim.fn.executable 'make' == 1
  219. end,
  220. },
  221. },
  222. },
  223. 'nvim-neotest/nvim-nio',
  224. {
  225. 'danymat/neogen',
  226. config = true,
  227. -- Uncomment next line if you want to follow only stable versions
  228. -- version = "*"
  229. },
  230. {
  231. -- Highlight, edit, and navigate code
  232. 'nvim-treesitter/nvim-treesitter',
  233. dependencies = {
  234. 'nvim-treesitter/nvim-treesitter-textobjects',
  235. },
  236. build = ':TSUpdate',
  237. },
  238. -- {
  239. -- 'rust-lang/rust.vim',
  240. -- ft = 'rust',
  241. -- init = function()
  242. -- vim.g.rustfmt_autosave = 1
  243. -- end,
  244. -- },
  245. -- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart
  246. -- These are some example plugins that I've included in the kickstart repository.
  247. -- Uncomment any of the lines below to enable them.
  248. -- require 'kickstart.plugins.autoformat',
  249. require 'kickstart.plugins.debug',
  250. -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
  251. -- You can use this folder to prevent any conflicts with this init.lua if you're interested in keeping
  252. -- up-to-date with whatever is in the kickstart repo.
  253. -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
  254. --
  255. -- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins
  256. -- { import = 'custom.plugins' },
  257. }, {})