From 80ecc4739961c662ad69a58b6bbe3bf8578b2719 Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Mon, 14 Oct 2024 09:09:06 -0400 Subject: [PATCH] add shortcut key to isolate markdown tasks --- lua/custom_telescope.lua | 13 +++++++++++++ lua/mappings.lua | 6 ++++++ lua/plugins/init.lua | 12 ++++++++++++ 3 files changed, 31 insertions(+) create mode 100644 lua/custom_telescope.lua diff --git a/lua/custom_telescope.lua b/lua/custom_telescope.lua new file mode 100644 index 0000000..8d2fd12 --- /dev/null +++ b/lua/custom_telescope.lua @@ -0,0 +1,13 @@ +local telescope = require('telescope.builtin') + +local M = {} + +function M.search_markdown_tasks() + telescope.grep_string({ + prompt_title = "Markdown Tasks", + search = "- [ ]", -- Customize if needed for specific task markers + cwd = vim.fn.expand('%:p:h') -- Current file's directory + }) +end + +return M diff --git a/lua/mappings.lua b/lua/mappings.lua index 783b78f..ddfc780 100644 --- a/lua/mappings.lua +++ b/lua/mappings.lua @@ -8,3 +8,9 @@ map("n", ";", ":", { desc = "CMD enter command mode" }) map("i", "jk", "") -- map({ "n", "i", "v" }, "", " w ") + +local custom_telescope = require('custom_telescope') + +-- Add a keybinding for searching Markdown tasks +vim.api.nvim_set_keymap('n', 'mt', ':lua require("custom_telescope").search_markdown_tasks()', { noremap = true, silent = true }) + diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 6474776..7032272 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -13,6 +13,18 @@ return { end, }, + { + 'nvim-telescope/telescope.nvim', + requires = { {'nvim-lua/plenary.nvim'} }, + config = function() + require('telescope').setup { + defaults = { + -- Your default configuration for Telescope (optional) + } + } + end + }, + -- { -- "nvim-treesitter/nvim-treesitter", -- opts = {