| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180 |
- return {
- "folke/snacks.nvim",
- dependencies = {
- "nvim-lua/plenary.nvim",
- },
- priority = 1000,
- init = function()
- local group = vim.api.nvim_create_augroup("BlinkCmpSnacksToggle", { clear = true })
- vim.api.nvim_create_autocmd("User", {
- group = group,
- pattern = "BlinkCmpMenuOpen",
- callback = function()
- vim.g.snacks_animate = false
- end,
- })
- vim.api.nvim_create_autocmd("User", {
- group = group,
- pattern = "BlinkCmpMenuClose",
- callback = function()
- vim.g.snacks_animate = true
- end,
- })
- end,
- config = function()
- local snacks = require("snacks")
- snacks.setup({
- bigfile = { enabled = true },
- input = {
- enabled = true,
- prompt_pos = "left",
- icon_pos = "left",
- expand = false,
- win = {
- row = 0.4,
- position = "float",
- border = "rounded",
- },
- },
- select = {
- enabled = true,
- win = { border = "rounded" },
- },
- debug = { enabled = true },
- indent = { enabled = true, animate = { enabled = false } },
- rename = { enabled = true },
- notifier = { enabled = true },
- scroll = {
- enabled = true,
- animate = {
- duration = { step = 5, total = 50 },
- easing = "linear",
- },
- },
- dashboard = {
- preset = {
- keys = function()
- return {
- { icon = "⏻", key = "q", desc = "Quit", action = "<cmd>qa<CR>" },
- { icon = "", key = "e", desc = "New Buffer", action = "<cmd>ene<CR>" },
- }
- end,
- header = table.concat({
- [[ █ █ ]],
- [[ █ ██ ]],
- [[ ████ ]],
- [[ ██ ███ ]],
- [[ █ █ ]],
- [[ ]],
- [[ n e o v i m ]],
- }, "\n"),
- },
- sections = {
- {
- section = "header",
- },
- { title = "MRU ", file = vim.fn.fnamemodify(".", ":~"), padding = 1 },
- { section = "recent_files", cwd = true, limit = 10, padding = 1 },
- { title = "GMRU", padding = 1 },
- { section = "recent_files", limit = 5, padding = 1 },
- { title = "Sessions", padding = 1 },
- { section = "projects", padding = 1 },
- { section = "keys", gap = 0, padding = 1 },
- },
- },
- })
- -- Show notifier history
- nmap("<leader>ns", snacks.notifier.show_history, { desc = "Show notifier history" })
- -- -----------------
- -- LSP
- -- -----------------
- nmap("gd", function()
- snacks.picker.lsp_definitions()
- end, { desc = "Goto Definition" })
- nmap("gr", function()
- snacks.picker.lsp_references({ include_current = false })
- end, { desc = "Goto References" })
- nmap("gi", function()
- snacks.picker.lsp_implementations()
- end, { desc = "Goto Implementation" })
- nmap("<leader>D", function()
- snacks.picker.lsp_type_definitions()
- end, { desc = "Type Definition" })
- nmap("<leader>ca", function()
- vim.lsp.buf.code_action()
- end, { desc = "Code Action" })
- nmap("<leader>ds", function()
- snacks.picker.lsp_symbols()
- end, { desc = "Document Symbols" })
- nmap("<leader>ic", function()
- snacks.picker.lsp_incoming_calls()
- end, { desc = "Incoming Calls" })
- nmap("<leader>oc", function()
- snacks.picker.lsp_outgoing_calls()
- end, { desc = "Outgoing Calls" })
- -- -----------------
- -- Grep / Search
- -- -----------------
- nmap("<leader>gf", function()
- snacks.picker.grep()
- end, { desc = "Find Live Grep" })
- nmap("sb", function()
- snacks.picker.lines()
- end, { desc = "Search Current Buffer" })
- nmap("gw", function()
- snacks.picker.grep_word()
- end, { desc = "Search word under cursor" })
- nmap("gW", function()
- snacks.picker.grep_word({ word = vim.fn.expand("<cWORD>") })
- end, { desc = "Search WORD under cursor" })
- -- -----------------
- -- Files
- -- -----------------
- nmap("<leader>/", function()
- snacks.picker.files({
- hidden = true,
- ignored = true,
- exclude = {
- "node_modules",
- ".git",
- "dist",
- "build",
- "coverage",
- "public",
- },
- })
- end, { desc = "Find Files" })
- -- -----------------
- -- Buffers / Help / Keymaps
- -- -----------------
- nmap(";", function()
- snacks.picker.buffers()
- end, { desc = "Find Buffers" })
- nmap("sk", function()
- snacks.picker.keymaps()
- end, { desc = "Search Keymaps" })
- nmap("sh", function()
- snacks.picker.help()
- end, { desc = "Search Help" })
- end,
- }
|