Skip to content

Commit f7a0ebc

Browse files
1024thmehalter
authored andcommitted
fix(mappings): add a note for overriding mapping
Related issue: AstroNvim/AstroNvim#2353 (comment)
1 parent 6ccf649 commit f7a0ebc

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/content/docs/recipes/mappings.mdx

+7-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ Mappings can be customized through [AstroCore](https://github.com/AstroNvim/astr
99

1010
These tables are a direct conversion to the `vim.keymap.set({mode}, {lhs}, {rhs}, {opts})` Lua API. The first key into the table is the `{mode}`, the second key into the table is the `{lhs}`, and the element there is the `{opts}` table with the `{rhs}` in the first key. Also AstroLSP supports adding a `cond` key which can dictate when the mapping should be attached (this is described in detail in the [AstroLSP plugin configuration documentation](https://github.com/AstroNvim/astrolsp#%EF%B8%8F-configuration)) Here is a simple plugin specification example of setting both core and LSP mappings:
1111

12+
:::note
13+
14+
If you want to override a default mapping, the key needs to exactly match (case sensitive) the existing definition in the table; otherwise, there is a race condition. AstroCore uses capital modifiers.
15+
16+
:::
17+
1218
```lua title="lua/plugins/mappings.lua"
1319
return {
1420
{
@@ -33,7 +39,7 @@ return {
3339
-- this is useful for naming menus
3440
["<Leader>b"] = { name = "Buffers" },
3541
-- quick save
36-
-- ["<C-s>"] = { ":w!<cr>", desc = "Save File" }, -- change description but the same command
42+
-- ["<C-S>"] = { ":w!<cr>", desc = "Save File" }, -- change description but the same command
3743
},
3844
t = {
3945
-- setting a mapping to false will disable it

0 commit comments

Comments
 (0)