Skip to content

Conversation

e-mar404
Copy link

@e-mar404 e-mar404 commented Aug 9, 2025

set_checkbox to specific state

Can be called as command :Obsidian set_checkbox [STATE] with the state being an optional param.

There will be a validation check to make sure that the passed state is part of the checkbox order since if it isn't this would cause issues with the auto cycling of toggle_checkbox.

This would be implementing issue #316.

Note: Did not add tests since they would break due to the treesitter issue that also affects toggle_checkbox, as mentioned on #300.

@e-mar404 e-mar404 changed the title Set checkbox Set checkbox to specific state Aug 9, 2025
@neo451
Copy link
Member

neo451 commented Aug 18, 2025

@e-mar404

great PR!

Some ideas:

  1. no need to worry about tests for now.
  2. I was more imagining that the vim.fn.getchar logic to be in the API function, so that like smart_action and nav_link, we can provide a default map or an instruction to a simple map.
  3. As I discussed in that issue, I don't think using a user command to set it to a specific state is economical, and I don't want to make the already crowed namespace have more members. So maybe just stick to the function approach.

Also users can easily register their own command now, https://github.com/obsidian-nvim/obsidian.nvim/wiki/Extensions

@e-mar404
Copy link
Author

@neo451 Thanks!

I removed the user command and just kept the logic to be encapsulated on the api function.

For documentation I am not sure where to write about it's existence. It doesn't feel like something that should have a default key map since this can have more of a subjective mapping. I was thinking of adding it to the keymaps section of the README and docs but just mentioning that it does not have a default keymap and that is something that is user defined instead.

What do you think of that approach instead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants