hrsh7th / cmp-cmdline

nvim-cmp source for vim's cmdline
MIT License
567 stars 45 forks source link

cmp-cmdline turns hlsearch off? #28

Closed ghost closed 2 years ago

ghost commented 2 years ago

when searching something in the buffer with / or ? hlsearch automatically gets turned off everytime cmp window is shown/updated so there is a flicker everytime you type something

https://user-images.githubusercontent.com/90397425/148587784-7decf47b-b5c6-4011-a443-811b381c097b.mp4

config :

if has('vim_starting')
    set encoding=utf-8
endif
scriptencoding utf-8

if &compatible
    set nocompatible
endif

let s:plug_dir = expand('/tmp/plugged/vim-plug')
if !filereadable(s:plug_dir .. '/plug.vim')
    execute printf('!curl -fLo %s/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim', s:plug_dir)
end

execute 'set runtimepath+=' . s:plug_dir
call plug#begin(s:plug_dir)
Plug 'hrsh7th/nvim-cmp'
Plug 'hrsh7th/cmp-buffer'
Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'hrsh7th/vim-vsnip'
Plug 'neovim/nvim-lspconfig'
Plug 'hrsh7th/cmp-cmdline'
call plug#end()
PlugInstall | quit

" Setup global configuration. More on configuration below.
lua << EOF
local cmp = require "cmp"
cmp.setup {
    snippet = {
        expand = function(args)
        vim.fn["vsnip#anonymous"](args.body)
    end,
    },

mapping = {
    ['<CR>'] = cmp.mapping.confirm({ select = true })
    },

sources = {
    { name = "nvim_lsp" },
    { name = "buffer" },
    },
}
require'cmp'.setup.cmdline(':', {
    sources = {
        { name = 'cmdline' }
    }
})
require'cmp'.setup.cmdline('/', {
    sources = {
        { name = 'buffer' }
    }
})

EOF

lua << EOF
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())

require'lspconfig'.cssls.setup {
    capabilities = capabilities,
    }
EOF
hrsh7th commented 2 years ago

Sorry. I can't fix this. https://github.com/hrsh7th/nvim-cmp/issues/485