Skip to content

Commit

Permalink
Update "Disabling" recommendations to use Lua code.
Browse files Browse the repository at this point in the history
  • Loading branch information
echasnovski committed Feb 24, 2023
1 parent 22615a3 commit d79494d
Show file tree
Hide file tree
Showing 47 changed files with 141 additions and 111 deletions.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -348,16 +348,26 @@ For video demo and quick overview see its [README](readmes/mini-trailspace.md).
## General principles

- **Design**. Each module is designed to solve a particular problem targeting balance between feature-richness (handling as many edge-cases as possible) and simplicity of implementation/support. Granted, not all of them ended up with the same balance, but it is the goal nevertheless.

- **Independence**. Modules are independent of each other and can be run without external dependencies. Although some of them may need dependencies for full experience.

- **Structure**. Each module is a submodule for a placeholder "mini" module. So, for example, "surround" module should be referred to as "mini.surround". As later will be explained, this plugin can also be referred to as "MiniSurround".

- **Setup**:
- Each module (if needed) should be setup separately with `require(<name of module>).setup({})` (possibly replace {} with your config table or omit to use defaults). You can supply only values which differ from defaults, which will be used for the rest ones.

- Call to module's `setup()` always creates a global Lua object with coherent camel-case name: `require('mini.surround').setup()` creates `_G.MiniSurround`. This allows for a simpler usage of plugin functionality: instead of `require('mini.surround')` use `MiniSurround` (or manually `:lua MiniSurround.*` in command line); available from `v:lua` like `v:lua.MiniSurround`. Considering this, "module" and "Lua object" names can be used interchangeably: 'mini.surround' and 'MiniSurround' will mean the same thing.

- Each supplied `config` table is stored in `config` field of global object. Like `MiniSurround.config`.

- Values of `config`, which affect runtime activity, can be changed on the fly to have effect. For example, `MiniSurround.config.n_lines` can be changed during runtime; but changing `MiniSurround.config.mappings` won't have any effect (as mappings are created once during `setup()`).

- **Buffer local configuration**. Each module can be additionally configured to use certain runtime config settings locally to buffer. See `mini.nvim-buffer-local-config` section in help file for more information.
- **Disabling**. Each module's core functionality can be disabled globally or locally to buffer by creating appropriate global or buffer-scoped variables equal to `v:true`. See `mini.nvim-disabling-recipes` section in help file for common recipes.

- **Disabling**. Each module's core functionality can be disabled globally or locally to buffer. See "Disabling" section in module's help page for more details. See `mini.nvim-disabling-recipes` section in main help file for common recipes.

- **Highlight groups**. Appearance of module's output is controlled by certain highlight group (see `:h highlight-groups`). To customize them, use `highlight` command. **Note**: currently not many Neovim themes support this plugin's highlight groups; fixing this situation is highly appreciated. To see a more calibrated look, use MiniBase16 or plugin's colorscheme `minischeme`.

- **Stability**. Each module upon release is considered to be relatively stable: both in terms of setup and functionality. Any non-bugfix backward-incompatible change will be released gradually as much as possible.

## Plugin colorschemes
Expand Down
4 changes: 2 additions & 2 deletions doc/mini-ai.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ as `MiniAi.config`. See |mini.nvim-buffer-local-config| for more details.

# Disabling~

To disable, set `g:miniai_disable` (globally) or `b:miniai_disable`
(for a buffer) to `v:true`. Considering high number of different scenarios
To disable, set `vim.g.miniai_disable` (globally) or `vim.b.miniai_disable`
(for a buffer) to `true`. Considering high number of different scenarios
and customization intentions, writing exact rules for disabling module's
functionality is left to user. See |mini.nvim-disabling-recipes| for common
recipes.
Expand Down
4 changes: 2 additions & 2 deletions doc/mini-align.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ as `MiniAlign.config`. See |mini.nvim-buffer-local-config| for more details.

# Disabling~

