From 739fb4af9bba8e6461cf18eb45c33beb26958f72 Mon Sep 17 00:00:00 2001 From: Joost Agterhoek Date: Wed, 11 Jun 2025 14:10:53 +0200 Subject: [PATCH] trying out keymaps including for a more streamlined tasks overview --- lua/keymaps.lua | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/lua/keymaps.lua b/lua/keymaps.lua index a79e667..c462d2c 100644 --- a/lua/keymaps.lua +++ b/lua/keymaps.lua @@ -39,3 +39,37 @@ vim.keymap.set('n', 'm', vim.lsp.buf.code_action, { desc = 'something wit vim.keymap.set('n', 'gs', ':lua require("telescope.builtin").lsp_dynamic_workspace_symbols()', { desc = 'something else with IWE I guess??' }) vim.keymap.set('n', 'sz', ':Telescope lsp_workspace_symbols', { desc = 'SOMETHING [z]' }) + +---- From https://linkarzu.com/posts/neovim/neovim-tasks/#list-pending-tasks +-- Iterate through incomplete tasks in telescope +-- You can confirm in your terminal lamw25wmal with: +-- rg "^\s*-\s\[ \]" test-markdown.md +vim.keymap.set('n', 'tq', function() + require('telescope.builtin').grep_string(require('telescope.themes').get_ivy { + prompt_title = 'Incomplete Tasks', + -- search = "- \\[ \\]", -- Fixed search term for tasks + -- search = "^- \\[ \\]", -- Ensure "- [ ]" is at the beginning of the line + search = '^\\s*- \\[ \\]', -- also match blank spaces at the beginning + search_dirs = { vim.fn.getcwd() }, -- Restrict search to the current working directory + use_regex = true, -- Enable regex for the search term + initial_mode = 'normal', -- Start in normal mode + --layout_config = { + -- preview_width = 0.5, -- Adjust preview width + --}, + additional_args = function() + return { '--no-ignore' } -- Include files ignored by .gitignore + end, + }) +end, { desc = '[P]Search for incomplete tasks' }) + +vim.keymap.set('n', 'qq', function() + require('telescope.builtin').grep_string { + prompt_title = 'Incomplete Tasks', + search = '^\\s*- \\[ \\]', -- also match blank spaces at the beginning + search_dirs = { vim.fn.getcwd() }, -- Restrict search to the current working directory + -- initial_mode = 'normal', -- Start in normal mode + layout_strategy = 'vertical', + -- layout_config = { width = 0.5 }, + use_regex = true, -- Enable regex for the search term + } +end)