Mode Manager
github-actions[bot] edited this page Jun 25, 2022
·
248 revisions
Pages 45
Setting Up
For the programmer
- Writing my own module
- Hotswapping modules
- Difference between module.public and module.config.public
- Metamodules
Inbuilt modules:
core.autocommands
core.export
core.export.markdown
core.gtd.base
core.integrations.treesitter
core.keybinds
core.mode
core.neorgcmd
core.norg.completion
core.norg.concealer
core.norg.dirman
core.norg.esupports.hop
core.norg.esupports.indent
core.norg.esupports.metagen
core.norg.journal
core.norg.manoeuvre
core.norg.news
core.norg.qol.toc
core.norg.qol.todo_items
core.presenter
core.syntax
core.tangle
Clone this wiki locally
Mode manager for Neorg
Modes are a way of isolating different parts of Neorg based on the current mode.
Overview
- To add a mode to core.mode, use the public
add_mode("my-mode-name")
. - To set the current mode, use the public
set_mode("my-mode-name")
. - To retrieve the current mode name, use
get_mode()
. - To retrieve the previous mode name, use
get_previous_mode()
. - To retrieve all modes, use
get_modes()
.
If core.neorgcmd
is loaded, core.mode.public.add_mode()
also updates the autocompletion for the :Neorg mode command,
which can be used by the user to switch modes.
Usage
How to Apply
- This module is already present in the
core.defaults
metamodule. You can load the module with:In your Neorg setup.["core.defaults"] = {},
- To manually load the module, place this code in your Neorg setup:
Consult the configuration section to see how you can configure
["core.mode"] = { config = { -- Note that this table is optional and doesn't need to be provided -- Configuration here } }
core.mode
to your liking.
Configuration
current_mode
: Stores the current mode
Default value: "norg"
previous_mode
: Stores the previous mode
Default value: "norg"
Developer Usage
Public API
This segment will detail all of the functions core.mode
exposes. All of these functions reside in the public
table.
set_mode
get_mode
add_mode
get_modes
get_previous_mode
Examples
None Provided
Extra Info
Version
This module supports at least version 0.0.9. The current Neorg version is 0.0.11.
Imports
This module does not import any other files.
Requires
This module does not require any other modules to operate.
Required by
-
core.gtd.ui
- Nicely displays GTD related information. -
core.integrations.treesitter
- A module designed to integrate TreeSitter into Neorg. -
core.norg.qol.toc
- Generates a Table of Content from the Neorg file. -
core.keybinds
- Module for managing keybindings with Neorg mode support.