To disable, set `g:minialign_disable` (globally) or `b:minialign_disable`
(for a buffer) to `v:true`. Considering high number of different scenarios
To disable, set `vim.g.minialign_disable` (globally) or `vim.b.minialign_disable`
(for a buffer) to `true`. Considering high number of different scenarios
and customization intentions, writing exact rules for disabling module's
functionality is left to user. See |mini.nvim-disabling-recipes| for common
recipes.
Expand Down
10 changes: 5 additions & 5 deletions doc/mini-animate.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ To change any highlight group, modify it directly with |:highlight|.

# Disabling~

To disable, set `g:minianimate_disable` (globally) or `b:minianimate_disable`
(for a buffer) to `v:true`. Considering high number of different scenarios
and customization intentions, writing exact rules for disabling module's
functionality is left to user. See |mini.nvim-disabling-recipes| for common
recipes.
To disable, set `vim.g.minianimate_disable` (globally) or
`vim.b.minianimate_disable` (for a buffer) to `true`. Considering high
number of different scenarios and customization intentions, writing exact
rules for disabling module's functionality is left to user. See
|mini.nvim-disabling-recipes| for common recipes.

------------------------------------------------------------------------------
*MiniAnimate.setup()*
Expand Down
10 changes: 5 additions & 5 deletions doc/mini-bracketed.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ as `MiniBracketed.config`. See |mini.nvim-buffer-local-config| for more details.

# Disabling~

To disable, set `g:minibracketed_disable` (globally) or `b:minibracketed_disable`
(for a buffer) to `v:true`. Considering high number of different scenarios
and customization intentions, writing exact rules for disabling module's
functionality is left to user. See |mini.nvim-disabling-recipes| for common
recipes.
To disable, set `vim.g.minibracketed_disable` (globally) or
`vim.b.minibracketed_disable` (for a buffer) to `true`. Considering high
number of different scenarios and customization intentions, writing exact
rules for disabling module's functionality is left to user. See
|mini.nvim-disabling-recipes| for common recipes.

------------------------------------------------------------------------------
*MiniBracketed.setup()*
Expand Down
4 changes: 2 additions & 2 deletions doc/mini-bufremove.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ will have no effect here.

# Disabling~

To disable core functionality, set `g:minibufremove_disable` (globally) or
`b:minibufremove_disable` (for a buffer) to `v:true`. Considering high
To disable core functionality, set `vim.g.minibufremove_disable` (globally) or
`vim.b.minibufremove_disable` (for a buffer) to `true`. Considering high
number of different scenarios and customization intentions, writing exact
rules for disabling module's functionality is left to user. See
|mini.nvim-disabling-recipes| for common recipes.
Expand Down
4 changes: 2 additions & 2 deletions doc/mini-comment.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ You can override runtime config settings locally to buffer inside

# Disabling~

To disable core functionality, set `g:minicomment_disable` (globally) or
`b:minicomment_disable` (for a buffer) to `v:true`. Considering high number
To disable core functionality, set `vim.g.minicomment_disable` (globally) or
`vim.b.minicomment_disable` (for a buffer) to `true`. Considering high number
of different scenarios and customization intentions, writing exact rules
for disabling module's functionality is left to user. See
|mini.nvim-disabling-recipes| for common recipes.
Expand Down
4 changes: 2 additions & 2 deletions doc/mini-completion.txt
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ To change any highlight group, modify it directly with |:highlight|.

# Disabling~

To disable, set `g:minicompletion_disable` (globally) or
`b:minicompletion_disable` (for a buffer) to `v:true`. Considering high
To disable, set `vim.g.minicompletion_disable` (globally) or
`vim.b.minicompletion_disable` (for a buffer) to `true`. Considering high
number of different scenarios and customization intentions, writing exact
rules for disabling module's functionality is left to user. See
|mini.nvim-disabling-recipes| for common recipes.
Expand Down
4 changes: 2 additions & 2 deletions doc/mini-cursorword.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ To change any highlight group, modify it directly with |:highlight|.

# Disabling~

To disable core functionality, set `g:minicursorword_disable` (globally) or
`b:minicursorword_disable` (for a buffer) to `v:true`. Considering high
To disable core functionality, set `vim.g.minicursorword_disable` (globally) or
`vim.b.minicursorword_disable` (for a buffer) to `true`. Considering high
number of different scenarios and customization intentions, writing exact
rules for disabling module's functionality is left to user. See
|mini.nvim-disabling-recipes| for common recipes. Note: after disabling
Expand Down
4 changes: 2 additions & 2 deletions doc/mini-doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ See |mini.nvim-buffer-local-config| for more details.

# Disabling~

To disable, set `g:minidoc_disable` (globally) or `b:minidoc_disable` (for
a buffer) to `v:true`. Considering high number of different scenarios and
To disable, set `vim.g.minidoc_disable` (globally) or `vim.b.minidoc_disable`
(for a buffer) to `true`. Considering high number of different scenarios and
customization intentions, writing exact rules for disabling module's
functionality is left to user. See |mini.nvim-disabling-recipes| for common
recipes.
Expand Down
4 changes: 2 additions & 2 deletions doc/mini-indentscope.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ To change any highlight group, modify it directly with |:highlight|.

# Disabling~

To disable autodrawing, set `g:miniindentscope_disable` (globally) or
`b:miniindentscope_disable` (for a buffer) to `v:true`. Considering high
To disable autodrawing, set `vim.g.miniindentscope_disable` (globally) or
`vim.b.miniindentscope_disable` (for a buffer) to `true`. Considering high
number of different scenarios and customization intentions, writing exact
rules for disabling module's functionality is left to user. See
|mini.nvim-disabling-recipes| for common recipes.
Expand Down
4 changes: 2 additions & 2 deletions doc/mini-jump.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ To change any highlight group, modify it directly with |:highlight|.

# Disabling~

To disable core functionality, set `g:minijump_disable` (globally) or
`b:minijump_disable` (for a buffer) to `v:true`. Considering high number of
To disable core functionality, set `vim.g.minijump_disable` (globally) or
`vim.b.minijump_disable` (for a buffer) to `true`. Considering high number of
different scenarios and customization intentions, writing exact rules for
disabling module's functionality is left to user. See
|mini.nvim-disabling-recipes| for common recipes.
Expand Down
10 changes: 5 additions & 5 deletions doc/mini-jump2d.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ To change any highlight group, modify it directly with |:highlight|.

# Disabling~

To disable, set `g:minijump2d_disable` (globally) or `b:minijump2d_disable`
(for a buffer) to `v:true`. Considering high number of different scenarios
and customization intentions, writing exact rules for disabling module's
functionality is left to user. See |mini.nvim-disabling-recipes| for common
recipes.
To disable, set `vim.g.minijump2d_disable` (globally) or
`vim.b.minijump2d_disable` (for a buffer) to `true`. Considering high
number of different scenarios and customization intentions, writing exact
rules for disabling module's functionality is left to user. See
|mini.nvim-disabling-recipes| for common recipes.

------------------------------------------------------------------------------
*MiniJump2d.setup()*
Expand Down
4 changes: 2 additions & 2 deletions doc/mini-map.txt
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ To change any highlight group, modify it directly with |:highlight|.

# Disabling~

To disable, set `g:minimap_disable` (globally) or `b:minimap_disable`
(for a buffer) to `v:true`. Considering high number of different scenarios
To disable, set `vim.g.minimap_disable` (globally) or `vim.b.minimap_disable`
(for a buffer) to `true`. Considering high number of different scenarios
and customization intentions, writing exact rules for disabling module's
functionality is left to user. See |mini.nvim-disabling-recipes| for common
recipes.
Expand Down
4 changes: 2 additions & 2 deletions doc/mini-move.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ as `MiniMove.config`. See |mini.nvim-buffer-local-config| for more details.

# Disabling~

