/neorg-telescope

Telescope.nvim integration for Neorg

Primary LanguageLuaGNU General Public License v3.0GPL-3.0

Neorg Integration with Telescope

This repo hosts a 3rd party module for Neorg to integrate with telescope's juicy features.

Features

Fuzzy Searching Any Linkable

Simply jump to any important element in the workspace. This includes headings, drawers, markers. The command for this is Telescope neorg find_linkable

find_linkable

Automatic Link Insertion

Simply press a key (<C-l> in insert mode by default) and select what you want to link to.

insert_link only works for elements in the current workspace.

insert_link

Automatic File Link Insertion

You can use Telescope neorg insert_file_link to insert a link to a neorg file. Notice that this only works for files in the current workspace. Note: If no file is selected a link to a file with the name of the prompt value will be inserted. This file will be created if you use the link with neorg's hop

insert_file_link

Fuzzy Searching Headings

With Telescope neorg search_headings you can search through all the headings in the current file. search_headings

Gtd Pickers

Find Project Tasks

Use Telescope neorg find_project_tasks to pick a project and then the tasks inside it. You can then jump to those tasks. If you select and empty project (colored gray) then you'll jump to the project. find_project_tasks

Find Context Tasks

With Telescope neorg find_context_tasks you pick a context and then tasks. find_context_tasks

Find AOF Tasks

You can use Telescope neorg find_aof_tasks to pick an aof and then search through the tasks of it. find_aof_tasks

Find AOF Project Tasks

When you use Telescope neorg find_aof_project_tasks you can pick an area of focus, then a project inside it and last but not least you can search for tasks inside the project. find_aof_project_tasks

Installation

First, make sure to pull this plugin down. This plugin does not run any code in of itself. It requires Neorg to load it first:

With Packer.nvim:

use {
    "nvim-neorg/neorg",
    config = function()
        require('neorg').setup {

            -- Select the modules we want to load
            load = {
                ["core.defaults"] = {}, -- Load all the defaults
                ...
                ["core.integrations.telescope"] = {}, -- Enable the telescope module
            },

        }
    end,
    requires = "nvim-neorg/neorg-telescope" -- Be sure to pull in the repo
}

If you're using the automatic keybind generation provided by Neorg you can start using <C-s> (search linkable elements) in normal mode and <C-l> (insert link) in insert mode. If you're not using the automatic keybind generation, be sure to make Neorg use those keys:

local neorg_callbacks = require("neorg.callbacks")

neorg_callbacks.on_event("core.keybinds.events.enable_keybinds", function(_, keybinds)
    -- Map all the below keybinds only when the "norg" mode is active
    keybinds.map_event_to_mode("norg", {
        n = { -- Bind keys in normal mode
            { "<C-s>", "core.integrations.telescope.find_linkable" },
        },

        i = { -- Bind in insert mode
            { "<C-l>", "core.integrations.telescope.insert_link" },
        },
    }, {
        silent = true,
        noremap = true,
    })
end)

Support Welcome

If it's not clear by the code already, I'm a solid noob at telescope related things :)

If you have any awesome ideas or any code you want to contribute then go ahead! Any sort of help is appreciated ❤️

Some Ideas Right Off The Top Of My Head

  • Fuzzy searching content in paragraphs only
  • Fuzzy searching content in the current heading

GIFs

Insert Link

insert_link_gif