2021-06-29 20:01:05 +02:00
# nvim-cmp
2021-08-03 18:07:12 +02:00
2021-08-27 04:13:13 +02:00
A completion engine plugin for neovim written in Lua.
Completion sources are installed from external repositories and "sourced".
2021-08-03 18:07:12 +02:00
2023-05-25 15:44:18 +02:00
https://github.com/hrsh7th/nvim-cmp/assets/22756295/afa70011-9121-4e42-aedd-0153b630eeab
2021-10-11 05:15:16 +02:00
2021-10-08 11:27:33 +02:00
Readme!
====================
2022-11-16 06:22:24 +01:00
1. There is a GitHub issue that documents [breaking changes ](https://github.com/hrsh7th/nvim-cmp/issues/231 ) for nvim-cmp. Subscribe to the issue to be notified of upcoming breaking changes.
2021-10-10 08:11:54 +02:00
2. This is my hobby project. You can support me via GitHub sponsors.
2022-06-09 09:41:59 +02:00
3. Bug reports are welcome, but don't expect a fix unless you provide minimal configuration and steps to reproduce your issue.
2023-02-14 15:39:56 +01:00
4. The `cmp.mapping.preset.*` is pre-defined configuration that aims to mimic neovim's native like behavior. It can be changed without announcement. Please manage key-mapping by yourself.
2021-08-03 18:07:12 +02:00
2021-08-24 15:43:02 +02:00
Concept
2021-08-15 18:11:44 +02:00
====================
2021-12-18 16:43:16 +01:00
- Full support for LSP completion related capabilities
- Powerful customizability via Lua functions
2022-06-09 09:41:59 +02:00
- Smart handling of key mappings
2021-10-12 04:11:08 +02:00
- No flicker
2021-12-18 16:43:16 +01:00
2021-08-15 18:11:44 +02:00
2021-08-11 14:04:27 +02:00
Setup
2021-08-08 10:54:58 +02:00
====================
2021-08-03 18:07:12 +02:00
2021-09-17 11:49:56 +02:00
### Recommended Configuration
2021-08-09 06:36:34 +02:00
2022-06-09 09:41:59 +02:00
This example configuration uses `vim-plug` as the plugin manager and `vim-vsnip` as a snippet plugin.
2021-08-03 18:07:12 +02:00
2021-12-07 10:01:08 +01:00
```lua
2021-09-17 11:49:56 +02:00
call plug#begin(s:plug_dir)
Plug 'neovim/nvim-lspconfig'
Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'hrsh7th/cmp-buffer'
2021-10-27 05:38:46 +02:00
Plug 'hrsh7th/cmp-path'
Plug 'hrsh7th/cmp-cmdline'
2021-08-08 10:54:58 +02:00
Plug 'hrsh7th/nvim-cmp'
2021-08-29 07:01:51 +02:00
2021-10-22 11:23:49 +02:00
" For vsnip users.
2021-09-17 11:49:56 +02:00
Plug 'hrsh7th/cmp-vsnip'
2021-08-29 07:01:51 +02:00
Plug 'hrsh7th/vim-vsnip'
2021-10-22 11:23:49 +02:00
" For luasnip users.
2021-09-17 11:49:56 +02:00
" Plug 'L3MON4D3/LuaSnip'
" Plug 'saadparwaiz1/cmp_luasnip'
2021-08-27 04:13:13 +02:00
2021-10-22 11:23:49 +02:00
" For ultisnips users.
2021-09-17 11:49:56 +02:00
" Plug 'SirVer/ultisnips'
" Plug 'quangnguyen30192/cmp-nvim-ultisnips'
2021-09-01 06:00:24 +02:00
2021-10-22 11:23:49 +02:00
" For snippy users.
" Plug 'dcampos/nvim-snippy'
" Plug 'dcampos/cmp-snippy'
2021-09-17 11:49:56 +02:00
call plug#end()
2021-08-29 07:01:51 +02:00
2021-08-27 04:13:13 +02:00
lua < < EOF
2022-09-02 04:29:33 +02:00
-- Set up nvim-cmp.
2021-08-29 07:01:51 +02:00
local cmp = require'cmp'
2021-09-17 11:49:56 +02:00
2021-08-29 07:01:51 +02:00
cmp.setup({
snippet = {
2021-10-30 11:42:37 +02:00
-- REQUIRED - you must specify a snippet engine
2021-08-29 07:01:51 +02:00
expand = function(args)
2021-10-22 11:23:49 +02:00
vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
-- require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
2021-12-18 16:43:16 +01:00
-- require('snippy').expand_snippet(args.body) -- For `snippy` users.
2021-10-22 11:23:49 +02:00
-- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
2024-03-21 19:04:54 +01:00
-- vim.snippet.expand(args.body) -- For native neovim snippets (Neovim v0.10+)
2021-08-29 07:01:51 +02:00
end,
},
dev (#813)
* feat: completion menu borders (#472)
* feat(custom_entries_view): pass custom border option
* feat(window): calculate offset needed for borders
* fix(window): adjust window height w/ too many results
* fix(window): center scrollbar with borders
* ref(custom_entries_view): use `FloatBorder` for borders
* fix(window): offset at bottom of window
* ref(window): move height adjustment to more logical place
* fix(window): improve popup placement
* fix(window): `border_offset` always `0` first time
* feat(window): support compact scrollbar with border
* fix(window): completion popup on cursorline
* perf(window): simplify offset calculation
String indexing will result in the same thing as if I gated it behind
`type()` calls here.
* docs(window): add `border` to `cmp.WindowStyle`
* docs(window): correct `border_offset_scrollbar`
* perf(window): calulated row -> `screenrow`
This will also be more accurate since it accounts for wrapped lines, as
well as buffers.
* fix(window): edge case with multiple splits
* ref(winhighlight): don't specify defaults by default
`NormalFloat:NormalFloat` isn't needed, since `NormalFloat` defaults to
`NormalFloat`. As for `FloatBorder`, that should be set to `Floatborder`
rather than `NormalFloat` or else you get unintended artifacts on the
edges of borders.
* fix(window): popup covers cursor when scrollbar disappears
* ref(window): calc `border_offset_col` on `set_style`
* perf(window): remove unecessary `col` calculation
Taking it out didn't change anything about the popup behavior.
* feat: add `CmpItemMenuThumb` group
* feat(window): improve scrollbar appearance
* chore(window): remove references to unused property
* docs: document new option `thin_scrollbar`
* ref(plugin): remove background from `thin_scrollbar`
* feat(view): pass `thin_scrollbar` option to window
* feat(window): gate new `thin_scrollbar` behind option
* fix(window): cmdline bugging out
* fix(cmp): docs_view pops up overlapped when using borders
This is related to 1cfe2f7dfdd877b54c0f4b0f9a15f525e7a3ea01. The
calculation for how the popup position is calculated was changed, and
so it needed to be reworked to include borders in order to be able to
work.
* ref: `thin_scrollbar` flag -> `scrollbar` option
This change allows users to define which character they will use for
their scrollbar.
* fix(window): use `scrollbar` setting for scrollbar character
Thanks @Astrantia for pointing this one out.
* docs(README): add completion appearance options to FAQ
* fix(): account for `border_offset_row` with `has_bottom_space`
* style(custom_entries_view): group offset with `row`/`col`
* fix(window): scrollbar at full view height
Because the `bar_height` variable must be whole number, and must be rounded up
from a percent, there is a change that we will end up with the maximum
height as a number.
For example, `info.height` = 24 and `total` = 25.
* feat(window): allow scrollbar to be disabled
* fix(window): scrollbar size < 1
* ref(cmp): move border logic to `window.info`
* ref!: window highlighting based on borders
BREAKING CHANGE: `documentation.winhighlight` does not determine the
highlighting of the `documentation` view— `CmpWindow`
or `CmpBorderedWindow` depending on whether it has a
border.
* ref!: float appearance opts -> `cmp.setup.window`
`cmp.setup.completion.border` and `.scrollbar` were both moved to
`cmp.setup.window.completion.border` and `.scrollbar`
BREAKING CHANGE: `cmp.setup.documentation` has been moved to
`cmp.window.documentation`, as all of the pertaining
options were cosmetic.
TODO: document the change
* fix(window): attempt to get scrollbar's border
* fix(cmp): restore `view.menu.hl_group`
* fix(window): wrong scrollbar position
* ref: get default `CmpItemMenu` from border existence
* chore(cmp): remove old PR comments
* fix(window): scrollbar sometimes too big
* fix(window): docs far away with complete menu scrollbar
* perf(docs_view): reuse `border_width` value
* rev(cmp): restore `CmpItemMenu`
* ref(cmp): distinguish between `ScrollBar` and `ScrollThumb`
* fix(plugin): consistently refer to `Thumb` as `Thumb`
* rev(window): `Pmenu`-style scrollbar when no border
* fix(window): docs_view size wrong when first shown
* fix(window): docs_view scrollbar not responding to size
* fix(window): scrollbar sometimes to small, take 2
* fix(window): scrollbar bg not hiding
* ref(docs_view): put docs closer to completion menu
* fix(window): scrollbar position wrong with right border
* ref(config): add default border to documentation
* fix(window): scrollbar too close without border
* ref(plugin): link `CmpWindow` to `Pmenu`
I set `CmpWindow` to `NormalFloat`, because that is what you would
expect a floating window to use for a highlight group. However at
request I changed it to `Pmenu`.
* ref(plugin): link `CmpWindowBorder` to `CmpWindow`
* fix(window): scrollbar following thumb while scrolling
* ref: add more highlight groups
There just weren't enough highlight groups to satisfy the demands of the
project. If you change `CmpWindow` to `Pmenu`, then the `docs_view`
becomes `Pmenu` as well when on `main` it is `NormalFloat`.
* fix(window): scrollbar overlapping `docs_view` by default
* ref: remove `Bordered` highlight variants
* ref(utils): extract whitespace check to func
* feat: `window.completion.zindex` setting
* ref: `maxwidth|height` -> `max_`
* ref: simplify highlight groups
* feat: `window.*.winhighlight` setting
* ref(utils): `is_whitespace_char` -> `is_visible`
As hrsh7th noted, `''` is not a whitespace character. Yet, it is
necessary to group `''` and `' '` together for certain border behaviors
that are based on visibility. Thus I have renamed the function
* feat: specify `window.*.winhighlight` for un/bordered
* fix(custom_entries_view): set `winhighlight` on `open`
* ref: remove `Cmp*Scroll*` variants
There's no way for `window` to know which kind of window it is drawing a
scrollbar on. Simpler to just have one kind of scrollbar
* feat: distinguish between bordered and unbordered
* ref(cmp): `is_visible` -> `is_invisible`
That's what the function was checking for.
* fix(default): mislabeling of `default` and `bordered`
* chore: rebase fixup
* Change default highlight
* Add misc.rep
* Fix left-side docs_view with scrollbar
* Fix scrollbar
* Fix sbar/thumb win
Improve highlights
* Remove scrollbar cutomization for now
* Remove scrollbar option
* Simplify implementation
* Fix doc width
* Fix outdated docs
* Add comments
* Fix configuration schema
* fmt
* Fix for lint
Co-authored-by: Iron-E <36409591+Iron-E@users.noreply.github.com>
Co-authored-by: hrsh7th <>
2022-04-13 16:51:55 +02:00
window = {
-- completion = cmp.config.window.bordered(),
-- documentation = cmp.config.window.bordered(),
},
2022-04-13 17:10:33 +02:00
mapping = cmp.mapping.preset.insert({
['< C-b > '] = cmp.mapping.scroll_docs(-4),
['< C-f > '] = cmp.mapping.scroll_docs(4),
['< C-Space > '] = cmp.mapping.complete(),
['< C-e > '] = cmp.mapping.abort(),
2021-12-18 16:43:16 +01:00
['< CR > '] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
2022-04-13 17:10:33 +02:00
}),
2021-10-22 11:23:49 +02:00
sources = cmp.config.sources({
2021-09-17 11:49:56 +02:00
{ name = 'nvim_lsp' },
2021-10-22 11:23:49 +02:00
{ name = 'vsnip' }, -- For vsnip users.
-- { name = 'luasnip' }, -- For luasnip users.
-- { name = 'ultisnips' }, -- For ultisnips users.
-- { name = 'snippy' }, -- For snippy users.
}, {
2021-09-17 11:49:56 +02:00
{ name = 'buffer' },
2021-10-22 11:23:49 +02:00
})
2021-08-29 07:01:51 +02:00
})
2021-09-17 11:49:56 +02:00
2024-05-08 11:33:32 +02:00
-- To use git you need to install the plugin petertriho/cmp-git and uncomment lines below
2022-02-11 07:20:24 +01:00
-- Set configuration for specific filetype.
2024-05-08 11:33:32 +02:00
--[[ cmp.setup.filetype('gitcommit', {
2022-02-11 07:20:24 +01:00
sources = cmp.config.sources({
2024-05-08 11:33:32 +02:00
{ name = 'git' },
2022-02-11 07:20:24 +01:00
}, {
{ name = 'buffer' },
})
2024-05-08 11:33:32 +02:00
})
require("cmp_git").setup() ]]--
2022-02-11 07:20:24 +01:00
2022-09-24 05:38:21 +02:00
-- Use buffer source for `/` and `?` (if you enabled `native_menu` , this won't work anymore).
2022-09-26 04:51:01 +02:00
cmp.setup.cmdline({ '/', '?' }, {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = 'buffer' }
}
})
2021-10-27 05:38:46 +02:00
2021-11-02 09:43:46 +01:00
-- Use cmdline & path source for ':' (if you enabled `native_menu` , this won't work anymore).
2021-10-27 05:38:46 +02:00
cmp.setup.cmdline(':', {
2022-04-13 17:10:33 +02:00
mapping = cmp.mapping.preset.cmdline(),
2021-10-27 05:38:46 +02:00
sources = cmp.config.sources({
{ name = 'path' }
}, {
{ name = 'cmdline' }
2024-03-21 19:00:36 +01:00
}),
matching = { disallow_symbol_nonprefix_matching = false }
2021-10-27 05:38:46 +02:00
})
2022-09-02 04:29:33 +02:00
-- Set up lspconfig.
2022-10-16 10:11:40 +02:00
local capabilities = require('cmp_nvim_lsp').default_capabilities()
2021-11-02 09:43:46 +01:00
-- Replace < YOUR_LSP_SERVER > with each lsp server you've enabled.
require('lspconfig')['< YOUR_LSP_SERVER > '].setup {
2021-10-22 11:23:49 +02:00
capabilities = capabilities
2021-09-17 11:49:56 +02:00
}
2021-08-27 04:13:13 +02:00
EOF
```
2021-08-15 18:20:54 +02:00
dev (#813)
* feat: completion menu borders (#472)
* feat(custom_entries_view): pass custom border option
* feat(window): calculate offset needed for borders
* fix(window): adjust window height w/ too many results
* fix(window): center scrollbar with borders
* ref(custom_entries_view): use `FloatBorder` for borders
* fix(window): offset at bottom of window
* ref(window): move height adjustment to more logical place
* fix(window): improve popup placement
* fix(window): `border_offset` always `0` first time
* feat(window): support compact scrollbar with border
* fix(window): completion popup on cursorline
* perf(window): simplify offset calculation
String indexing will result in the same thing as if I gated it behind
`type()` calls here.
* docs(window): add `border` to `cmp.WindowStyle`
* docs(window): correct `border_offset_scrollbar`
* perf(window): calulated row -> `screenrow`
This will also be more accurate since it accounts for wrapped lines, as
well as buffers.
* fix(window): edge case with multiple splits
* ref(winhighlight): don't specify defaults by default
`NormalFloat:NormalFloat` isn't needed, since `NormalFloat` defaults to
`NormalFloat`. As for `FloatBorder`, that should be set to `Floatborder`
rather than `NormalFloat` or else you get unintended artifacts on the
edges of borders.
* fix(window): popup covers cursor when scrollbar disappears
* ref(window): calc `border_offset_col` on `set_style`
* perf(window): remove unecessary `col` calculation
Taking it out didn't change anything about the popup behavior.
* feat: add `CmpItemMenuThumb` group
* feat(window): improve scrollbar appearance
* chore(window): remove references to unused property
* docs: document new option `thin_scrollbar`
* ref(plugin): remove background from `thin_scrollbar`
* feat(view): pass `thin_scrollbar` option to window
* feat(window): gate new `thin_scrollbar` behind option
* fix(window): cmdline bugging out
* fix(cmp): docs_view pops up overlapped when using borders
This is related to 1cfe2f7dfdd877b54c0f4b0f9a15f525e7a3ea01. The
calculation for how the popup position is calculated was changed, and
so it needed to be reworked to include borders in order to be able to
work.
* ref: `thin_scrollbar` flag -> `scrollbar` option
This change allows users to define which character they will use for
their scrollbar.
* fix(window): use `scrollbar` setting for scrollbar character
Thanks @Astrantia for pointing this one out.
* docs(README): add completion appearance options to FAQ
* fix(): account for `border_offset_row` with `has_bottom_space`
* style(custom_entries_view): group offset with `row`/`col`
* fix(window): scrollbar at full view height
Because the `bar_height` variable must be whole number, and must be rounded up
from a percent, there is a change that we will end up with the maximum
height as a number.
For example, `info.height` = 24 and `total` = 25.
* feat(window): allow scrollbar to be disabled
* fix(window): scrollbar size < 1
* ref(cmp): move border logic to `window.info`
* ref!: window highlighting based on borders
BREAKING CHANGE: `documentation.winhighlight` does not determine the
highlighting of the `documentation` view— `CmpWindow`
or `CmpBorderedWindow` depending on whether it has a
border.
* ref!: float appearance opts -> `cmp.setup.window`
`cmp.setup.completion.border` and `.scrollbar` were both moved to
`cmp.setup.window.completion.border` and `.scrollbar`
BREAKING CHANGE: `cmp.setup.documentation` has been moved to
`cmp.window.documentation`, as all of the pertaining
options were cosmetic.
TODO: document the change
* fix(window): attempt to get scrollbar's border
* fix(cmp): restore `view.menu.hl_group`
* fix(window): wrong scrollbar position
* ref: get default `CmpItemMenu` from border existence
* chore(cmp): remove old PR comments
* fix(window): scrollbar sometimes too big
* fix(window): docs far away with complete menu scrollbar
* perf(docs_view): reuse `border_width` value
* rev(cmp): restore `CmpItemMenu`
* ref(cmp): distinguish between `ScrollBar` and `ScrollThumb`
* fix(plugin): consistently refer to `Thumb` as `Thumb`
* rev(window): `Pmenu`-style scrollbar when no border
* fix(window): docs_view size wrong when first shown
* fix(window): docs_view scrollbar not responding to size
* fix(window): scrollbar sometimes to small, take 2
* fix(window): scrollbar bg not hiding
* ref(docs_view): put docs closer to completion menu
* fix(window): scrollbar position wrong with right border
* ref(config): add default border to documentation
* fix(window): scrollbar too close without border
* ref(plugin): link `CmpWindow` to `Pmenu`
I set `CmpWindow` to `NormalFloat`, because that is what you would
expect a floating window to use for a highlight group. However at
request I changed it to `Pmenu`.
* ref(plugin): link `CmpWindowBorder` to `CmpWindow`
* fix(window): scrollbar following thumb while scrolling
* ref: add more highlight groups
There just weren't enough highlight groups to satisfy the demands of the
project. If you change `CmpWindow` to `Pmenu`, then the `docs_view`
becomes `Pmenu` as well when on `main` it is `NormalFloat`.
* fix(window): scrollbar overlapping `docs_view` by default
* ref: remove `Bordered` highlight variants
* ref(utils): extract whitespace check to func
* feat: `window.completion.zindex` setting
* ref: `maxwidth|height` -> `max_`
* ref: simplify highlight groups
* feat: `window.*.winhighlight` setting
* ref(utils): `is_whitespace_char` -> `is_visible`
As hrsh7th noted, `''` is not a whitespace character. Yet, it is
necessary to group `''` and `' '` together for certain border behaviors
that are based on visibility. Thus I have renamed the function
* feat: specify `window.*.winhighlight` for un/bordered
* fix(custom_entries_view): set `winhighlight` on `open`
* ref: remove `Cmp*Scroll*` variants
There's no way for `window` to know which kind of window it is drawing a
scrollbar on. Simpler to just have one kind of scrollbar
* feat: distinguish between bordered and unbordered
* ref(cmp): `is_visible` -> `is_invisible`
That's what the function was checking for.
* fix(default): mislabeling of `default` and `bordered`
* chore: rebase fixup
* Change default highlight
* Add misc.rep
* Fix left-side docs_view with scrollbar
* Fix scrollbar
* Fix sbar/thumb win
Improve highlights
* Remove scrollbar cutomization for now
* Remove scrollbar option
* Simplify implementation
* Fix doc width
* Fix outdated docs
* Add comments
* Fix configuration schema
* fmt
* Fix for lint
Co-authored-by: Iron-E <36409591+Iron-E@users.noreply.github.com>
Co-authored-by: hrsh7th <>
2022-04-13 16:51:55 +02:00
### Where can I find more completion sources?
2021-10-30 11:42:37 +02:00
2022-06-09 09:41:59 +02:00
Have a look at the [Wiki ](https://github.com/hrsh7th/nvim-cmp/wiki/List-of-sources ) and the `nvim-cmp` [GitHub topic ](https://github.com/topics/nvim-cmp ).
2021-08-25 08:18:48 +02:00
2021-12-18 16:43:16 +01:00
dev (#813)
* feat: completion menu borders (#472)
* feat(custom_entries_view): pass custom border option
* feat(window): calculate offset needed for borders
* fix(window): adjust window height w/ too many results
* fix(window): center scrollbar with borders
* ref(custom_entries_view): use `FloatBorder` for borders
* fix(window): offset at bottom of window
* ref(window): move height adjustment to more logical place
* fix(window): improve popup placement
* fix(window): `border_offset` always `0` first time
* feat(window): support compact scrollbar with border
* fix(window): completion popup on cursorline
* perf(window): simplify offset calculation
String indexing will result in the same thing as if I gated it behind
`type()` calls here.
* docs(window): add `border` to `cmp.WindowStyle`
* docs(window): correct `border_offset_scrollbar`
* perf(window): calulated row -> `screenrow`
This will also be more accurate since it accounts for wrapped lines, as
well as buffers.
* fix(window): edge case with multiple splits
* ref(winhighlight): don't specify defaults by default
`NormalFloat:NormalFloat` isn't needed, since `NormalFloat` defaults to
`NormalFloat`. As for `FloatBorder`, that should be set to `Floatborder`
rather than `NormalFloat` or else you get unintended artifacts on the
edges of borders.
* fix(window): popup covers cursor when scrollbar disappears
* ref(window): calc `border_offset_col` on `set_style`
* perf(window): remove unecessary `col` calculation
Taking it out didn't change anything about the popup behavior.
* feat: add `CmpItemMenuThumb` group
* feat(window): improve scrollbar appearance
* chore(window): remove references to unused property
* docs: document new option `thin_scrollbar`
* ref(plugin): remove background from `thin_scrollbar`
* feat(view): pass `thin_scrollbar` option to window
* feat(window): gate new `thin_scrollbar` behind option
* fix(window): cmdline bugging out
* fix(cmp): docs_view pops up overlapped when using borders
This is related to 1cfe2f7dfdd877b54c0f4b0f9a15f525e7a3ea01. The
calculation for how the popup position is calculated was changed, and
so it needed to be reworked to include borders in order to be able to
work.
* ref: `thin_scrollbar` flag -> `scrollbar` option
This change allows users to define which character they will use for
their scrollbar.
* fix(window): use `scrollbar` setting for scrollbar character
Thanks @Astrantia for pointing this one out.
* docs(README): add completion appearance options to FAQ
* fix(): account for `border_offset_row` with `has_bottom_space`
* style(custom_entries_view): group offset with `row`/`col`
* fix(window): scrollbar at full view height
Because the `bar_height` variable must be whole number, and must be rounded up
from a percent, there is a change that we will end up with the maximum
height as a number.
For example, `info.height` = 24 and `total` = 25.
* feat(window): allow scrollbar to be disabled
* fix(window): scrollbar size < 1
* ref(cmp): move border logic to `window.info`
* ref!: window highlighting based on borders
BREAKING CHANGE: `documentation.winhighlight` does not determine the
highlighting of the `documentation` view— `CmpWindow`
or `CmpBorderedWindow` depending on whether it has a
border.
* ref!: float appearance opts -> `cmp.setup.window`
`cmp.setup.completion.border` and `.scrollbar` were both moved to
`cmp.setup.window.completion.border` and `.scrollbar`
BREAKING CHANGE: `cmp.setup.documentation` has been moved to
`cmp.window.documentation`, as all of the pertaining
options were cosmetic.
TODO: document the change
* fix(window): attempt to get scrollbar's border
* fix(cmp): restore `view.menu.hl_group`
* fix(window): wrong scrollbar position
* ref: get default `CmpItemMenu` from border existence
* chore(cmp): remove old PR comments
* fix(window): scrollbar sometimes too big
* fix(window): docs far away with complete menu scrollbar
* perf(docs_view): reuse `border_width` value
* rev(cmp): restore `CmpItemMenu`
* ref(cmp): distinguish between `ScrollBar` and `ScrollThumb`
* fix(plugin): consistently refer to `Thumb` as `Thumb`
* rev(window): `Pmenu`-style scrollbar when no border
* fix(window): docs_view size wrong when first shown
* fix(window): docs_view scrollbar not responding to size
* fix(window): scrollbar sometimes to small, take 2
* fix(window): scrollbar bg not hiding
* ref(docs_view): put docs closer to completion menu
* fix(window): scrollbar position wrong with right border
* ref(config): add default border to documentation
* fix(window): scrollbar too close without border
* ref(plugin): link `CmpWindow` to `Pmenu`
I set `CmpWindow` to `NormalFloat`, because that is what you would
expect a floating window to use for a highlight group. However at
request I changed it to `Pmenu`.
* ref(plugin): link `CmpWindowBorder` to `CmpWindow`
* fix(window): scrollbar following thumb while scrolling
* ref: add more highlight groups
There just weren't enough highlight groups to satisfy the demands of the
project. If you change `CmpWindow` to `Pmenu`, then the `docs_view`
becomes `Pmenu` as well when on `main` it is `NormalFloat`.
* fix(window): scrollbar overlapping `docs_view` by default
* ref: remove `Bordered` highlight variants
* ref(utils): extract whitespace check to func
* feat: `window.completion.zindex` setting
* ref: `maxwidth|height` -> `max_`
* ref: simplify highlight groups
* feat: `window.*.winhighlight` setting
* ref(utils): `is_whitespace_char` -> `is_visible`
As hrsh7th noted, `''` is not a whitespace character. Yet, it is
necessary to group `''` and `' '` together for certain border behaviors
that are based on visibility. Thus I have renamed the function
* feat: specify `window.*.winhighlight` for un/bordered
* fix(custom_entries_view): set `winhighlight` on `open`
* ref: remove `Cmp*Scroll*` variants
There's no way for `window` to know which kind of window it is drawing a
scrollbar on. Simpler to just have one kind of scrollbar
* feat: distinguish between bordered and unbordered
* ref(cmp): `is_visible` -> `is_invisible`
That's what the function was checking for.
* fix(default): mislabeling of `default` and `bordered`
* chore: rebase fixup
* Change default highlight
* Add misc.rep
* Fix left-side docs_view with scrollbar
* Fix scrollbar
* Fix sbar/thumb win
Improve highlights
* Remove scrollbar cutomization for now
* Remove scrollbar option
* Simplify implementation
* Fix doc width
* Fix outdated docs
* Add comments
* Fix configuration schema
* fmt
* Fix for lint
Co-authored-by: Iron-E <36409591+Iron-E@users.noreply.github.com>
Co-authored-by: hrsh7th <>
2022-04-13 16:51:55 +02:00
### Where can I find advanced configuration examples?
2021-08-03 18:07:12 +02:00
2022-06-09 09:41:59 +02:00
See the [Wiki ](https://github.com/hrsh7th/nvim-cmp/wiki ).