nvim-telekasten / telekasten.nvim

A Neovim (lua) plugin for working with a markdown zettelkasten / wiki and mixing it with a journal, based on telescope.nvim
MIT License
1.37k stars 86 forks source link

attempt to index field 'ui' (a nil value) when creating a new note. #4

Closed ghost closed 2 years ago

ghost commented 2 years ago

Hi,

First off, awesome project! Pretty stocked to get this working right now. I have almost lua experience other than my nvim config so struggling to debug this. Hopefully this will help you reproduce it?

I'm using neovim 0.5.1 on archlinux. I have wiped out my existing neovim config and have only the following in my init.lua right now.

return require('packer').startup(function()
  -- Packer can manage itself
  use 'wbthomason/packer.nvim'
  use {
    'nvim-telescope/telescope.nvim',
    requires = { {'nvim-lua/plenary.nvim'} }
 }
use 'renerocksai/telekasten.nvim'
use 'renerocksai/calendar-vim'
end)

I ran :PackerUp to install the plugins then restarted neovim. I think all other commands I tested work great.

Calling :lua require("telekasten").new_note() gives the following error though.

E5108: Error executing lua ...ite/pack/packer/start/telekasten.nvim/lua/telekasten.lua:463: attempt to index field 'ui' (a nil value)

Output from debug = true

Setup() setting `dailies_create_nonexisting`   ->   `true`
Setup() setting `dailies`   ->   `/home/gregf/zettelkasten/daily`
Setup() setting `template_new_daily`   ->   `/home/gregf/zettelkasten/templates/daily.md`
Setup() setting `template_new_note`   ->   `/home/gregf/zettelkasten/templates/new_note.md`
Setup() setting `follow_creates_nonexisting`   ->   `true`
Setup() setting `templates`   ->   `/home/gregf/zettelkasten/templates`
Setup() setting `weeklies_create_nonexisting`   ->   `true`
Setup() setting `extension`   ->   `.md`
Setup() setting `image_subdir`   ->   `img`
Setup() setting `template_new_weekly`   ->   `/home/gregf/zettelkasten/templates/weekly.md`
Setup() setting `home`   ->   `/home/gregf/zettelkasten`
Setup() setting `debug`   ->   `true`
Setup() setting `image_link_style`   ->   `markdown`
Setup() setting `plug_into_calendar`   ->   `true`
Setup() setting `weeklies`   ->   `/home/gregf/zettelkasten/weekly`
Resulting config:
-----------------
{
  calendar_opts = {
    calendar_mark = "left-fit",
    calendar_monday = 1,
    weeknm = 4
  },
  dailies = "/home/gregf/zettelkasten/daily",
  dailies_create_nonexisting = true,
  debug = true,
  extension = ".md",
  find_command = { "rg", "--files", "--sortr", "created" },
  follow_creates_nonexisting = true,
  home = "/home/gregf/zettelkasten",
  image_link_style = "markdown",
  image_subdir = "img",
  plug_into_calendar = true,
  template_new_daily = "/home/gregf/zettelkasten/templates/daily.md",
  template_new_note = "/home/gregf/zettelkasten/templates/new_note.md",
  template_new_weekly = "/home/gregf/zettelkasten/templates/weekly.md",
  templates = "/home/gregf/zettelkasten/templates",
  weeklies = "/home/gregf/zettelkasten/weekly",
  weeklies_create_nonexisting = true
}

Thanks!

EDIT I was able to reproduce this on a clean vm running void linux as well. Same version of neovim.

lokesh-krishna commented 2 years ago

I have the same issue except it's input instead of ui for me, as reported in #2

renerocksai commented 2 years ago

Hi, this is a strange issue. I am beginning to suspect I am using a lua api that is too recent (I am on 0.6.0-dev...).

I just pushed a change that uses a the vim function directly. That should do the trick. Me pushing automatically closed the issue. Please feel free to re-open if you still encounter problems. Fingers crossed, though!

renerocksai commented 2 years ago

First off, awesome project! Pretty stocked to get this working right now. I have almost lua experience other than my nvim config so struggling to debug this. Hopefully this will help you reproduce it?

Glad you like it BTW :smile:

renerocksai commented 2 years ago

Sorry, one more thing. If creating notes via new_note() does not work, you can always create a link to the [[new note]], and 'follow' that link - which will create the note since by default follow_create_nonexisting is true.

ghost commented 2 years ago

Thank you! This fixed my issue, :)

lokesh-krishna commented 2 years ago

Yaaay! Can confirm that this fixed my issue too!

lokesh-krishna commented 2 years ago

Now that Neovim 0.6 is out and Telescope itself requires 0.6, maybe you can go back to the lua API method that you were using earlier?