Skip to content

example get todos function not working #76

@cdbzb

Description

@cdbzb

Hi there I get errors on my system running your example function - Claude corrected it in a way that works for me:

do
local _, neorg = pcall(require, "neorg.core")
local dirman = neorg.modules.get_module("core.dirman")
local function get_todos(fallback_dir, states)
local current_workspace = dirman.get_current_workspace()
-- Extract the path string from the workspace info
local workspace_path = current_workspace and current_workspace[2] or fallback_dir

    -- Ensure we have a string path, not a table
    local dir_path = type(workspace_path) == "string" and workspace_path or fallback_dir
    
    require('telescope.builtin').live_grep{ cwd = dir_path }
    vim.fn.feedkeys('^ *([*]+|[-]+) +[(]' .. states .. '[)]')
end
-- This can be bound to a key
vim.keymap.set('n', '<leader>at', function() get_todos('~/notes', '[^x_]') end)

end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions