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

Toggle checkbox status #491

Closed juridiener closed 1 year ago

juridiener commented 1 year ago

Describe the bug

hello i have a problem with toggle the checkbox. If i press C-Space nothing happens :(

And another problem ist when i exit the insert mode it close always the heading, this is kinda annoying. Is it a bug or a feature ? :D

Steps to reproduce

press C-Space

Expected behavior

Toggle checkbox

Emacs functionality

Toggle checkbox

Minimal init.lua

local orgmode_ok, orgmode = pcall(require, "orgmode")
if not orgmode_ok then
  print('orgmode not avaible')
  return
end

orgmode.setup_ts_grammar()

orgmode.setup({
  org_agenda_files = {'~/Documents/org-files/**/*'},
  org_default_notes_file = '~/Documents/org-files/refile.org',
  org_capture_templates = {
    t = {
      description = 'Todo',
      template = '* TODO %?\n%U',
      target = '~/Documents/org-files/todo.org'
    },
    j = {
      description = 'Journal',
      template = '\n*** %<%Y-%m-%d> %<%A>\n**** %U\n\n%?',
      target = '~/Documents/org-files/journal.org'
    },
    n = {
      description = 'Notes',
      template = '* %?\n %u',
      target = '~/Documents/org-files/notes.org'
    }
  },
  mappings = {
    org = {
      org_toggle_checkbox = '<C-Space>',
    }
  }
})

Screenshots and recordings

No response

OS / Distro

macOS 12.1

Neovim version/commit

v0.9.0-dev-543+g843ad837c

Additional context

No response

jgollenz commented 1 year ago

Hi @juridiener, do you mind wrapping your minimal init.lua in backticks? Thanks :) Also, this is not a good minimal init.lua. I suspect this comes from your dotfiles. Please have a look at the file that was mentioned in the issue template. The idea behind minimal_init.lua is that we can now run nvim -u minimal_init.lua and be sure that no other plugins or settings interfere with nvim-orgmode.

Please forgive the question, but you are pressing Ctrl+Space and not C+Space, correct? I cannot reproduce this behavior. Toggling checkboxes works fine for me on nvim nightly and I also don't get folded headlines when I exit insert mode. Perhaps you could make a screen-capture (with your minimal_init.lua ofc)?

juridiener commented 1 year ago

Hi @jgollenz, i looked at this file. Sorry for the question. What i should post in the minimal_init.lua file. This is my first time posting an issue on github. I really appreciate your help.

Yes i meant Ctrl + Space i wrote before '' but then the text in the quotes disappears for some reason so then i removed the brackets, but forgot that C-Space doesn't make sense. Sorry for the confusion.

https://user-images.githubusercontent.com/92093874/214520915-a3221e1b-70d9-463b-95c1-c2dbd447979f.mov

jgollenz commented 1 year ago

No worries. As a first step, let's see if your issue also arises if you use the default minimal_init.lua that comes with this repo. Go to wherever you have cloned this repo (I don't know where that is for you, as I don't know which package manager you use). In the root directory, you'll find a file in the scripts directory called minimal_init.lua. Now you run nvim -u /the/path/to/scripts/minimal_init.lua your_test_file.org. The -u will run nvim with only the things that are defined in the minimal_init.lua, so prepare to have a bare-bones nvim experience. Try toggling a checkbox now ;)

juridiener commented 1 year ago

@jgollenz I use Packer. Should i copy the minimal_init.lua in my config folder where my init.lua is?

https://user-images.githubusercontent.com/92093874/214603687-9b8919a9-2331-472f-ae03-f9c7971dc65a.mov

So i copied the file and run this command: nvim -u ~/.config/nvim/minimal_init.lua todo.org

And the same thing, nothing happens. Is it correct what i did?

jgollenz commented 1 year ago

Oh, I'm just being not very attentive. Those are not checkboxes. You should have

* TODO test
  - [ ] Task 1

You have

* TODO test
  [] Task 1

which is not parsed as a checkbox, but a line that happens to start with two brackets. You need the dash at the front and the blanks in-between. See here

juridiener commented 1 year ago

Hi @jgollenz Thank you, and sorry for beeing not attentive enough. But i have still the same problem with folding the headline.

But not with the minimal_init.lua.

How can i debug the issue?

Is there a keybinding too, to create a checkbox?

https://user-images.githubusercontent.com/92093874/214790340-80d43d5b-12ac-4aa1-861d-c3b8f4678259.mov

Maltimore commented 1 year ago

I think since this github issue is mostly about the "Toggle checkbox status", which is solved, you should close this issue and open another one just about the closing of the folds when you exit insert mode. And, since this issue doesn't occur with the provided minimal config, I think you should experiment with minimizing your config until you find a relatively minimal config where this issue still occurs.