Skip to content

Autocommands

github-actions[bot] edited this page May 18, 2024 · 90 revisions

core.autocommands

Handles the creation and management of Neovim's autocommands.

Overview

This internal module exposes functionality for subscribing to autocommands and performing actions based on those autocommands.

NOTE: This module will be soon deprecated, and it's favourable to use the vim.api* functions instead.

In your module.setup(), make sure to require core.autocommands (requires = { "core.autocommands" }) Afterwards in a function of your choice that gets called after core.autocommmands gets intialized (e.g. load()):

module.load = function()
    module.required["core.autocommands"].enable_autocommand("VimLeavePre") -- Substitute VimLeavePre for any valid neovim autocommand
end

Afterwards, be sure to subscribe to the event:

module.events.subscribed = {
    ["core.autocommands"] = {
        vimleavepre = true
    }
}

Upon receiving an event, it will come in this format:

{
    type = "core.autocommands.events.<name of autocommand, e.g. vimleavepre>",
    broadcast = true
}

Configuration

This module provides no configuration options!

Required By

  • core.concealer - Enhances the basic Neorg experience by using icons instead of text.
  • core.dirman - This module is be responsible for managing directories full of .norg files.
  • core.esupports.indent - A set of instructions for Neovim to indent Neorg documents.
  • core.esupports.metagen - A Neorg module for generating document metadata automatically.
  • core.highlights - Manages your highlight groups with this module.
  • core.keybinds - Module for managing keybindings with Neorg mode support.
  • core.latex.renderer - An experimental module for rendering latex images inline.
  • core.storage - Deals with storing persistent data across Neorg sessions.
  • core.syntax - Handles interaction for syntax files for code blocks.
Clone this wiki locally