freitass / todo.txt-vim

Vim plugin for Todo.txt
486 stars 121 forks source link

Invalid buffer id - Adding and editing #81

Open rhysmaiden opened 4 months ago

rhysmaiden commented 4 months ago

Lazy config:

return {
  'MunifTanjim/nui.nvim',
  {
    'arnarg/todotxt.nvim',
    dependencies = {'MunifTanjim/nui.nvim'},
    config = function()
      local todo = require("todotxt-nvim")
      todo.setup({
        todo_file = "~/Documents/todo.txt",
        sidebar = {
          width = 40,
          position = "right", -- default: "right"
        },
        capture = {
          prompt = "> ",
          -- Percentage is percentage of width of the whole editor
          -- Integer is number of columns
          width = "50%",
          position = "50%",
          -- Styled after https://swiftodoapp.com/todotxt-syntax/priority/
          -- With this, if you include any of the below keywords it will
          -- automatically use the associated priority and remove that
          -- keyword from the final task.
          alternative_priority = {
            A = "now",
            B = "next",
            C = "today",
            D = "this week",
            E = "next week",
          },
        },
        -- Highlights used in both capture prompt and tasks sidebar
        -- Each highlight type can be a table with 'fg', 'bg' and 'style'
        -- options or a string referencing an existing highlight group.
        -- highlights = {
        --   project = "Identifier",
        -- }
        highlights = {
          project = {
            fg = "magenta",
            bg = "NONE",
            style = "NONE",
          },
          context = {
            fg = "cyan",
            bg = "NONE",
            style = "NONE",
          },
          date = {
            fg = "NONE",
            bg = "NONE",
            style = "underline",
          },
          done_task = {
            fg = "gray",
            bg = "NONE",
            style = "NONE",
          },
          priorities = {
            A = {
              fg = "red",
              bg = "NONE",
              style = "bold",
            },
            B = {
              fg = "magenta",
              bg = "NONE",
              style = "bold",
            },
            C = {
              fg = "yellow",
              bg = "NONE",
              style = "bold",
            },
            D = {
              fg = "cyan",
              bg = "NONE",
              style = "bold",
            },
          },
        },
        -- Keymap used in sidebar split
        keymap = {
          quit = "q",
          toggle_metadata = "m",
          delete_task = "dd",
          complete_task = "n",
          edit_task = "cc",
        },
      })
      vim.keymap.set("n", "<leader>t", ":ToDoTxtTasksToggle<CR>")
      vim.keymap.set("n", "<leader>a", ":ToDoTxtCapture<CR>")
    end,

  },
}

Error message:

E5108: Error executing lua ...n/.local/share/nvim/lazy/nui.nvim/lua/nui/popup/init.lua:214: Invalid buffer id: 13
stack traceback:
        [C]: in function 'create'
        ...n/.local/share/nvim/lazy/nui.nvim/lua/nui/popup/init.lua:214: in function 'mount'
        ...n/.local/share/nvim/lazy/nui.nvim/lua/nui/input/init.lua:80: in function 'mount'
        ...l/share/nvim/lazy/todotxt.nvim/lua/todotxt-nvim/init.lua:211: in function 'capture'
        [string ":lua"]:1: in main chunk

Reproducable steps:

  1. :ToDoTxtCapture
  2. Type in task and hit enter
  3. :ToDoTxtCapture