Commit Graph

241 Commits

Author SHA1 Message Date
figsoda
714ccb7483 fix compatibility with nvim < 0.8 (#1227) 2022-10-12 00:35:19 +09:00
hrsh7th
53bd574901 Fix #1213 2022-10-11 11:44:23 +09:00
hrsh7th
203aa26fc2 Fix for cmdheight=0
Fixes #1196
Fixes hrsh7th/cmp-cmdline#64
2022-10-02 20:22:13 +09:00
yuys13
2427d06b65 Format by stylua (#1195) 2022-09-27 12:27:31 +09:00
hrsh7th
e1f31778a8 Optimize performance 2022-09-25 21:24:27 +09:00
Lewis Russell
6b3dbc8377 fix(timer): close timers before Neovim exits (#1166) 2022-09-02 11:29:13 +09:00
yuki yano
b5885696b1 Add incsearch_redraw_keys settings (#1162) 2022-08-31 12:42:43 +09:00
hrsh7th
7e67df513a Fix #1135 2022-08-20 20:42:43 +09:00
hrsh7th
49c4050e24 Refactor a bit 2022-08-20 19:23:05 +09:00
hrsh7th
76ba56ce96 Decrease waits 2022-07-24 13:14:01 +09:00
hrsh7th
bf5593df8e Improve typings 2022-07-24 12:44:53 +09:00
Jaehwang Jung
160405250e Reuse scratch buffer for keymap normalization (#991) 2022-05-15 18:44:21 +09:00
hrsh7th
0318a3cbc1 Improve the codes for sumneko friendly 2022-05-13 19:25:00 +09:00
zeertzjq
6527e5f31b fix: use scratch buffer and lhs for keymap.normalize() (#986)
Fix https://github.com/neovim/neovim/issues/18303

This can be slower, I don't know how frequently this function is called as I don't use this plugin.
2022-05-13 19:18:29 +09:00
hrsh7th
f81bfee109 Fix #964
Fix #963
Fix #966
2022-05-04 23:51:59 +09:00
hrsh7th
c6126cca36 Fix #962 2022-05-04 12:18:09 +09:00
hrsh7th
5054c14490 dev (#956)
* Adjust empty line count

* Implement vim.api.nvim_create_autocmd (#844)

* Implement vim.api.nvim_create_autocmd

* Only use vim.api.nvim_create_autocmd on nighly

* Cleanup

* cleanup

* Rename autos.lua to autocmds.lua

* Fix forgot to rename autos to autocmds

* Remove legacy autocmd

* Add descriptions on autocmds

* Update descriptions on autocmds

* Update CmpStatus command to lua API (#922)

Signed-off-by: Micah Halter <micah@balena.io>

* Move highlights to nvim_set_hl lua API (#925)

Signed-off-by: Micah Halter <micah@balena.io>

* Add default to highlight

* Refactor autocmds

* fmt

* Improve performance

* Fix bug

* Improve matching logic
Fixes https://github.com/hrsh7th/nvim-cmp/discussions/954

* Fix format

* Improve performance
Fix #825

* Fix cmdline redraw bug

* Fix event

Co-authored-by: hrsh7th <>
Co-authored-by: zer09 <zer09@users.noreply.github.com>
Co-authored-by: Micah Halter <micah@mehalter.com>
2022-05-04 01:47:01 +09:00
Jongwook Choi
f51dc68e1b fix: Fix stylua errors and install_stylua script (#923)
- Fix code style issues, suggested by stylua
- Update install_stylua.lua script so that it can run in macOS as well.
2022-04-20 13:21:37 +09:00
hrsh7th
77d88ba056 Revert #873 fixes for Fix #899 2022-04-14 16:26:14 +09:00
Jaehwang Jung
ec8e87ce5c Revert #886 and refactor (#900)
* Revert "make completion popup windows have bufhidden=wipe (#886)"

This reverts commit f573479528.

* Remove redundant nvim_buf_set_option

`buftype=nofile` and `bufhidden=hide` are already set by
`nvim_create_buf(false, true)`.
2022-04-14 14:38:52 +09:00
hrsh7th
7e07dd50ac Fix #893 2022-04-14 11:47:07 +09:00
hrsh7th
0c1f37c518 Fix mapping normalization order 2022-04-14 02:37:21 +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
Hubert Teo
f573479528 make completion popup windows have bufhidden=wipe (#886) 2022-04-13 23:01:25 +09:00
hrsh7th
801a9f98bb Improve macro handling 2022-04-08 22:04:08 +09:00
hrsh7th
7dbe34e36d Fix snr notation 2022-04-02 01:32:49 +09:00
hrsh7th
b3ca3fde06 Fix recursive mapping problem. Thank you tpope!
Fix #858
Fix #871
2022-04-02 00:32:19 +09:00
hrsh7th
dc3113a79f Add sort (required nvim-treesitter) 2022-03-30 20:41:32 +09:00
kevinhwang91
2dff6a8b60 fix(misc): kill redundant redraw during incsearch (#485) (#859) 2022-03-28 18:14:26 +09:00
hrsh7th
4f5cc6a9c8 Fix #801
Fix #615
Fix #798
2022-02-15 20:20:57 +09:00
hrsh7th
c07350181f Implement matching config.
Fix #796
2022-02-13 16:44:45 +09:00
hrsh7th
33fc65f174 test&lint&fmt 2022-02-13 14:38:31 +09:00
hrsh7th
070c5572ad Implement shell like common string completion.
Fix #785
2022-02-13 14:34:28 +09:00
hrsh7th
d6838996da improve 2022-01-31 17:04:38 +09:00
hrsh7th
0d23640fb6 Fix #757 2022-01-31 14:27:33 +09:00
hrsh7th
f4bb6ffdb1 Improve keymap (#768)
* Improve keymap

* improve

* rename

* Add tests

* Use nightly for testing

* Enable failing test

* Add manual test case
2022-01-31 14:16:48 +09:00
hrsh7th
d93104244c Wait for filtering completion 2022-01-25 16:27:21 +09:00
hrsh7th
f960d4829e Fix Ci 2022-01-25 10:12:09 +09:00
hrsh7th
2d67b6dd76 Fix #756 2022-01-25 10:06:36 +09:00
hrsh7th
27123b1297 Fix #754 2022-01-24 23:46:47 +09:00
hrsh7th
1797f9e1ac fmt&lint 2022-01-20 17:26:05 +09:00
hrsh7th
8fc8d31cf4 Support import completion 2022-01-18 19:32:51 +09:00
hrsh7th
682818b211 evacuate -> fallback 2022-01-18 19:14:38 +09:00
hrsh7th
4c0a6512a0 Fix cmdline mapping again 2022-01-17 19:43:38 +09:00
hrsh7th
cea9c2a0c9 fix cmdline mapping 2022-01-17 19:28:16 +09:00
hrsh7th
c23d810a66 Fix #746 2022-01-17 19:20:09 +09:00
hrsh7th
a54064d940 Add comments 2022-01-16 01:00:53 +09:00
hrsh7th
49d94e0ef3 Fix keymap.t timing 2022-01-16 00:53:03 +09:00
hrsh7th
703e915b7f Improve keymapping handling 2022-01-16 00:37:28 +09:00
hrsh7th
243d5f4a12 Fix expression resolving timing 2022-01-15 22:56:01 +09:00