To disable, set `g:minimove_disable` (globally) or `b:minimove_disable`
(for a buffer) to `v:true`. Considering high number of different scenarios
To disable, set `vim.g.minimove_disable` (globally) or `vim.b.minimove_disable`
(for a buffer) to `true`. Considering high number of different scenarios
and customization intentions, writing exact rules for disabling module's
functionality is left to user. See |mini.nvim-disabling-recipes| for common
recipes.
Expand Down
4 changes: 2 additions & 2 deletions doc/mini-pairs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ will have no effect here.

# Disabling~

To disable, set `g:minipairs_disable` (globally) or `b:minipairs_disable`
(for a buffer) to `v:true`. Considering high number of different scenarios
To disable, set `vim.g.minipairs_disable` (globally) or `vim.b.minipairs_disable`
(for a buffer) to `true`. Considering high number of different scenarios
and customization intentions, writing exact rules for disabling module's
functionality is left to user. See |mini.nvim-disabling-recipes| for common
recipes.
Expand Down
4 changes: 2 additions & 2 deletions doc/mini-sessions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ This module doesn't benefit from buffer local configuration, so using

# Disabling~

To disable core functionality, set `g:minisessions_disable` (globally) or
`b:minisessions_disable` (for a buffer) to `v:true`. Considering high
To disable core functionality, set `vim.g.minisessions_disable` (globally) or
`vim.b.minisessions_disable` (for a buffer) to `true`. Considering high
number of different scenarios and customization intentions, writing exact
rules for disabling module's functionality is left to user. See
|mini.nvim-disabling-recipes| for common recipes.
Expand Down
4 changes: 2 additions & 2 deletions doc/mini-starter.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ To change any highlight group, modify it directly with |:highlight|.

# Disabling~

To disable core functionality, set `g:ministarter_disable` (globally) or
`b:ministarter_disable` (for a buffer) to `v:true`. Considering high number
To disable core functionality, set `vim.g.ministarter_disable` (globally) or
`vim.b.ministarter_disable` (for a buffer) to `true`. Considering high number
of different scenarios and customization intentions, writing exact rules
for disabling module's functionality is left to user. See
|mini.nvim-disabling-recipes| for common recipes.
Expand Down
4 changes: 2 additions & 2 deletions doc/mini-statusline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ To change any highlight group, modify it directly with |:highlight|.

# Disabling~

To disable (show empty statusline), set `g:ministatusline_disable`
(globally) or `b:ministatusline_disable` (for a buffer) to `v:true`.
To disable (show empty statusline), set `vim.g.ministatusline_disable`
(globally) or `vim.b.ministatusline_disable` (for a buffer) to `true`.
Considering high number of different scenarios and customization
intentions, writing exact rules for disabling module's functionality is
left to user. See |mini.nvim-disabling-recipes| for common recipes.
Expand Down
4 changes: 2 additions & 2 deletions doc/mini-surround.txt
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ To change any highlight group, modify it directly with |:highlight|.

# Disabling~

To disable, set `g:minisurround_disable` (globally) or
`b:minisurround_disable` (for a buffer) to `v:true`. Considering high
To disable, set `vim.g.minisurround_disable` (globally) or
`vim.b.minisurround_disable` (for a buffer) to `true`. Considering high
number of different scenarios and customization intentions, writing exact
rules for disabling module's functionality is left to user. See
|mini.nvim-disabling-recipes| for common recipes.
Expand Down
4 changes: 2 additions & 2 deletions doc/mini-tabline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ To change any highlight group, modify it directly with |:highlight|.

# Disabling~

To disable (show empty tabline), set `g:minitabline_disable` (globally) or
`b:minitabline_disable` (for a buffer) to `v:true`. Considering high number
To disable (show empty tabline), set `vim.g.minitabline_disable` (globally) or
`vim.b.minitabline_disable` (for a buffer) to `true`. Considering high number
of different scenarios and customization intentions, writing exact rules
for disabling module's functionality is left to user. See
|mini.nvim-disabling-recipes| for common recipes. Note: after disabling,
Expand Down
4 changes: 2 additions & 2 deletions doc/mini-test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ To change any highlight group, modify it directly with |:highlight|.

