Update docs

pull/7/head
Iron-E 4 years ago
parent c570e3886c
commit 8d99e05af5
No known key found for this signature in database
GPG Key ID: 19B71B7B7B021D22

@ -10,7 +10,7 @@ Any material not covered here is covered in |libmodal-usage|.
See: |libmodal-usage|, |lua|, |lua-require-example|. See: |libmodal-usage|, |lua|, |lua-require-example|.
============================================================================== ================================================================================
0. Table of Contents *libmodal-lua-toc* 0. Table of Contents *libmodal-lua-toc*
1. `libmodal` ............................. |libmodal-lua-libmodal| 1. `libmodal` ............................. |libmodal-lua-libmodal|
@ -31,14 +31,14 @@ See: |libmodal-usage|, |lua|, |lua-require-example|.
9.3. `libmodal.utils.WindowState` ........... |libmodal-lua-Windowstate| 9.3. `libmodal.utils.WindowState` ........... |libmodal-lua-Windowstate|
10. `libmodal.Vars` ........................ |libmodal-lua-Vars| 10. `libmodal.Vars` ........................ |libmodal-lua-Vars|
============================================================================== ================================================================================
1. `libmodal` *libmodal-lua-libmodal* 1. `libmodal` *libmodal-lua-libmodal*
This is the base of |libmodal|. It can be imported using: > This is the base of |libmodal|. It can be imported using: >
local libmodal = require('libmodal') local libmodal = require('libmodal')
<if |libmodal| is in your 'runtimepath'. <if |libmodal| is in your 'runtimepath'.
------------------------------------------------------------------------------ --------------------------------------------------------------------------------
MODULES *libmodal-lua-modules* MODULES *libmodal-lua-modules*
 `libmodal`  `libmodal`
