Skip to content

A tiny task manager within nvim that helps you stay on track. (づ◡﹏◡)づ

Notifications You must be signed in to change notification settings

nocksock/do.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Do.nvim

A tiny task manager within nvim that helps you stay on track.

Preview

Introduction

Introduction Gif

Rationale

While coding, we often need to do several things that depend on another. And it's quite easy to loose track of what we initially set out to do in the first place, which is also know as Yak Shaving. Or we just have a list of tasks that we want to work off step by step.

This plugin provides a few simple commands to help you stay on track.

It manages a list of things and always shows you the first item. It provides you with some commands to add things to it, without leaving context. And it uses a simple, intuitive floating buffer to manage that list.

Usage

  • :Do add a line to the end of the list.
  • :Do! add a line to the front of list.
  • :Done! remove the first line from the list.
  • :DoEdit edit the list in a floating window.
  • :DoSave create .do_tasks file in cwd. Will auto-sync afterwards.
  • :DoToggle toggle the display. Use with caution!

Installation

Requires Neovim 0.8.

-- use the package manager of your choice, eg. packer
use("https://github.com/nocksock/do.nvim")

-- setup wherever you do that in you config (eg init.lua)
require("do").setup({
  -- default options
  message_timeout = 2000, -- how long notifications are shown
  kaomoji_mode = 0, -- 0 kaomoji everywhere, 1 skip kaomoji in doing
  winbar = false,
  doing_prefix = "Doing: ",
  store = {
    auto_create_file = false, -- automatically create a .do_tasks when calling :Do
    file_name = ".do_tasks",
  }
})

Winbar

This plugin felt best to me using the winbar - which is a new feature in neovim 0.8. In order to use it, enable it:

require('do').setup({
  winbar = true
})

Lualine

In case you'd rather use it in the statusline or tabbar, you can use the exposed views to do so. For example with lualine:

require('lualine').setup {
  winbar = {
    lualine_a = {
      function()
        return require('do').view('active')
      end,
    },
  },
  inactive_winbar = {
    -- in order to prevent jumping of code in certain cursor positions this will
    -- (at the moment) show an empty line - but only if .view has contents.
    lualine_a = { require("do").view_inactive },
  },
}

Events

This plugin exposes a custom event, for when a task is added or modified. You can use it like so:

vim.api.nvim_create_autocmd({ "User" }, {
   group = require("do.state").state.auGroupID,
   pattern = "TaskModified",
   desc = "This is called when a task is added or deleted",
   callback = function()
      vim.notify("A task has been modified")
   end,
})

Development

Run tests

Running tests requires plenary.nvim to be checked out in the parent directory of this repository. You can then run:

nvim --headless --noplugin -u tests/minimal.vim -c "PlenaryBustedDirectory tests/ {minimal_init = 'tests/minimal.vim'}"

Or if you want to run a single test file:

nvim --headless --noplugin -u tests/minimal.vim -c "PlenaryBustedDirectory tests/path_to_file.lua {minimal_init = 'tests/minimal.vim'}"