Skip to content
This repository has been archived by the owner on Apr 24, 2022. It is now read-only.

Commit

Permalink
Misc README fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Iron-E committed Apr 26, 2020
1 parent d42bd92 commit 0352539
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ Use the built-in package manager or one of the various package managers.
| `modeCommands` | 1 | A dictionary of commands→strings to execute. |
| `commandList` | 2 | A list of the commands in a `modeCallback`. |

- Note that either `modeCallback` OR `modeCommands` may be specified, not both.
- Note that _either_ `modeCallback` _or_ `modeCommands` may be specified, __not both__.
- Note that `commandList` is an optional parameter.
- It is used as a completion source for when `modeCallback` is specified.
- Additionally, `commandList` is IGNORED when `modeCommands` is specified since completions can be created from the dictionary keys.
- Additionally, `commandList` is __ignored__ when `modeCommands` is specified since completions can be created from the dictionary keys.
- If `commandList` is not specified when `modeCallback` is, no completions will be provided for the prompt.

## Receiving Input
Expand Down Expand Up @@ -90,15 +90,15 @@ command! FooModeEnter call libmodal#Enter('FOO', funcref('s:FooMode'))
nnoremap <expr> <leader>n FooModeEnter
```

- Note the `funcref()` call. It must be there or else `libmodal#Enter` won't execute properly.
- Note the `funcref()` call. __It must be there__ or else `libmodal#Enter` won't execute properly.

### Key Combinations

While normally `libmodal` dictates that a user should define their own function for controlling a mode, there is a way to specify key combinations. If the second argument is set to a `modeCombos` dictionary, `libmodal#Enter` will automatically detect the caller's intent and pass control over to an auxilliary function built to handle pre-defined combos.

When providing `modeCombos`, it is important to note that one no longer has to receive input for themselves. Despite this, the unique variable (see `libmodal-receiving-input`) is still updated, and you can create a listener for it just like for any other variable.

- Note that |libmodal-exit-supression| is still compatable with defining key combinations.
- Note that `libmodal-exit-supression` is still compatable with defining key combinations.

Here is an example that shows how to create a dictionary that defines the following actions:

Expand Down Expand Up @@ -126,8 +126,8 @@ call libmodal#Enter('BAR', s:barModeCombos)

This allows `libmodal` to quickly determine which mappings are and are not part of the mode. Because of this method, modes with mappings that have similar beginnings are more efficient, and modes with more mappings get more benefit from the quick tree-like traversal.

- Note that |libmodal#Enter| will only parse a `modeCombos` dict once upon entrance.
- Changes to the mapping dictionary that may occur while in a mode are not reflected until the mode is entered again and the dictionary is re-parsed.
- Note that `libmodal#Enter` will only parse a `modeCombos` dict _once_ upon entrance.
- Changes to the mapping dictionary that may occur while in a mode _are not reflected_ until the mode is entered again and the dictionary is re-parsed.

### Exit Supression

Expand Down Expand Up @@ -180,7 +180,7 @@ call libmodal#Prompt('BAR', s:barModeCommands)
call libmodal#Prompt('BAR', funcref('s:BarMode'), s:barModeCommandList)
```

- Note that if you want to create commands with arguments, you will need to use a callback.
- Note that if you want to create commands with arguments, _you will need to use a callback_.

# Submodes

Expand Down

0 comments on commit 0352539

Please sign in to comment.