Skip to content

dtomvan/tasks.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

88 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tasks.nvim

@Tsoding's take on in-tree issue reporting/task management.

Inspired by this Tsoding Daily video: https://youtu.be/QH6KOEVnSZA

Note that the MVP (matching Tsoding's functionality) was implemented in the initial commit (41ed9234428c1ce5753d5a2f981d7285babd8554) and this codebase got more and more complex as I went down the rabbit hole.

Features

  • Create tasks from template
  • Create tasks from TODOs in the codebase
  • List (open) tasks
  • Open tasks in a quickfixlist.
  • Jump to mentions of tasks
  • Find backlinks (yes, also between tasks)
  • Telescope integration
  • nvim-cmp integration
  • blink.cmp integration

Usage

Required for backlink search: use a Git repository. Currently it's hardcoded to use git grep to search through all tracked files in the codebase.

There's also an Appimage in the releases with Telescope and blink available for testing out the plugin in a minimal, temporary environment before integrating it into your config. Keep in mind that the actual version of Nvim can and will lag behind the latest upstream version.

When ready to install the plugin in your own config, use one of these methods:

Built-in nvim package management OPTIONAL: install telescope and nvim-cmp (or blink.cmp) for a better experience
-- OPTIONAL: install through vim.pack, Nvim 0.12.x+
vim.pack.add {
    "https://github.com/dtomvan/tasks.nvim",
    "https://github.com/saghen/blink.cmp", -- OPTIONAL: for blink completion
    "https://github.com/nvim-lua/plenary.nvim", -- OPTIONAL: for blink
    "https://github.com/hrsh7th/nvim-cmp", -- OPTIONAL: for nvim-cmp completion
    "https://github.com/nvim-telescope/telescope.nvim", -- OPTIONAL: for fuzzy finding through tasks list
}

require'tasks'.setup { add_commands = true }
vim.keymap.set("n", "<leader>tg", require'tasks'.go_to)
vim.keymap.set("n", "<leader>tn", require'tasks'.create_from_todo)
vim.keymap.set("n", "<leader>tc", require'tasks'.new)
vim.keymap.set("n", "<leader>tl", require'tasks'.list)
vim.keymap.set("n", "<leader>tq", require'tasks'.qf_list)
vim.keymap.set("n", "<leader>tb", require'tasks'.qf_backlinks)

-- OPTIONAL: telescope finder with `:Telescope tasks`
require'telescope'.setup { extensions = { tasks = {} } }
require('telescope').load_extension('tasks')
vim.keymap.set("n", "<leader>to", "<cmd>Telescope tasks<cr>")
vim.keymap.set("n", "<leader>tb", "<cmd>Telescope tasks backlinks<cr>")

-- OPTIONAL: cmp source
require'cmp'.setup { sources = { { name = 'tasks' } } }

-- OPTIONAL: blink.cmp source
require'blink.cmp'.setup {
    sources = {
        default = { 'tasks' },
        providers = {
            tasks = {
                name = 'Tasks',
                module = 'tasks.blink_source',
            }
        }
    }
}
With Lazy.nvim
return {
    {
        "dtomvan/tasks.nvim",
        dependencies = { "nvim-telescope/telescope.nvim" },
        opts = {
            add_commands = true,
        },
        keys = {
            { "<leader>tg", "<cmd>Tasks goto<cr>", desc = "Go to task" },
            { "<leader>tn", "<cmd>Tasks create-from-todo<cr>", desc = "Create task from TODO comment" },
            { "<leader>tc", "<cmd>Tasks new<cr>", desc = "Create task from scratch" },
            { "<leader>tl", "<cmd>Tasks list<cr>", desc = "List open tasks" },
            { "<leader>tq", "<cmd>Tasks qf-list<cr>", desc = "Set quickfix list to open tasks" },
            { "<leader>to", function() require'tasks.telescope'.open_tasks() end, desc = "Telescope open tasks" },
            { "<leader>tb", function() require'tasks.telescope'.backlinks() end, desc = "Telescope backlinks" },
        },
    },
    -- Choose ONE of the following:
    { "hrsh7th/nvim-cmp", opts = { sources = { { name = "tasks" } }, dependencies = { "dtomvan/tasks.nvim" } } },
    {
        "saghen/blink.cmp",
        opts = {
            sources = {
                default = { 'tasks' },
                providers = {
                    tasks = {
                        name = 'Tasks',
                        module = 'tasks.blink_source',
                    }
                }
            }
        },
        dependencies = { "dtomvan/tasks.nvim" },
    },
}
With nixvim Make sure to pass `inputs` via `specialArgs` in your home-manager configuration, or otherwise (e.g. flake-parts) find a way to import the module in your nixvim configuration.

For a full template for standalone nixvim, run:

nix flake init -t github:dtomvan/tasks.nvim
# flake.nix
{
  inputs = {
    inputs.tasks.url = "github:dtomvan/tasks.nvim";
  };
}

# home.nix
{ inputs, ... }:
{
  programs.nixvim = {
    imports = [ inputs.tasks.modules.nixvim.default ];
    plugins.tasks = {
      enable = true;
      withTelescope = true;
      withBlink = true;
      settings = {
        add_commands = true;
      };
    };
  };
}

About

@tsoding's take on in-tree issue reporting/task management.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors