Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Close TOC after jumping to header #785

Closed
1 task done
bR3iN opened this issue Mar 29, 2023 · 1 comment
Closed
1 task done

Close TOC after jumping to header #785

bR3iN opened this issue Mar 29, 2023 · 1 comment
Labels
feature Issues related to feature proposals. Please attach a module.

Comments

@bR3iN
Copy link
Contributor

bR3iN commented Mar 29, 2023

Issues

  • I have checked existing issues and there are no existing ones with the same request.

Feature description

While I find the table of contents generated by the Neorg toc <...> commands useful for quickly navigating a file, I find it hindering that it the TOC stays open after jumping to a header and continues to take space. I would find it useful if there would be an option to automatically close it after use (or at least to toggle the TOC, so that I don't have to manually navigate back to it to close it).

I would also find it useful if I could open the TOC of the current buffer in the current buffer; this would make TOC-based navigation much more ergonomic without needing space for additional buffers.

I think the situation is very similar to file explorer plugins where there are project drawer plugins like nerdtree which provide an interface closer to what other editors/application provide, but also split explorers like vim-vinegar, lir.nvim and oil.nvim which focus more on integrating into (Neo)vim's split based interface (with a popular entrypoint into the topic being this blog post). Neorg's current TOC interface seems to be focused predominately on a "project drawer"-like workflow.

Help

Yes

Implementation help

If we clarify the feature's scope, I could implement it. Since I'm not familiar with the plugin's internals, a few hints on what existing functionality I can/should use and where to find it would be appreciated.

@bR3iN bR3iN added the feature Issues related to feature proposals. Please attach a module. label Mar 29, 2023
@vhyrro
Copy link
Member

vhyrro commented Apr 19, 2023

Hey, this has now been implemented!

Set the close_after_use option to true in the config to enable the functionality:

["core.norg.qol.toc"] = {
	config = {
		close_after_use = true,
	},
}

If something doesn't work then let me know :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Issues related to feature proposals. Please attach a module.
Projects
None yet
Development

No branches or pull requests

2 participants