From d5e5597082f0a252703e9d8e94e20c18350f28a2 Mon Sep 17 00:00:00 2001 From: Guennadi Maximov C Date: Fri, 31 May 2024 02:06:50 -0600 Subject: [PATCH] chore: Update `README.md`. --- README.md | 39 ++++++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 62fe8c05..edd50b59 100644 --- a/README.md +++ b/README.md @@ -207,7 +207,7 @@ It can be found in | `is_fun` | Checks whether the input values are of `function` type.
By default it checks for a single value,
but can be told to check for multiple
by setting the 2nd param as `true`. | _Same as `is_nil`_. | `boolean` | | `is_tbl` | Checks whether the input values are of `table` type.
By default it checks for a single value,
but can be told to check for multiple
by setting the 2nd param as `true`. | _Same as `is_nil`._ | `boolean` | | `is_int` | Checks whether the input values are **integers**.
By default it checks for a single value,
but can be told to check for multiple
by setting the 2nd param as `true`. | _Same as `is_nil`._ | `boolean` | -| `empty` | If input is a string, checks for an empty string.
If input is number, checks for value `0`.
If input is table, checks for an empty table. | `v`: `string\|number\|table` | `boolean` | +| `empty` | If input is a string, checks for an empty string.
If input is number, checks for value `0`.
If input is table, checks for an empty table.
If other type return `true`. | `v`: `string\|number\|table` | `boolean` | @@ -274,7 +274,7 @@ and other fields corresponding to each parameter. --- Returns a `vim.keymap.set.Opts` table ---@param msg: string Defaults do `'Unnamed Key'` ---@param silent? boolean Defaults to `true` ----@param bufnr? integer Defaults to current buffer number +---@param bufnr? integer Not included in output table unless explicitly set ---@param noremap? boolean Defaults to `true` ---@param nowait? boolean Defaults to `true` ---@param expr? boolean Defaults to `false` @@ -307,13 +307,15 @@ maps.map.desc(msg, silent, noremap, nowait, expr)
-

maps.wk

+

+maps.wk +


WARNING: For the moment the API won't register a keymap without a description defined for such keymap -(A.K.A. the desc field in the keymap options). +(A.K.A. the desc field in the keymap options). I will try to correct for this behaviour later, but for documentation purposes I'm leaving this bug as an enforcer to keep keymaps documented. @@ -360,11 +362,11 @@ If you want to convert a keymap table, you must first structure it as follows: --- you'll have to define the buffer number externally if you use --- `User.maps.buf_map` ----@class RhsnOpts +---@class KeyRhsOpts ---@field [1] string|fun() The `rhs` for your keymap, i.e. what'll be executed ---@field [2]? vim.keymap.set.Opts See `|:h vim.keymap.set()|` for the `opts` field ----@alias KeyMapDict table A dict with the key as lhs and the value as the class above +---@alias KeyMapDict table A dict with the key as lhs and the value as the class above ---@type KeyMapDict local Keys = { @@ -380,8 +382,11 @@ and `WK.register()` respectively.
  • +
    -Example 1 + +Example 1 + ```lua --- Following the code above the examples... @@ -401,16 +406,22 @@ end
  • +
    +
  • +
    -Example 2 + +Example 2 + ```lua --- Following the code above the examples... if WK.available() then WK.register(WK.convert_dict(Keys), opts?) -- `opts` defaults to `{ mode = 'n' }` + -- Wk.register(WK.convert_dict(Keys), { mode = 'n' }) else for lhs, v in next, Keys do --- `v[1]` is `rhs` @@ -425,7 +436,11 @@ end
    -The `wk.register()` has two arguments: + +wk.register() has two arguments +: + +
    1. @@ -473,7 +488,6 @@ the which_key repository
    -
    You can also process group names the following way: @@ -498,6 +512,7 @@ local Names = { WK.register(Names, { mode = }) ``` +

    This API component is in early design so it will be simpler and more @@ -505,7 +520,9 @@ completein the future. --- -

    highlight

    +

    +highlight +

    This module provides utilities for setting highlights in an easier way. It can be found in [`user/highlight.lua`](/lua/user/highlight.lua).