Module _m

A table of loaded modules.

Overview

Modules utilize the Lua 5.1 package model. It is recommended to put all modules in your ~/.textadept/modules/ directory. A module consists of a single directory with an init.lua script to load any additional Lua files (typically in the same location). Essentially there are two classes of modules: generic and language-specific.

Generic Modules

This class of modules is usually available globally for programming in all languages. An example is the _m.textadept module which adds a wide variety of text editing capabilities to Textadept.

Language-specific Modules

Each module of this class of modules is named after a language lexer in lexers/ and is usually available only for editing code in that particular programming language. Examples are the _m.cpp and _m.lua modules which provide special editing features for the C/C++ and Lua languages respectively.

Note: While language-specific modules can only be used by files of that language, they persist in Textadept's Lua state. Because of this, it is not recommended to set global functions or variables and depend on them, as they may be inadvertantly overwritten. Keep these inside the module.

Loading Modules

Generic modules can be loaded using require:

require 'module_name'

Language-specific modules are automatically loaded when a file of that language is loaded or a buffer's lexer is set to that language.

Managing Modules

Modules are easy to create and edit in the filesystem, but you can use the modules PM browser to create Language-specific modules from a generic template, or manage all available modules.

Modules and Key Commands

When assigning key commands to module functions, do not forget to do so AFTER the function has been defined. Typically key commands are placed at the end of files, like commands.lua in language-specific modules.

Overview

Modules utilize the Lua 5.1 package model. It is recommended to put all modules in your ~/.textadept/modules/ directory. A module consists of a single directory with an init.lua script to load any additional Lua files (typically in the same location). Essentially there are two classes of modules: generic and language-specific.

Generic Modules

This class of modules is usually available globally for programming in all languages. An example is the _m.textadept module which adds a wide variety of text editing capabilities to Textadept.

Language-specific Modules

Each module of this class of modules is named after a language lexer in lexers/ and is usually available only for editing code in that particular programming language. Examples are the _m.cpp and _m.lua modules which provide special editing features for the C/C++ and Lua languages respectively.

Note: While language-specific modules can only be used by files of that language, they persist in Textadept's Lua state. Because of this, it is not recommended to set global functions or variables and depend on them, as they may be inadvertantly overwritten. Keep these inside the module.

Loading Modules

Generic modules can be loaded using require:

require 'module_name'

Language-specific modules are automatically loaded when a file of that language is loaded or a buffer's lexer is set to that language.

Managing Modules

Modules are easy to create and edit in the filesystem, but you can use the modules PM browser to create Language-specific modules from a generic template, or manage all available modules.

Modules and Key Commands

When assigning key commands to module functions, do not forget to do so AFTER the function has been defined. Typically key commands are placed at the end of files, like commands.lua in language-specific modules.

Functions

no_functions () This module contains no functions.


Functions

no_functions ()
This module contains no functions.

Valid XHTML 1.0!