Skip to content

thedanvail/tasks.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tasks.nvim

A small, dependency-free Neovim task popup with one task list per git repository.

tasks.nvim stores tasks outside your repositories by default, under stdpath("data")/tasks.nvim/tasks.json, keyed by the absolute git root. Opening the popup in one repository will not show tasks from another repository.

Installation

Use any Neovim plugin manager. With lazy.nvim, this spec lazy-loads on the commands or keymap:

return {
  "your-name/tasks.nvim",
  main = "tasks",
  cmd = { "TasksOpen", "TasksToggle", "TasksAdd" },
  keys = {
    {
      "<leader>tt",
      function()
        require("tasks").toggle()
      end,
      desc = "Toggle repo tasks",
    },
  },
  opts = {},
}

For local development:

{
  dir = "<path to tasks.nvim>",
  name = "tasks.nvim",
  main = "tasks",
  cmd = { "TasksOpen", "TasksToggle", "TasksAdd" },
  keys = {
    {
      "<leader>tt",
      function()
        require("tasks").toggle()
      end,
      desc = "Toggle repo tasks",
    },
  },
  opts = {},
}

The plugin's own keymap option is still available, but with lazy.nvim the keys field is preferred because it can lazy-load the plugin.

If you prefer a Harpoon-style config function with direct mappings:

config = function()
  local tasks = require("tasks")

  tasks.setup()

  vim.keymap.set("n", "<leader>tt", tasks.toggle, { desc = "Toggle repo tasks" })
  vim.keymap.set("n", "<leader>to", tasks.open, { desc = "Open repo tasks" })
  vim.keymap.set("n", "<leader>ta", function()
    tasks.add()
  end, { desc = "Add repo task" })
end

Usage

Commands:

  • :TasksOpen
  • :TasksToggle
  • :TasksAdd [task text]

Popup keys:

  • a add a task
  • e edit the task under the cursor
  • x or <Space> cross off or reopen a task
  • d delete the task under the cursor
  • q or <Esc> close the popup

Configuration

require("tasks").setup({
  keymap = nil,
  data_path = vim.fs.joinpath(vim.fn.stdpath("data"), "tasks.nvim", "tasks.json"),
  popup = {
    width = 68,
    height = 16,
    border = "rounded",
    title = "Tasks",
  },
  mappings = {
    close = { "q", "<Esc>" },
    add = "a",
    edit = "e",
    toggle = { "x", "<Space>" },
    delete = "d",
  },
})

The plugin requires Neovim 0.10 or newer.

About

slop-coded simple task list I wanted but couldn't find.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors