Improve README.md

This commit is contained in:
hrsh7th
2022-04-18 23:50:09 +09:00
parent b5433f901e
commit 2aa7eee28b
2 changed files with 18 additions and 4 deletions

View File

@@ -12,7 +12,7 @@ Readme!
2. This is my hobby project. You can support me via GitHub sponsors. 2. This is my hobby project. You can support me via GitHub sponsors.
3. Bug reports are welcome, but I might not fix if you don't provide a minimal reproduction configuration and steps. 3. Bug reports are welcome, but I might not fix if you don't provide a minimal reproduction configuration and steps.
4. The nvim-cmp documents is [here](./doc/cmp.txt). 4. The nvim-cmp documents is [here](./doc/cmp.txt).
5. The nvim-cmp is designed for `customization`! It's not designed for `works out of the box`.
Concept Concept

View File

@@ -231,11 +231,12 @@ Mapping *cmp-mapping*
The nvim-cmp's mapping mechanism is complex but flexible and user-friendly. The nvim-cmp's mapping mechanism is complex but flexible and user-friendly.
You can specify the mapping as function that receives the `fallback` function as arguments. You can specify the mapping function that receives the `fallback` function as arguments.
The `fallback` function can be used to call an existing mapping. The `fallback` function can be used to call an existing mapping.
For example, typical pair-wise plugins automatically defines a mapping for `<CR>` or `(`. For example, typical pair-wise plugins automatically define the mapping for `<CR>` or `(`.
The nvim-cmp will overwrite it but you can fallback to the original mapping via invoking the `fallback` function. The nvim-cmp might overwrite it via your specified mapping configuration.
But you can use existing mapping via invoking the `fallback` function.
> >
cmp.setup { cmp.setup {
mapping = { mapping = {
@@ -248,7 +249,20 @@ The nvim-cmp will overwrite it but you can fallback to the original mapping via
end end
} }
} }
< >
cmp.setup {
mapping = {
['<Tab>'] = function(fallback)
if cmp.visible() then
cmp.select_next_item()
else
fallback()
end
end
}
}
< <
And you can specify the mapping modes. And you can specify the mapping modes.
> >
cmp.setup { cmp.setup {