Skip to content

Commit 4e1815c

Browse files
committed
doc: document multiple table levels and the shorthand
1 parent abdcc40 commit 4e1815c

1 file changed

Lines changed: 17 additions & 3 deletions

File tree

readme.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ This also deprecated the `clear_empty_lines` setting. You can replicate this
4848
behavior by setting a mapping to a function like this:
4949

5050
```lua
51-
-- `k` would be the second key of a mapping
51+
-- `k` would be the end key of a mapping
5252
k = function()
5353
vim.api.nvim_input("<esc>")
5454
local current_line = vim.api.nvim_get_current_line()
@@ -112,8 +112,8 @@ require("better_escape").setup {
112112
mappings = {
113113
-- mode = {
114114
-- firstkey = {
115-
-- secondkey = "Escape key", -- make a key press "Escape key"
116-
-- secondkey = false, -- disable a key
115+
-- endkey = "Escape key", -- make a key press "Escape key"
116+
-- endkey = false, -- disable a key
117117
-- },
118118
-- }
119119
}
@@ -134,6 +134,20 @@ mappings = {
134134
k = "<Esc>",
135135
j = "<Esc>",
136136
},
137+
-- you can also define mappings with this shorthand
138+
-- same as the example above, maps jk and jj to escape insert mode
139+
jk = "",
140+
jj = "",
141+
-- you can repeat this table pattern forever
142+
-- map jjks to do nothing
143+
j = {
144+
j = {
145+
k = "",
146+
},
147+
},
148+
-- you can also define mappings with this shorthand
149+
-- same as the example above, maps jjks to do nothing
150+
jjk = "",
137151
-- disable jj
138152
j = {
139153
j = false,

0 commit comments

Comments
 (0)