Skip to content
github-actions[bot] edited this page Jun 25, 2022 · 198 revisions

Directory manager for Neorg.

This module is be responsible for managing directories full of .norg files.

Overview

It will provide other modules the ability to see which directories the user is in, automatically changing directories, and other API bits and bobs that will allow things like telescope.nvim integration.

To use core.norg.dirman, simply load up the module in your configuration and specify the directories you want to be managed for you:

require('neorg').setup {
    load = {
        ["core.defaults"] = {},
        ["core.norg.dirman"] = {
            config = {
                workspaces = {
                    my_ws = "~/neorg", -- Format: <name_of_workspace> = <path_to_workspace_root>
                    my_other_notes = "~/work/notes",
                },
                autochdir = true, -- Automatically change the directory to the current workspace's root every time
                index = "index.norg", -- The name of the main (root) .norg file
            }
        }
    }
}

To query the current workspace, run :Neorg workspace. To set the workspace, run :Neorg workspace <workspace_name>.

Usage

How to Apply

  • To manually load the module, place this code in your Neorg setup:
    ["core.norg.dirman"] = {
       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.norg.dirman to your liking.

Configuration

workspaces : The list of active workspaces

Default Value:

autochdir : Automatically change the directory to the root of the workspace every time

Default value: false

index : The name for the index file

Default value: "index.norg"

default_workspace : The default workspace to load into when running :NeorgStart This is only used whenever Neorg does not remember your previous workspace

Default value: nil

open_last_workspace : Whether to open the last workspace when running :NeorgStart

Default value: true

Developer Usage

Public API

This segment will detail all of the functions core.norg.dirman exposes. All of these functions reside in the public table.

  • open_file
  • get_workspaces
  • get_workspace_names
  • get_current_workspace
  • set_workspace
  • create_file
  • file_exists
  • get_file_bufnr
  • get_norg_files
  • sync
  • get_workspace_match
  • touch_file
  • open_workspace
  • add_workspace
  • set_last_workspace
  • update_cwd
  • get_workspace

Examples

None Provided

Extra Info

Version

This module supports at least version 0.0.11. The current Neorg version is 0.0.11.

Imports

This module does not import any other files.

Requires

  • core.autocommands - Handles the creation and management of Neovim's autocommands.
  • core.neorgcmd - This module deals with handling everything related to the :Neorg command.
  • core.keybinds - Module for managing keybindings with Neorg mode support.
  • core.ui - A set of public functions to help developers create and manage UI (selection popups, prompts...) in their modules.
  • core.storage - Deals with storing persistent data across Neorg sessions.

Required by