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', '<Space>m', vim.lsp.buf.code_action, { desc = 'something wit vim.keymap.set('n', '<Space>gs', ':lua require("telescope.builtin").lsp_dynamic_workspace_symbols()<CR>', { desc = 'something else with IWE I guess??' }) vim.keymap.set('n', '<Space>sz', ':Telescope lsp_workspace_symbols<CR>', { 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', '<Space>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', '<Space>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)