---@module 'snacks'
---@module 'lazy'
---@type LazySpec
return { { -- provides quality of life features for neovim
	'folke/snacks.nvim',
	priority = 1000,
	lazy = false,
	---@type snacks.Config
	opts = {
		animate      = { enabled = false }, -- efficient animations including over 45 easing functions (library)
		bigfile      = { enabled = false }, -- deal with big files
		bufdelete    = { enabled = false }, -- delete buffers without disrupting window layout
		dashboard    = { enabled = false }, -- beautiful declarative dashboards
		debug        = { enabled = false }, -- pretty inspect & backtraces for debugging
		dim          = { enabled = false }, -- focus on the active scope by dimming the rest
		explorer     = { enabled = false }, -- a file explorer (picker in disguise)
		git          = { enabled = false }, -- git utilities
		gitbrowse    = { enabled = false }, -- open the current file, branch, commit, or repo in a browser (e.g. github, gitlab, etc.)
		image        = { enabled = true }, -- image viewer using kitty graphics protocol
		indent       = { enabled = false }, -- indent guides and scopes
		input        = { enabled = false }, -- better vim.ui.input
		layout       = { enabled = false }, -- window layouts
		lazygit      = { enabled = false }, -- open lazygit in a float, auto-configure colour scheme and integration with neovim
		notifier     = { enabled = true }, -- pretty vim.notify
		notify       = { enabled = true }, -- utility functions to work with neovim's vim.notify
		picker       = { enabled = false }, -- picker for selecting items
		profiler     = { enabled = false }, -- neovim lua profiler
		quickfile    = { enabled = true }, -- when doing nvim somefile.txt, it will render the file as quickly as possible, before loading your plugins.
		rename       = { enabled = true }, -- LSP-integrated file renaming with support for plugins like and.
		scope        = { enabled = false }, -- scope detection, text objects and jumping based on treesitter or indent
		scratch      = { enabled = false }, -- scratch buffers with a persistent file
		scroll       = { enabled = false }, -- smooth scrolling
		statuscolumn = { enabled = false }, -- pretty status column
		terminal     = { enabled = false }, -- create and toggle floating/split terminals
		toggle       = { enabled = false }, -- toggle keymaps integrated with which-key icons / colours
		util         = { enabled = false }, -- utility functions for Snacks (library)
		win          = { enabled = false }, -- create and manage floating windows or splits
		words        = { enabled = true }, -- auto-show LSP references and quickly navigate between them
		zen          = { enabled = false }, -- zen mode; distraction-free coding
	},
	keys = {
		{ '*',          function() Snacks.words.jump(-vim.v.count1) end,     desc = 'next reference',           nowait = true },
		{ '#',          function() Snacks.words.jump(vim.v.count1) end,      desc = 'prev reference',           nowait = true },
		{ '<c-w>',      function() Snacks.bufdelete() end,                   desc = 'delete buffer',            nowait = true },
		{ '<leader>N',  function() Snacks.notifier.show_history() end,       desc = 'show notification history' },
		{ '<leader>U',  function() Snacks.picker.undo() end,                 desc = 'undo tree' },
		{ '<leader>gB', function() Snacks.git.blame_line() end,              desc = 'git blame line' },
		{ '<leader>gb', function() Snacks.picker.git_branches() end,         desc = 'git branches' },
		{ '<leader>@',  function() Snacks.picker.lsp_symbols() end,          desc = 'workspace symbols' },
		{ '<leader>ld', function() Snacks.picker.lsp_definitions() end,      desc = 'definition' },
		{ '<leader>lr', function() Snacks.picker.lsp_references() end,       desc = 'references' },
		{ '<leader>li', function() Snacks.picker.lsp_implementations() end,  desc = 'implementation' },
		{ '<leader>lt', function() Snacks.picker.lsp_type_definitions() end, desc = 'type definition' },
		{ '<leader>?',  function() Snacks.picker.keymaps() end,              desc = 'keymaps' },
		{ 'gd',         function() Snacks.picker.lsp_definitions() end,      desc = 'definition' },
		{ 'gr',         function() Snacks.picker.lsp_references() end,       desc = 'references' },
	},
	init = function()
		Autocmd("User", {
			pattern = 'VeryLazy',
			callback = function()
				local virt_lines = false;
				Snacks.toggle.new({
					id = "virtual_lines",
					name = "diagnostics virtual lines",
					get = function() return virt_lines end,
					set = function(v)
						virt_lines = v
						vim.diagnostic.config({ virtual_lines = v })
					end,
				}):map('<leader>tl')

				Snacks.toggle.option('wrap', { name = 'word wrap' }):map('<leader>tw')
				Snacks.toggle.option('spell', { name = 'spelling' }):map('<leader>ts')
				Snacks.toggle.inlay_hints():map('<leader>th')
			end,
		})
	end,
	---@param opts snacks.Config
	config = function(_, opts)
		require('snacks').setup(opts)
	end
} }
