Skip to content

Turn off cmp when in Telescope buffer #102

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

Closed
pappasam opened this issue Oct 12, 2024 · 2 comments · Fixed by #104
Closed

Turn off cmp when in Telescope buffer #102

pappasam opened this issue Oct 12, 2024 · 2 comments · Fixed by #104

Comments

@pappasam
Copy link
Contributor

pappasam commented Oct 12, 2024

I think this is essentially the same issue that was raised in nvim-cmp a while ago: hrsh7th/nvim-cmp#60

When typing <C-p> and <C-n> (which, by default, are configured to scroll up and down the telescope window), the blink.cmp completion menu comes up. This is not desired behavior.

telescope-buffer

Environment

NVIM v0.11.0-dev-667+gd9ccd828b
Build type: RelWithDebInfo
LuaJIT 2.1.1724512491
Run "nvim -V1 -v" for more info

blink.cmp version: current HEAD (b330b61)

Telescope: current HEAD (df534c3)

@tkapous
Copy link

tkapous commented Oct 12, 2024

A dirty fix:

Here, add if vim.bo.buftype ~= nil and vim.bo.buftype ~= '' then return end.

@DaniBedz
Copy link

Same issue if you have mapped to accept - you won't be able to use to select a Telescope item.

scottmckendry added a commit that referenced this issue Oct 13, 2024
resolves #102

* disable blink.cmp remaps when telescope prompt is open

* make it a bit cleaner

* implemented iteration over exclude_filetypes table

* add `exclude_filetypes` config option to disable keymaps for specific filetypes

- Implemented `exclude_filetypes` as a config option with default values
(`TelescopePrompt`
- Improved performance by using a map for filetype lookups instead of
iterating over a list
- Keymaps are now disabled for buffers matching the excluded filetypes)

* add dynamic plugin disabling based on file type

- Implemented autocommand for BufEnter and InsertEnter events to disable
the plugin dynamically for specific file types.
- Added a global variable `vim.g.blinkcmp_enabled` to track whether the
plugin is enabled.
- Updated relevant parts of the plugin to return early if the plugin is
disabled for a file type.

* remove old unused code

* refactor: remove blinkcmp_enabled flag and directly utilize utils.is_special_buffer() for buffer handling

* refactor: remove extra calls to is_special_buffer where logic already exists

---------

Co-authored-by: Scott McKendry <[email protected]>
eero-lehtinen pushed a commit to eero-lehtinen/blink.cmp that referenced this issue Oct 13, 2024
resolves Saghen#102

* disable blink.cmp remaps when telescope prompt is open

* make it a bit cleaner

* implemented iteration over exclude_filetypes table

* add `exclude_filetypes` config option to disable keymaps for specific filetypes

- Implemented `exclude_filetypes` as a config option with default values
(`TelescopePrompt`
- Improved performance by using a map for filetype lookups instead of
iterating over a list
- Keymaps are now disabled for buffers matching the excluded filetypes)

* add dynamic plugin disabling based on file type

- Implemented autocommand for BufEnter and InsertEnter events to disable
the plugin dynamically for specific file types.
- Added a global variable `vim.g.blinkcmp_enabled` to track whether the
plugin is enabled.
- Updated relevant parts of the plugin to return early if the plugin is
disabled for a file type.

* remove old unused code

* refactor: remove blinkcmp_enabled flag and directly utilize utils.is_special_buffer() for buffer handling

* refactor: remove extra calls to is_special_buffer where logic already exists

---------

Co-authored-by: Scott McKendry <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants