-
Hello all, DescriptionI’m in the process of upgrading my Neovim configuration and replacing as many plugins as possible with the new suite of plugins provided by mini.nvim and What I’m Trying to DoI want to incorporate the following code snippet or something that provides me the same functionality into my -- part of the todo-comments plugin config i previously used.
keymap.set("n", "<leader>ft", "<cmd>TodoTelescope<CR>", { desc = "Find todos" }) However, since I’m not using Current Configuration###Snacks.nvim Config return {
"folke/snacks.nvim",
priority = 1000,
lazy = false,
--- @type snacks.Config
opts = {
-- your plugin configuration goes here
animate = { enabled = true }, -- efficient animation library
bigfile = { -- triggers when file is larger than configured size
enabled = true,
-- your bigfile configuration comes here
notify = true, -- show notification when big file detected
size = 1.5 * 1024 * 1024, -- 1.5MB
-- Enable or disable features when big file detected
--- @param ctx {buf: number, ft:string}
setup = function(ctx)
if vim.fn.exists(":NoMatchParen") ~= 0 then
vim.cmd([[NoMatchParen]])
end
Snacks.util.wo(0, { foldmethod = "manual", statuscolumn = "", conceallevel = 0 })
vim.b.minianimate_disable = true
vim.schedule(function()
vim.bo[ctx.buf].syntax = ctx.ft
end)
end,
},
dashboard = { -- dashboard at startup
enabled = true,
-- your dashboard configuration comes here
preset = {
-- Defaults to a picker that supports `fzf-lua`, `telescope.nvim` and `mini.pick`
pick = 'telescope.nvim', -- nil
},
sections = {
{ section = "header" },
{ section = "keys", gap = 1 },
{ icon = " ", title = "Recent Files", section = "recent_files", indent = 2, padding = { 2, 2 } },
{ icon = " ", title = "Projects", section = "projects", indent = 2, padding = 2 },
{ section = "startup" },
},
},
explorer = { -- file tree explorer
enabled = true,
replace_netrw = true, -- replace netrw with snacks explorer
},
git = { -- git utilities
enabled = true,
-- your git configuration comes here
width = 0.6,
height = 0.6,
border = "rounded",
title = " Git Blame ",
title_pos = "center",
ft = "git",
},
notifier = { -- notifications UI
enabled = true,
-- your notifier configuration goes here
timeout = 3000, -- default timeout in ms
sort = { "level", "added" }, -- sort by level and time
level = vim.log.levels.TRACE,
icons = {
error = " ",
warn = " ",
info = " ",
debug = " ",
trace = " ",
},
--- @type snacks.notifier.style
date_format = "%R", -- time format for notifications
more_format = " ↓ %d lines ",
refresh = 50, -- refresh at most every 50ms
},
-- TODO: start from picker
picker = { -- fuzzy finder
enabled = true,
-- your picker configuration comes here
},
scope = { enabled = true }, -- scope detection based on treesitter
statuscolumn = { enabled = true },
toggle = { -- toggle kepmaps
enabled = true,
-- your toggle configuration comes here
map = vim.keymap.set, -- keymap.set function to use
which_key = true, -- integrate with which-key to show enabled/disabled icons and colors
notify = true, -- show a notification when toggling
-- icons for enabled/disabled states
icon = {
enabled = " ",
disabled = " ",
},
-- colors for enabled/disabled states
color = {
enabled = "green",
disabled = "yellow",
},
},
},
-- optional = true,
keys = {
-- INFO: essential keymaps
{ "<leader>space>", function() Snacks.picker.files() end, desc = "Find Files" },
{ "<leader>,", function() Snacks.picker.buffers() end, desc = "Buffers" },
{ "<leader>/", function() Snacks.picker.grep() end, desc = "Grep" },
{ "<leader>:", function() Snacks.picker.command_history() end, desc = "Command History" },
{ "<leader>e", function() Snacks.picker.explorer() end, desc = "Toggle File Tree Explorer" },
-- find
{ "<leader>ff", function() Snacks.picker.files() end, desc = "Find Files" },
{ "<leader>fb", function() Snacks.picker.buffers() end, desc = "Buffers" },
{ "<leader>fc", function() Snacks.picker.files({ cwd = vim.fn.stdpath("config") }) end, desc = "Find Config File" },
{ "<leader>fg", function() Snacks.picker.git_files() end, desc = "Find Git Files" },
{ "<leader>fr", function() Snacks.picker.recent() end, desc = "Recent" },
-- git
{ "<leader>gc", function() Snacks.picker.git_log() end, desc = "Git Log" },
{ "<leader>gs", function() Snacks.picker.git_status() end, desc = "Git Status" },
-- grep
{ "<leader>sb", function() Snacks.picker.lines() end, desc = "Buffer Lines" },
{ "<leader>sB", function() Snacks.picker.grep_buffers() end, desc = "Grep Open Buffers" },
{ "<leader>sg", function() Snacks.picker.grep() end, desc = "Grep" },
{ "<leader>sw", function() Snacks.picker.grep_word() end, desc = "Visual selection or word", mode = { "n", "x" } },
-- search
{ '<leader>s"', function() Snacks.picker.registers() end, desc = "Registers" },
{ "<leader>sa", function() Snacks.picker.autocmds() end, desc = "Autocmds" },
{ "<leader>sc", function() Snacks.picker.command_history() end, desc = "Command History" },
{ "<leader>sC", function() Snacks.picker.commands() end, desc = "Commands" },
{ "<leader>sd", function() Snacks.picker.diagnostics() end, desc = "Diagnostics" },
{ "<leader>sh", function() Snacks.picker.help() end, desc = "Help Pages" },
{ "<leader>sH", function() Snacks.picker.highlights() end, desc = "Highlights" },
{ "<leader>sj", function() Snacks.picker.jumps() end, desc = "Jumps" },
{ "<leader>sk", function() Snacks.picker.keymaps() end, desc = "Keymaps" },
{ "<leader>sl", function() Snacks.picker.loclist() end, desc = "Location List" },
{ "<leader>sM", function() Snacks.picker.man() end, desc = "Man Pages" },
{ "<leader>sm", function() Snacks.picker.marks() end, desc = "Marks" },
{ "<leader>sR", function() Snacks.picker.resume() end, desc = "Resume" },
{ "<leader>sq", function() Snacks.picker.qflist() end, desc = "Quickfix List" },
{ "<leader>uC", function() Snacks.picker.colorschemes() end, desc = "Colorschemes" },
{ "<leader>qp", function() Snacks.picker.projects() end, desc = "Projects" },
-- LSP
{ "gd", function() Snacks.picker.lsp_definitions() end, desc = "Goto Definition" },
{ "gr", function() Snacks.picker.lsp_references() end, nowait = true, desc = "References" },
{ "gI", function() Snacks.picker.lsp_implementations() end, desc = "Goto Implementation" },
{ "gy", function() Snacks.picker.lsp_type_definitions() end, desc = "Goto T[y]pe Definition" },
{ "<leader>ss", function() Snacks.picker.lsp_symbols() end, desc = "LSP Symbols" },
},
} Mini.nvim Configreturn {
'echasnovski/mini.nvim',
version = '*', -- stable
event = 'VeryLazy',
-- dependencies = {
-- "nvim-tree/nvim-web-devicons",
-- },
config = function()
-- load specific modules only to enable their functionality
-- require('mini.animate').setup({}) -- animated common neovim sections
require('mini.bracketed').setup({ -- navigate using square brackets
buffer = { suffix = 'b', options = {} },
comment = { suffix = 'c', options = {} },
conflict = { suffix = 'x', options = {} },
diagnostic = { suffix = 'd', options = {} },
file = { suffix = 'f', options = {} },
indent = { suffix = 'i', options = {} },
jump = { suffix = 'j', options = {} },
location = { suffix = 'l', options = {} },
oldfile = { suffix = 'o', options = {} },
quickfix = { suffix = 'q', options = {} },
treesitter = { suffix = 't', options = {} },
undo = { suffix = 'u', options = {} },
window = { suffix = 'w', options = {} },
yank = { suffix = 'y', options = {} },
})
require('mini.bufremove').setup({}) -- close buffers while preserving layout
require('mini.clue').setup({ -- show next keypress clues
-- Array of extra clues to show
clues = {},
-- Array of opt-in triggers which start custom key query process.
triggers = {
-- Leader triggers
{ mode = 'n', keys = '<Leader>' },
{ mode = 'x', keys = '<Leader>' },
-- Built-in completion
{ mode = 'i', keys = '<C-x>' },
-- `g` key
{ mode = 'n', keys = 'g' },
{ mode = 'x', keys = 'g' },
-- Marks
{ mode = 'n', keys = "'" },
{ mode = 'n', keys = '`' },
{ mode = 'x', keys = "'" },
{ mode = 'x', keys = '`' },
-- Registers
{ mode = 'n', keys = '"' },
{ mode = 'x', keys = '"' },
{ mode = 'i', keys = '<C-r>' },
{ mode = 'c', keys = '<C-r>' },
-- Window commands
{ mode = 'n', keys = '<C-w>' },
-- `z` key
{ mode = 'n', keys = 'z' },
{ mode = 'x', keys = 'z' },
},
-- Clue window settings
window = {
-- Floating window config
config = {},
-- Delay before showing clue window
delay = 100,
-- Keys to scroll inside the clue window
scroll_down = '<C-d>',
scroll_up = '<C-u>',
},
})
require('mini.comment').setup({}) -- code commenting
require('mini.completion').setup({}) -- autocompeltion and signature help
require('mini.cursorword').setup({}) -- automatic highlighting of word under cursor
require('mini.icons').setup({}) -- icon set
require('mini.indentscope').setup({}) -- animated vertical tab line
require('mini.pairs').setup({}) -- bracket autopairing
require('mini.surround').setup({ -- add, remove, replace delimiters
-- Add custom surroundings to be used on top of builtin ones. For more information with
-- examples, see `:h MiniSurround.config`.
custom_surroundings = nil,
-- Duration (in ms) of highlight when calling `MiniSurround.highlight()`
highlight_duration = 500,
-- Module mappings. Use `''` (empty string) to disable one.
mappings = {
add = 'sa', -- Add surrounding in Normal and Visual modes
delete = 'sd', -- Delete surrounding
find = 'sf', -- Find surrounding (to the right)
find_left = 'sF', -- Find surrounding (to the left)
highlight = 'sh', -- Highlight surrounding
replace = 'sr', -- Replace surrounding
update_n_lines = 'sn', -- Update `n_lines`
suffix_last = 'l', -- Suffix to search with "prev" method
suffix_next = 'n', -- Suffix to search with "next" method
},
-- Number of lines within which surrounding is searched
n_lines = 20,
-- Whether to respect selection type:
-- - Place surroundings on separate lines in linewise mode.
-- - Place surroundings on each line in blockwise mode.
respect_selection_type = false,
-- How to search for surrounding (first inside current line, then inside neighborhood). One
-- of 'cover', 'cover_or_next', 'cover_or_prev', 'cover_or_nearest', 'next', 'prev',
-- 'nearest'. For more details, see `:h MiniSurround.config`.
search_method = 'cover',
-- Whether to disable showing non-error feedback This also affects (purely informational)
-- helper messages shown after idle time if user input is required.
silent = false,
})
require('mini.tabline').setup({ -- tabline showing listed buffers
-- Whether to show file icons (requires 'mini.icons')
show_icons = true,
-- Vim's settings for tabline (make it always shown and allow hidden buffers)
set_vim_settings = true,
-- Where to show tabpage section in case of multiple vim tabpages. Options: left, right, none.
tabpage_section = 'left',
-- Customize the tabline format
format = function(buf_id, label)
-- Get the buffer number
local buf_num = vim.api.nvim_buf_get_number(buf_id)
-- Get the buffer icon from mini.icons
local icon = require('mini.icons').get('file', label)
-- Format the string with icon, buffer number, and label
return string.format(' %s %d %s ', icon, buf_num, label)
end
})
require('mini.trailspace').setup({}) -- trim all trailing whitespaces
end
} Expected BehaviorPressing Additional Context
Any guidance or suggestions appreciated! 🚀 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
That's very easy:
|
Beta Was this translation helpful? Give feedback.
-
It doesn't seem to be working for me. Here is my return {
"folke/todo-comments.nvim",
enabled = true,
dependencies = { "nvim-lua/plenary.nvim" },
event = "VeryLazy",
opts = {
highlight = {
multiline = false,
-- vimgrep regex, supporting the pattern TODO(name):
pattern = [[.*<((KEYWORDS)%(\(.{-1,}\))?):]],
},
search = {
-- ripgrep regex, supporting the pattern TODO(name):
pattern = [[\b(KEYWORDS)(\(\w*\))*:]],
}
},
} Running A blank |
Beta Was this translation helpful? Give feedback.
NOTE: Issue Resolved
Hi folke,
First of all WOW. Thank you for replying to my post. I initially before trying to set the keymap did run the command
:lua Snacks.picker.todo_comments()
but it was returning a NIL value. I setupfolke/todo-comments.nvim
as a dependency but still no progress. Finally i realized that I am not loading the module properly using arequire
function.I was able to fix it like so.