Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to combine completion.list.selection = "auto_insert" and "preselect" #668

Closed
SamuelBorn opened this issue Dec 20, 2024 · 3 comments
Closed
Labels
accept Applying a completion item to the buffer feature New feature or request windows Module which displays UI

Comments

@SamuelBorn
Copy link

Feature Description

Citation from default config:

-- 'preselect' will automatically select the first item in the completion list

-- 'auto_insert' will not select any item by default, and insert the completion items automatically when selecting them

I would like to the see another option that combines them both.
The documentation could be described as:

-- 'preselect_auto_insert' will automatically select the first item in the completion list, and insert the completion items automatically when selecting them

The default preselect action though should not trigger auto_insert as this would be annoying.

So to accept the first solution one still has to press the keyboard shortcut for accept or select_and_accept.

But after selecting with select_prev and select_next, auto_insert should trigger and accepting would no longer be necessary.

@SamuelBorn SamuelBorn added the feature New feature or request label Dec 20, 2024
@Saghen Saghen changed the title feat: option to combine completion.list.selection = "auto_insert" and "preselect" Option to combine completion.list.selection = "auto_insert" and "preselect" Dec 29, 2024
@Saghen Saghen added windows Module which displays UI accept Applying a completion item to the buffer labels Dec 29, 2024
@Saghen
Copy link
Owner

Saghen commented Dec 31, 2024

It should also support setting the insertion mode by keymap, as per #826, cmp.select_next({ selection = 'auto_insert' })

@SamuelBorn
Copy link
Author

Since this plugin is beta quality and users expect breaking changes I would like to suggest to make the suggested option the new default.

@Saghen Saghen closed this as completed in 8126d0e Jan 6, 2025
@drowning-cat
Copy link

drowning-cat commented Jan 7, 2025

@Saghen

I think cmp.select_next should not override text selected with cmp.select_next { auto_insert = true }.

recording.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accept Applying a completion item to the buffer feature New feature or request windows Module which displays UI
Projects
None yet
Development

No branches or pull requests

3 participants