Skip to content

Mode Manager

github-actions[bot] edited this page Jun 25, 2022 · 248 revisions

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:
    ["core.defaults"] = {},
    In your Neorg setup.
  • To manually load the module, place this code in your Neorg setup:
    ["core.mode"] = {
       config = { -- Note that this table is optional and doesn't need to be provided
           -- Configuration here
       }
    }
    Consult the configuration section to see how you can configure 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