@ -60,7 +60,7 @@ MODULES *libmodal-lua-modules*
│ └──  `.WindowState` │ └──  `.WindowState`
└──  `.Vars` └──  `.Vars`
============================================================================== ================================================================================
2. `libmodal.classes` *libmodal-lua-classes* 2. `libmodal.classes` *libmodal-lua-classes*
`libmodal.classes` is a small library to help shorten the amount of `libmodal.classes` is a small library to help shorten the amount of
@ -71,7 +71,7 @@ There aren't an astounding amount of functions: the intent is not to implement
object orientation into Lua, rather it is to help facilitate the emulation of object orientation into Lua, rather it is to help facilitate the emulation of
object orientation through `metatable`s. object orientation through `metatable`s.
------------------------------------------------------------------------------ --------------------------------------------------------------------------------
FUNCTIONS *libmodal-lua-classes-functions* FUNCTIONS *libmodal-lua-classes-functions*
`classes`.new({name}, {base}) *libmodal-lua-classes.new()* `classes`.new({name}, {base}) *libmodal-lua-classes.new()*
@ -100,13 +100,13 @@ FUNCTIONS *libmodal-lua-classes-functions*
`__type`. `__type`.
* Else, return `type(`{value}`)` * Else, return `type(`{value}`)`
============================================================================== ================================================================================
3. `libmodal.collections` *libmodal-lua-collections* 3. `libmodal.collections` *libmodal-lua-collections*
The `libmodal.collections` module consists of a few data structures that The `libmodal.collections` module consists of a few data structures that
support the rest of `libmodal`. support the rest of `libmodal`.
============================================================================== ================================================================================
3.1. `libmodal.collections.ParseTable` *libmodal-lua-ParseTable* 3.1. `libmodal.collections.ParseTable` *libmodal-lua-ParseTable*
A `ParseTable` is a pseudo-parse tree of a given user collection of A `ParseTable` is a pseudo-parse tree of a given user collection of
@ -114,8 +114,8 @@ keybinding:expression pairs.
See: |libmodal-mode| for more information. See: |libmodal-mode| for more information.
------------------------------------------------------------------------------ --------------------------------------------------------------------------------
functions *libmodal-lua-ParseTable-functions* FUNCTIONS *libmodal-lua-ParseTable-functions*
`ParseTable`.CR *libmodal-lua-ParseTable.CR* `ParseTable`.CR *libmodal-lua-ParseTable.CR*
@ -127,7 +127,7 @@ functions *libmodal-lua-ParseTable-functions*
Value: ~ Value: ~
13 13
------------------------------------------------------------------------------ --------------------------------------------------------------------------------
FUNCTIONS *libmodal-lua-ParseTable-functions* FUNCTIONS *libmodal-lua-ParseTable-functions*
`ParseTable`.stringSplit({str}, {regex}) *libmodal-lua-ParseTable.stringSplit()* `ParseTable`.stringSplit({str}, {regex}) *libmodal-lua-ParseTable.stringSplit()*
@ -302,7 +302,7 @@ FUNCTIONS *libmodal-lua-ParseTable-functions*
|libmodal-lua-parsetable-parseput| For more information on |libmodal-lua-parsetable-parseput| For more information on
{tableToUnite}. {tableToUnite}.
============================================================================== ================================================================================
3.2. `libmodal.collections.Popup` *libmodal-lua-Popup* 3.2. `libmodal.collections.Popup` *libmodal-lua-Popup*
When `:enter()`ing a `Mode`, an |api-floatwin| is displayed at the bottom When `:enter()`ing a `Mode`, an |api-floatwin| is displayed at the bottom
@ -325,7 +325,7 @@ opened with the following options: >
} }
< <
------------------------------------------------------------------------------ --------------------------------------------------------------------------------
VARIABLES *libmodal-lua-Popup-variables* VARIABLES *libmodal-lua-Popup-variables*
`Popup`.config *libmodal-lua-Popup.apiOptions* `Popup`.config *libmodal-lua-Popup.apiOptions*
@ -373,7 +373,7 @@ VARIABLES *libmodal-lua-Popup-variables*
Value: ~ Value: ~
`vim.api.nvim_open_win(self.buffer, false, Popup.config)` `vim.api.nvim_open_win(self.buffer, false, Popup.config)`
------------------------------------------------------------------------------ --------------------------------------------------------------------------------
FUNCTIONS *libmodal-lua-Popup-functions* FUNCTIONS *libmodal-lua-Popup-functions*
`self`:close() *libmodal-lua-Popup.close()* `self`:close() *libmodal-lua-Popup.close()*
@ -406,7 +406,7 @@ FUNCTIONS *libmodal-lua-Popup-functions*
|libmodal-lua-Popup| For the options used to spawn the window. |libmodal-lua-Popup| For the options used to spawn the window.
============================================================================== ================================================================================
4.2. `libmodal.collections.Stack` *libmodal-lua-Stack* 4.2. `libmodal.collections.Stack` *libmodal-lua-Stack*
The `libmodal.collections.Stack` is a simple implementation of a Stack data The `libmodal.collections.Stack` is a simple implementation of a Stack data
@ -416,7 +416,7 @@ times.
The `#` operator in |Lua| will work on this structure. The `#` operator in |Lua| will work on this structure.
------------------------------------------------------------------------------ --------------------------------------------------------------------------------
FUNCTIONS *libmodal-lua-Stack-functions* FUNCTIONS *libmodal-lua-Stack-functions*
`self`:peek() *libmodal-lua-Stack.peek()* `self`:peek() *libmodal-lua-Stack.peek()*
@ -487,14 +487,14 @@ FUNCTIONS *libmodal-lua-Stack-functions*
print(vim.inspect(stk)) print(vim.inspect(stk))
< <
============================================================================== ================================================================================
4. `libmodal.globals` *libmodal-lua-globals* 4. `libmodal.globals` *libmodal-lua-globals*
These are global functions used throughout the project. They are never These are global functions used throughout the project. They are never
modified and never meant TO be modified. modified and never meant TO be modified.
------------------------------------------------------------------------------ --------------------------------------------------------------------------------
functions *libmodal-lua-globals-functions* FUNCTIONS *libmodal-lua-globals-functions*
`globals`.DEFAULT_ERROR_TITLE *libmodal-lua-globals.DEFAULT_ERROR_TITLE* `globals`.DEFAULT_ERROR_TITLE *libmodal-lua-globals.DEFAULT_ERROR_TITLE*
@ -574,7 +574,7 @@ functions *libmodal-lua-globals-functions*
Value: ~ Value: ~
1 1
------------------------------------------------------------------------------ --------------------------------------------------------------------------------
FUNCTIONS *libmodal-lua-globals-functions* FUNCTIONS *libmodal-lua-globals-functions*
`globals`.is_false({val}) *libmodal-lua-globals.is_false()* `globals`.is_false({val}) *libmodal-lua-globals.is_false()*
@ -587,9 +587,9 @@ FUNCTIONS *libmodal-lua-globals-functions*
expression. expression.
Return: ~ Return: ~
* `true` if {val} is equal to `globals.VIM_FALSE`, |v:false|, or - `true` if {val} is equal to `globals.VIM_FALSE`, |v:false|, or
`false`. `false`.
* `false` otherwise. - `false` otherwise.
Example: ~ Example: ~
> >
@ -628,8 +628,8 @@ FUNCTIONS *libmodal-lua-globals-functions*
expression. expression.
Return: ~ Return: ~
* `true` if {val} is equal to `globals.VIM_TRUE`, |v:true|, or `true`. - `true` if {val} is equal to `globals.VIM_TRUE`, |v:true|, or `true`.
* `false` otherwise. - `false` otherwise.
Example: ~ Example: ~
> >
@ -658,12 +658,12 @@ FUNCTIONS *libmodal-lua-globals-functions*
print(libmodal.globals.is_true(vim_trueValue)) print(libmodal.globals.is_true(vim_trueValue))
< <
============================================================================== ================================================================================
5. `libmodal.utils.Indicator` *libmodal-lua-Indicator* 5. `libmodal.utils.Indicator` *libmodal-lua-Indicator*
Provides creation sources for mode and prompt |echo| / |echohl| `string`s. Provides creation sources for mode and prompt |echo| / |echohl| `string`s.
------------------------------------------------------------------------------ --------------------------------------------------------------------------------
FUNCTIONS *libmodal-lua-indicator-functions* FUNCTIONS *libmodal-lua-indicator-functions*
`Indicator`.mode({modeName}) *libmodal-lua-Indicator.mode()* `Indicator`.mode({modeName}) *libmodal-lua-Indicator.mode()*
@ -702,7 +702,7 @@ FUNCTIONS *libmodal-lua-indicator-functions*
See also: ~ See also: ~
|libmodal-prompt| For this function's use. |libmodal-prompt| For this function's use.
============================================================================== ================================================================================
5.1. `libmodal.Indicator.HighlightSegment` *libmodal-lua-HighlightSegment* 5.1. `libmodal.Indicator.HighlightSegment` *libmodal-lua-HighlightSegment*
The `HighlightSegment` is a map describing how a particular string should be The `HighlightSegment` is a map describing how a particular string should be
@ -711,8 +711,8 @@ highlighted by Vim.
These `HighlightSegment`s can be put into a list and interpreted by These `HighlightSegment`s can be put into a list and interpreted by
`libmodal.utils.api.nvim_lecho()`. `libmodal.utils.api.nvim_lecho()`.
------------------------------------------------------------------------------ --------------------------------------------------------------------------------
functions *libmodal-lua-HighlightSegment-functions* FUNCTIONS *libmodal-lua-HighlightSegment-functions*
`self`.hl *libmodal-lua-HighlightSegment.hl* `self`.hl *libmodal-lua-HighlightSegment.hl*
@ -728,11 +728,11 @@ functions *libmodal-lua-HighlightSegment-functions*
Type: ~ Type: ~
`string` `string`
------------------------------------------------------------------------------ --------------------------------------------------------------------------------
FUNCTIONS *libmodal-lua-HighlightSegment-Functions* FUNCTIONS *libmodal-lua-HighlightSegment-Functions*
`HighlightSegment`.new({hlgroup}, {str}) *libmodal-lua-HighlightSegment.new()* `HighlightSegment`.new({hlgroup}, {str}) *libmodal-lua-HighlightSegment.new()*
--
Create a new `HighlightSegment`. Create a new `HighlightSegment`.
Parameters: ~ Parameters: ~
@ -740,7 +740,7 @@ FUNCTIONS *libmodal-lua-HighlightSegment-Functions*
{str} The {str} to |highlight|. {str} The {str} to |highlight|.
Return: ~ Return: ~
* A new `HighlightSegment`. - A new `HighlightSegment`.
Example: ~ Example: ~
> >
@ -755,7 +755,7 @@ FUNCTIONS *libmodal-lua-HighlightSegment-Functions*
}) })
< <
============================================================================== ================================================================================
6. `libmodal.Layer` *libmodal-lua-Layer* 6. `libmodal.Layer` *libmodal-lua-Layer*
The libmodal `Layer` class provides many additional features to the base The libmodal `Layer` class provides many additional features to the base
@ -766,7 +766,7 @@ returns an anonymous `Layer`'s `:exit()` `function`. By directly having a
reference to a `Layer`, one can use the other `function`s that are provided, reference to a `Layer`, one can use the other `function`s that are provided,
and extend was is possible. and extend was is possible.
------------------------------------------------------------------------------ --------------------------------------------------------------------------------
FUNCTIONS *libmodal-lua-Layer-functions* FUNCTIONS *libmodal-lua-Layer-functions*
`self`:enter() *libmodal-lua-Layer.enter()* `self`:enter() *libmodal-lua-Layer.enter()*
@ -918,12 +918,12 @@ FUNCTIONS *libmodal-lua-Layer-functions*
{keymap} The list of |map|pings to replace. {keymap} The list of |map|pings to replace.
Returns: ~ Returns: ~
* A new `Layer`. - A new `Layer`.
See also: ~ See also: ~
|libmodal-layer| For more information about the parameters. |libmodal-layer| For more information about the parameters.
============================================================================== ================================================================================
7. `libmodal.Mode` *libmodal-lua-Mode* 7. `libmodal.Mode` *libmodal-lua-Mode*
While `libmodal.mode.enter()` may enter a mode, it silently creates a `Mode` While `libmodal.mode.enter()` may enter a mode, it silently creates a `Mode`
@ -957,8 +957,8 @@ want to for their mode specifically. >
< (The specifications for these functions can be found at other places in this < (The specifications for these functions can be found at other places in this
document.) document.)
------------------------------------------------------------------------------ --------------------------------------------------------------------------------
functions *libmodal-lua-Mode-functions* FUNCTIONS *libmodal-lua-Mode-functions*
`self`.exit *libmodal-lua-Mode.exit* `self`.exit *libmodal-lua-Mode.exit*
@ -1011,8 +1011,8 @@ functions *libmodal-lua-Mode-functions*
array-like `table` of |char2nr|s. array-like `table` of |char2nr|s.
Value: ~ Value: ~
* `nil` => {instruction} is a `function`. - `nil` => {instruction} is a `function`.
* `{}` => {instruction} is a `table`. - `{}` => {instruction} is a `table`.
`self`.mappings *libmodal-lua-Mode.mappings* `self`.mappings *libmodal-lua-Mode.mappings*
@ -1032,7 +1032,7 @@ functions *libmodal-lua-Mode-functions*
|libmodal-lua-ParseTable| For information about how to use this |libmodal-lua-ParseTable| For information about how to use this
variable. variable.
------------------------------------------------------------------------------ --------------------------------------------------------------------------------
FUNCTIONS *libmodal-lua-Mode-functions* FUNCTIONS *libmodal-lua-Mode-functions*
`self`:enter() *libmodal-lua-Mode.enter()* `self`:enter() *libmodal-lua-Mode.enter()*
@ -1059,7 +1059,7 @@ FUNCTIONS *libmodal-lua-Mode-functions*
|libmodal-mode| For more information, as all of the parameters are |libmodal-mode| For more information, as all of the parameters are
the same. the same.
============================================================================== ================================================================================
8. `libmodal.Prompt` *libmodal-lua-Prompt* 8. `libmodal.Prompt` *libmodal-lua-Prompt*
While `libmodal.prompt.enter()` may enter a |libmodal-prompt|, itilently While `libmodal.prompt.enter()` may enter a |libmodal-prompt|, itilently
@ -1072,7 +1072,7 @@ creates a `Mode` underneath: >
See |libmodal-lua-Mode| for more information about the possibilities that are See |libmodal-lua-Mode| for more information about the possibilities that are
enabled by using such a "class". enabled by using such a "class".
------------------------------------------------------------------------------ --------------------------------------------------------------------------------
VARIABLES *libmodal-lua-Prompt-variables* VARIABLES *libmodal-lua-Prompt-variables*
`self`.indicator *libmodal-lua-Prompt.indicator* `self`.indicator *libmodal-lua-Prompt.indicator*
@ -1102,7 +1102,7 @@ VARIABLES *libmodal-lua-Prompt-variables*
Value: ~ Value: ~
`libmodal.Vars.new('input', `{name}`)` `libmodal.Vars.new('input', `{name}`)`
------------------------------------------------------------------------------ --------------------------------------------------------------------------------
FUNCTIONS *libmodal-lua-Prompt-functions* FUNCTIONS *libmodal-lua-Prompt-functions*
`self`:enter() *libmodal-lua-Prompt.enter()* `self`:enter() *libmodal-lua-Prompt.enter()*
@ -1131,12 +1131,12 @@ FUNCTIONS *libmodal-lua-Prompt-functions*
|libmodal-prompt| For more information, as all of the parameters are |libmodal-prompt| For more information, as all of the parameters are
the same. the same.
============================================================================== ================================================================================
9. `libmodal.utils` *libmodal-lua-utils* 9. `libmodal.utils` *libmodal-lua-utils*
Provides extra utilities to the |libmodal| library. Provides extra utilities to the |libmodal| library.
------------------------------------------------------------------------------ --------------------------------------------------------------------------------
FUNCTIONS *libmodal-lua-utils-functions* FUNCTIONS *libmodal-lua-utils-functions*
`utils`.show_error({pcall_err}) *libmodal-lua-utils.show_error()* `utils`.show_error({pcall_err}) *libmodal-lua-utils.show_error()*
@ -1170,9 +1170,43 @@ Provides extensions to the `vim.api` |Lua| library.
See: |API|. See: |API|.
------------------------------------------------------------------------------ --------------------------------------------------------------------------------
FUNCTIONS *libmodal-lua-api-functions* FUNCTIONS *libmodal-lua-api-functions*
`api`.mode_exit({exit_char}) *libmodal-lua-api.mode_exit()*
Use |feedkeys()| to send an {exit_char} which signals a |libmodal-mode| or
|libmodal-prompt| to stop listening for input.
It is not usually necessary to specify {exit_char}. It is only necessary
to do so when |libmodal-mode|'s {supressExit} flag is active, because
it is possible that the user has set up some non-default character which
should be used to exit the mode (see |libmodal-examples-supress-exit|).
Parameters: ~
{exit_char} (Optional) The character used to exit the mode, or
|libmodal-lua-globals.ESC_NR| by default.
Can be a character number (see |char2nr()|) or a string.
Example: ~
>
local libmodal = require('libmodal')
-- This function is called every time the user presses a key.
local function _instruction()
-- Exit the mode after pressing any key.
libmodal.utils.api.mode_exit()
end
libmodal.mode.enter('Press any key to exit.', _instruction)
<
See also: ~
|char2nr()| For more information about character numbers.
|libmodal-mode| For more information about {supressExit}.
|feedkeys()| For information about how this method is implemented.
`api`.nvim_bell() *libmodal-lua-api.nvim_bell()* `api`.nvim_bell() *libmodal-lua-api.nvim_bell()*
Make vim ring the visual/audio bell, if it is enabled. Make vim ring the visual/audio bell, if it is enabled.
@ -1181,7 +1215,7 @@ FUNCTIONS *libmodal-lua-api-functions*
> >
local libmodal = require('libmodal') local libmodal = require('libmodal')
libmoal.utils.api.nvim_bell() libmodal.utils.api.nvim_bell()
< <
See also: ~ See also: ~
@ -1291,7 +1325,7 @@ FUNCTIONS *libmodal-lua-api-functions*
) )
< <
============================================================================== ================================================================================
9.2. `libmodal.utils.Help` *libmodal-lua-Help* 9.2. `libmodal.utils.Help` *libmodal-lua-Help*
Allows for the creation of a default "Help" table. Allows for the creation of a default "Help" table.
@ -1299,7 +1333,7 @@ Allows for the creation of a default "Help" table.
By default, this "Help" is shown by pressing `?` in a |libmodal-mode| or by By default, this "Help" is shown by pressing `?` in a |libmodal-mode| or by
entering "help" into a |libmodal-prompt|. entering "help" into a |libmodal-prompt|.
------------------------------------------------------------------------------ --------------------------------------------------------------------------------
FUNCTIONS *libmodal-lua-Help-functions* FUNCTIONS *libmodal-lua-Help-functions*
`Help`.new({commandsOrMaps}, {title}) *libmodal-lua-Help.new()* `Help`.new({commandsOrMaps}, {title}) *libmodal-lua-Help.new()*
@ -1360,13 +1394,13 @@ FUNCTIONS *libmodal-lua-Help-functions*
mapsHelp:show() mapsHelp:show()
< <
============================================================================== ================================================================================
9.3. `libmodal.utils.WindowState` *libmodal-lua-WindowState* 9.3. `libmodal.utils.WindowState` *libmodal-lua-WindowState*
Tracks 'winheight' and 'winwidth' when created, so that it can be modified Tracks 'winheight' and 'winwidth' when created, so that it can be modified
freely and then restored later. freely and then restored later.
------------------------------------------------------------------------------ --------------------------------------------------------------------------------
FUNCTIONS *libmodal-lua-WindowState-functions* FUNCTIONS *libmodal-lua-WindowState-functions*
`WindowState`.new() *libmodal-lua-WindowState.new()* `WindowState`.new() *libmodal-lua-WindowState.new()*
@ -1415,13 +1449,13 @@ FUNCTIONS *libmodal-lua-WindowState-functions*
print_height() print_height()
< <
============================================================================== ================================================================================
10. `libmodal.Vars` *libmodal-lua-Vars* 10. `libmodal.Vars` *libmodal-lua-Vars*
A `Var`'s purpose is to act as an intermediary between |global-variables| and A `Var`'s purpose is to act as an intermediary between |global-variables| and
the modes that use them. the modes that use them.
------------------------------------------------------------------------------ --------------------------------------------------------------------------------
FUNCTIONS *libmodal-lua-Vars.functions* FUNCTIONS *libmodal-lua-Vars.functions*
`self`:name() *libmodal-lua-Vars.name()* `self`:name() *libmodal-lua-Vars.name()*
@ -1432,7 +1466,7 @@ FUNCTIONS *libmodal-lua-Vars.functions*
{modeName} The name of the mode. {modeName} The name of the mode.
Return: ~ Return: ~
* The name of the vimscript variable that this `Var` corresponds to. - The name of the vimscript variable that this `Var` corresponds to.
Example: ~ Example: ~
> >
@ -1489,5 +1523,5 @@ FUNCTIONS *libmodal-lua-Vars.functions*
Return: ~ Return: ~
* A new `Var`. * A new `Var`.
============================================================================== ================================================================================
vim:tw=78:ts=4:ft=help:norl: vim:tw=80:ts=4:ft=help:norl:

Loading…
Cancel
Save