nvim-orgmode / orgmode

Orgmode clone written in Lua for Neovim 0.9+.
https://nvim-orgmode.github.io/
MIT License
3.03k stars 134 forks source link

No fold found #109

Closed levouh closed 2 years ago

levouh commented 3 years ago

Are you using "tree-sitter" branch?

Yes

Describe the bug

When starting Neovim and opening a .org file, it reports "No fold found" (via <Tab>). However after toggling all folds (via <S-Tab>), it is then able to find the fold in the same location where it couldn't before.

Steps to reproduce

  1. Setup a "minimal init" like so:
vim.cmd([[
  set rtp=$VIMRUNTIME
  packadd nvim-treesitter
  packadd playground
  packadd orgmode.nvim
  packadd org-bullets.nvim
]])

vim.g.mapleader = ","

require("nvim-treesitter.configs").setup({
  ensure_installed = { "python", "c", "json", "lua", "bash", "comment" },
  highlight = {
    enable = true,
  },
})

local parser_config = require("nvim-treesitter.parsers").get_parser_configs()

parser_config.org = {
  install_info = {
    url = "https://github.com/milisims/tree-sitter-org",
    revision = "main",
    files = { "src/parser.c", "src/scanner.cc" },
  },
  filetype = "org",
}

require("nvim-treesitter.configs").setup({
  highlight = {
    enable = true,
    disable = { "org" },
    additional_vim_regex_highlighting = { "org" },
  },
  ensure_installed = { "org" },
})

require("orgmode").setup({
  org_agenda_files = { "~/org/agenda/**/*" },
  org_default_notes_file = "~/org/refile.org",
  org_todo_keywords = { "TODO(t)", "NEXT(n)", "FDBK(f)", "|", "DONE(d)", "DLGT(g)" },
})
  1. mkdir -p ~/org/agenda && touch ~/org/refile.org
  2. Place the following into refile.org:
* TODO This item is due next week                                               :one:
  - Related task: [[*Do foo]]
  - [X] A todo item
        that would be nice if it lined up
  - [ ] Another todo item
  DEADLINE: <2021-10-30 Sat> SCHEDULED: <2021-10-23 Sat>
  :LOGBOOK:
  CLOCK: [2021-10-23 Sat 10:54]--[2021-10-23 Sat 15:51] => 4:57
  CLOCK: [2021-10-23 Sat 10:48]--[2021-10-23 Sat 10:48] => 0:00
  :END:
  [2021-10-23 Sat]

** TODO This is a sub-item, due slightly before
   DEADLINE: <2021-10-29 Fri>

* TODO This item is due tomorrow
  DEADLINE: <2021-10-24 Sun>
  1. On the very first line (cursor at {1, 0} as :h nvim_win_get_cursor reports it) press the (default-mapped) <Tab>.
  2. Observe the text "No fold" on the command-line.
  3. Press <S-Tab> until all folds have cycled back to "fully open".
  4. Press <Tab> on the first heading again, observe that it now works.

Expected behavior

<Tab> presses always perform the same functionality.

Emacs functionality

No response

Screenshots and recordings

https://user-images.githubusercontent.com/31262046/138573355-3f3cbc7b-f016-447a-8a4b-2053a6bc503c.mp4

OS / Distro

Linux, Fedora 34

Neovim version/commit

NVIM v0.6.0-dev+493-g035d82e0d

Additional context

Treesitter Playground output here:

image

kristijanhusak commented 2 years ago

Pressing zx should fix it for now. There's already an issue reported for this.

kristijanhusak commented 2 years ago

I pushed a fix. Please let me know if it works now.

levouh commented 2 years ago

Works exactly as expected, thanks again.