Skip to content

Commit aea3f3a

Browse files
docs(README): add instructions to live_grep todos (#47)
* Update README.md with instructions to live_grep todos * Update README.md * Update README.md * Update README.md * Apply suggestions from code review Co-authored-by: max397574 <[email protected]> * Update README.md * Update README.md --------- Co-authored-by: max397574 <[email protected]>
1 parent 6382a01 commit aea3f3a

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

README.md

+20
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,26 @@ When you use `Telescope neorg find_aof_project_tasks` you can pick an area of fo
8181
<video alt="find_aof_project_tasks" src="https://user-images.githubusercontent.com/81827001/158401841-9ca3a311-bac1-4733-9a6e-6125003d8a38.mov"></video>
8282
</details>
8383

84+
Until the new GTD infrastructure arrives, you could collect all your todo items with a regex, for example:
85+
86+
```lua
87+
-- Make sure you have ripgrep installed.
88+
-- Add the following function to your `~/.config/nvim/init.lua`:
89+
do
90+
local _, neorg = pcall(require, "neorg.core")
91+
local dirman = neorg.modules.get_module("core.dirman")
92+
local function get_todos(dir, states)
93+
local current_workspace = dirman.get_current_workspace()
94+
local dir = current_workspace[2]
95+
require('telescope.builtin').live_grep{ cwd = dir }
96+
vim.fn.feedkeys('^ *([*]+|[-]+) +[(]' .. states .. '[)]')
97+
end
98+
99+
-- This can be bound to a key
100+
vim.keymap.set('n', '<c-t>', function() get_todos('~/notes', '[^x_]') end)
101+
end
102+
```
103+
84104
# 🔧 Installation
85105
First, make sure to pull this plugin down. This plugin does not run any code in of itself. It requires Neorg
86106
to load it first:

0 commit comments

Comments
 (0)