Skip to content

Commit

Permalink
fix(nvim-cmp): disable nvim-cmp in Telescope prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
adoyle-h committed Sep 8, 2024
1 parent 356d105 commit a592de9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lua/one/plugins/completion/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ end

local function has_words_before()
local line, col = table.unpack(api.nvim_win_get_cursor(0))
return col ~= 0 and api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match('%s') ==
nil
return col ~= 0 and api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match('%s') == nil
end

local function configMapping(cmp, config)
Expand Down Expand Up @@ -227,6 +226,12 @@ function M.config(config)
end

cmp.setup {
-- https://github.com/hrsh7th/nvim-cmp/wiki/Advanced-techniques#disabling-completion-in-certain-contexts-such-as-comments
enabled = function()
local filetype = vim.api.nvim_buf_get_option(0, 'filetype')
if filetype == 'TelescopePrompt' then return false end
return true
end,
mapping = conf.mapping,
formatting = configFormating(conf),
sources = normalSources,
Expand Down

0 comments on commit a592de9

Please sign in to comment.