Commit Graph

129 Commits

Author SHA1 Message Date
hrsh7th
2aa7eee28b Improve README.md 2022-04-18 23:50:46 +09:00
Stéphane Bisinger
b5433f901e docs!: improve the instructions to follow breaking changes (#231) (#904)
Improve the README instruction on where to find breaking changes.
Included a suggestion to subscribe to the
[github issue](https://github.com/hrsh7th/nvim-cmp/issues/231) to
get notified about changes.
2022-04-14 20:42:08 +09:00
hrsh7th
93cf84f7de Remove all default mappings 2022-04-14 00:10:33 +09:00
hrsh7th
fae808a2bc 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 1cfe2f7dfd. 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 23:51:55 +09:00
Jonas Strittmatter
272cbdca3e Update readme: add a link to a list of cmp sources (#853) 2022-03-22 12:05:54 +09:00
hrsh7th
26a9184c88 Add filetype config
Use view.entries == 'native' instead of experimental.native_menu
2022-02-11 15:20:24 +09:00
hrsh7th
b11f8bbee3 Improve README.md 2021-12-19 00:43:16 +09:00
Kai Howelmeyer
af07ff9b79 docs: clarify behavior of select in confirm mapping (#621)
Relates to #557
2021-12-07 18:01:36 +09:00
Jonas Strittmatter
fab968f735 Readme: improve readability of lua code block in setup section (#622) 2021-12-07 18:01:08 +09:00
hrsh7th
593a6345de Implement kind highlights (#584)
* Implement kind highlights

* Fix link
2021-11-27 19:20:44 +09:00
hrsh7th
bf3b2d45b1 Fix README.md 2021-11-27 16:45:06 +09:00
hrsh7th
1944b46336 Allow to take the full SourceConfig from source API (#561)
* - SourceConfig.opts -> SourceConfig.option
- Add SourceConfig.trigger_characters
- Allow accessing full SourceConfig from source

* fmt&lint
2021-11-23 21:17:03 +09:00
RaZ0rr-Two
f2e7685c21 Add some wiki info in README (#549) 2021-11-18 17:35:45 +09:00
Hexin
27d4c21e8f Fix document about scrolling docs backwards (#538) 2021-11-18 01:47:52 +09:00
Lukas Reineke
17d57f96cc Add reason to complete function (#529)
fix #528
2021-11-17 01:17:58 +09:00
feathecutie
f0f0065f85 Fixed typo in README.md (#515) 2021-11-13 17:09:20 +09:00
G.A. Jazali
af06bd4b44 Link to menu appearance page in wiki (#493)
* Updated info in README.md

Added instruction for icons and source without extra plugin.

* Replace snippet with link to wiki
2021-11-11 19:33:25 +09:00
chmnchiang
3b4d3ceab1 Fix and improve README.md (#462)
Fix some typos and errors in `README.md`.
2021-11-02 17:43:46 +09:00
hrsh7th
bf0dd907d6 Fix #458 2021-11-02 12:24:11 +09:00
Bradley Mackey
437074a303 README: clarify that a snippet plugin is required (#439)
* README: clarify that a snippet plugin is required

* README: add to FAQ about snippet

* README: use snippet 'engine' nomenclature

* README: fix typo
2021-10-30 18:42:37 +09:00
hrsh7th
3945dc5d00 Add basic recently_used comparator 2021-10-29 18:46:51 +09:00
hrsh7th
1c498a5497 Add cmp.event:on() (#418) 2021-10-28 11:02:19 +09:00
hrsh7th
455817bb26 Update README.md 2021-10-27 13:34:49 +09:00
hrsh7th
cae2e8f48b RFC: cmdline completion (#362)
* manual support dot-repeat

* cmdwin and terminal

* cmdline only

* Fix

* fix

* Improve

* Fix test

* Support macro

* disable cmdline for now

* Simplify

* fmt

* consume once

* Ignore = type

* cmdline

* fmt

* Improve

* update

* fmt

* Support incsearch

* fix

* Add api

* Avoid cmdline completion if the native_menu enabled

* fix for macro

* Improve

* fmt

* Insert-mode only by default

* Update

* avoid conflict

* Improve default mapping

* Fix

* fix

* similar to native

* Update

* Fix README.md

* Improve

* Use <afile>
2021-10-27 12:38:46 +09:00
hrsh7th
f1da3adddc Add cmp.config.disable for opt-out default setting 2021-10-25 22:50:38 +09:00
hrsh7th
b185e303bd Improve group handling 2021-10-23 00:38:55 +09:00
hrsh7th
533f17c569 group -> group_index 2021-10-22 19:52:48 +09:00
hrsh7th
8a10870cbe Update README.md 2021-10-22 18:38:51 +09:00
SebastienWae
d26148f417 clarify setup.buffer (#392)
Clarify the fact that setup.buffer overwrite the global sources.

related to hrsh7th/nvim-cmp/issues#390
2021-10-22 18:30:09 +09:00
hrsh7th
452ce16246 Add cmp.selected_entry/cmp.get_active_entry 2021-10-22 18:25:24 +09:00
hrsh7th
e4a2cec153 Implement source group.
Fixes #391
2021-10-22 18:24:03 +09:00
hrsh7th
26e73f3140 Fix #372 2021-10-19 14:55:14 +09:00
hrsh7th
49acc84853 Add item fields order
Fixes #337
2021-10-12 20:50:05 +09:00
Xuyuan Pang
2a8dc6208a Added option to set zindex of documentation window (#335) 2021-10-12 13:33:46 +09:00
hrsh7th
7a36a31331 No requires lazyredraw 2021-10-12 11:11:08 +09:00
hrsh7th
30ed4e43a6 Use <C-g> correctly 2021-10-12 01:53:27 +09:00
hrsh7th
071c08fcc9 Update README.md 2021-10-11 12:15:49 +09:00
hrsh7th
b61d78dc34 Update README.md 2021-10-11 12:15:16 +09:00
stvhuang
b9b5296f61 Fix typos in README.md (#319) 2021-10-10 18:45:09 +09:00
hrsh7th
5a2b5ded2f Advertise 2021-10-10 15:11:54 +09:00
hrsh7th
babb8023c6 Add cmp.visible 2021-10-10 12:13:57 +09:00
Hennadii Chernyshchyk
2bf240502c Remove experimental.cusom_menu (#311)
If I understood correctly, now we only have the `experimental.native_menu`, which is disabled by default (e.g, the custom menu is used by default).

Also do we need to set `completeopt`? If no, we could remove `How to set up like nvim-compe's preselect = 'always'` section
2021-10-10 00:10:59 +09:00
hrsh7th
ada9ddeff7 Use floating window for completion menus (#224)
* WIP

* WIP

* Fix #226

* Insert text

* Emulate vim native

* テキトウ

* Tekito

* Move scrollbar impl

* aaa

* Ignore unexpected event

* fix

* fix scroll

* Refactor (conflict...)

* Fix bug

* Positive integer

* Refactor a bit

* Fix for pumheight=0

* fx

* Improve matching highlight

* Improve colorscheme handling

* fmt

* Add cmp.visible

* Fix pum pos

* ABBR_MARGIN

* Fix cel calculation

* up

* refactor

* fix

* a

* a

* compat

* Remove current completion state

* Fix ghost text

* Add feature toggle

* highlight customization

* Update

* Add breaking change announcement

* Add README.md

* Remove unused function

* extmark ephemeral ghost text

* Support native comp

* Fix docs  pos

* a

* Remove if native menu visible

* theme async

* Improvement idea: option to disables insert on select item (#240)

* use ghost text instead of insertion on prev/next item

* add disables_insert_on_selection option

* move disable_insert_on_select option as argumet on

* update README

* use an enum behavior to disable insert on select

* Adopt contribution

* Preselect

* Improve

* Change configuration option

* a

* Improve

* Improve

* Implement proper <C-e> behavior to native/custom

* Support <C-c> maybe

* Improve docs view

* Improve

* Avoid syntax leak

* TODO: refactor

* Fix

* Revert win pos

* fmt

* ghost text remaining

* Don't use italic by default

* bottom

* dedup by label

* Ignore events

* up

* Hacky native view partial support

* up

* perf

* improve

* more cache

* fmt

* Fix format option

* fmt

* recheck

* Fix

* Improve

* Improve

* compat

* implement redraw

* improve

* up

* fmt/lint

* immediate ghost text

* source timeout

* up

* Support multibyte

* disable highlight

* up

* improve

* fmt

* fmt

* fix

* fix

* up

* up

* Use screenpos

* Add undojoin check

* Fix height

* matcher bug

* Fix dot-repeat

* Remove undojoin

* macro

* Support dot-repeat

* MacroSafe

* Default item count is 200

* fmt

Co-authored-by: Eric Puentes <eric.puentes@mercadolibre.com.co>
2021-10-08 18:27:33 +09:00
Andrey Kuznetsov
a39f72a463 document new lspkind integration with nvim-cmp (#275) 2021-10-06 22:10:58 +09:00
hrsh7th
7c97261b82 Add cmp#ready autocmd 2021-09-23 22:58:36 +09:00
Theory_of_Everything
7e2f77013b FIx: Typo (#229) 2021-09-21 15:23:16 +09:00
Theory_of_Everything
0b45cee3a8 Fix: bad function usage in README for UltiSnips (#228)
This commit fixes an issue with using vsnip#anonymous in the snippet expand function for Ultisnip
The main issue, is that when using vsnip#anonymous instead of UltiSnip#Anon when calling the cmp.mapping.confirm map on a non-snippet option would "crash" cmp, ceasing its normal functionality. Using UltiSnps#Anon fixes this issue.
2021-09-21 14:38:11 +09:00
Le Tien Chien
329f0b784d fix: README typo (#215)
Co-authored-by: chien.le <chien.le@shopee.com>
2021-09-17 22:57:54 +09:00
hrsh7th
a2545692ef README.md simpilification 2021-09-17 18:49:56 +09:00
hrsh7th
b47a703a48 RFC: CmpStatus command (#210)
* Add `CmpStatus` command

* Update headings

* Fix heading

* Update headings

* Add README.md

* Fix tests

* Force invoke InsertEnter
2021-09-17 13:29:28 +09:00