# Disabling~

To disable, set `g:minitest_disable` (globally) or `b:minitest_disable`
(for a buffer) to `v:true`. Considering high number of different scenarios
To disable, set `vim.g.minitest_disable` (globally) or `vim.b.minitest_disable`
(for a buffer) to `true`. Considering high number of different scenarios
and customization intentions, writing exact rules for disabling module's
functionality is left to user. See |mini.nvim-disabling-recipes| for common
recipes.
Expand Down
4 changes: 2 additions & 2 deletions doc/mini-trailspace.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ To change any highlight group, modify it directly with |:highlight|.

# Disabling~

To disable, set `g:minitrailspace_disable` (globally) or
`b:minitrailspace_disable` (for a buffer) to `v:true`. Considering high
To disable, set `vim.g.minitrailspace_disable` (globally) or
`vim.b.minitrailspace_disable` (for a buffer) to `true`. Considering high
number of different scenarios and customization intentions, writing exact
rules for disabling module's functionality is left to user. See
|mini.nvim-disabling-recipes| for common recipes. Note: after disabling
Expand Down
14 changes: 12 additions & 2 deletions doc/mini.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,23 @@ Table of contents:
balance between feature-richness (handling as many edge-cases as
possible) and simplicity of implementation/support. Granted, not all of
them ended up with the same balance, but it is the goal nevertheless.

- <Independence>. Modules are independent of each other and can be run
without external dependencies. Although some of them may need
dependencies for full experience.

- <Structure>. Each module is a submodule for a placeholder "mini" module. So,
for example, "surround" module should be referred to as "mini.surround".
As later will be explained, this plugin can also be referred to
as "MiniSurround".

- <Setup>:
- Each module (if needed) should be setup separately with
`require(<name of module>).setup({})`
(possibly replace {} with your config table or omit to use defaults).
You can supply only values which differ from defaults, which will be
used for the rest ones.

- Call to module's `setup()` always creates a global Lua object with
coherent camel-case name: `require('mini.surround').setup()` creates
`_G.MiniSurround`. This allows for a simpler usage of plugin
Expand All @@ -69,24 +73,30 @@ Table of contents:
available from `v:lua` like `v:lua.MiniSurround`. Considering this,
"module" and "Lua object" names can be used interchangeably:
'mini.surround' and 'MiniSurround' will mean the same thing.

- Each supplied `config` table (after extending with default values) is
stored in `config` field of global object. Like `MiniSurround.config`.

- Values of `config`, which affect runtime activity, can be changed on
the fly to have effect. For example, `MiniSurround.config.n_lines`
can be changed during runtime; but changing
`MiniSurround.config.mappings` won't have any effect (as mappings are
created once during `setup()`).

- <Buffer local configuration>. Each module can be additionally configured
to use certain runtime config settings locally to buffer. See
|mini.nvim-buffer-local-config| for more information.

- <Disabling>. Each module's core functionality can be disabled globally or
buffer-locally by creating appropriate global or buffer-scoped variables
equal to |v:true|. See |mini.nvim-disabling-recipes| for common recipes.
locally to buffer. See "Disabling" section in module's help page for more
details. See |mini.nvim-disabling-recipes| for common recipes.

- <Highlight groups>. Appearance of module's output is controlled by
certain highlight group (see |highlight-groups|). To customize them, use
|highlight| command. Note: currently not many Neovim themes support this
plugin's highlight groups; fixing this situation is highly appreciated.
To see a more calibrated look, use |MiniBase16| or plugin's colorschemes.

- <Stability>. Each module upon release is considered to be relatively
stable: both in terms of setup and functionality. Any
non-bugfix backward-incompatible change will be released gradually as
Expand Down
Loading

0 comments on commit d79494d

Please sign in to comment.