completion-nvim icon indicating copy to clipboard operation
completion-nvim copied to clipboard

How can I get completion items , path ,lsp ,snippet and buffers work togather?

Open krisfans opened this issue 4 years ago • 0 comments

Describe the solution you'd like I want to get completion items , path ,lsp ,snippet and buffers work togather, but I don't know how to config.

if I configure completion-nvim like below , I can only get the fisrt two completion items --lsp and snippet.

" Use completion-nvim in every buffer
autocmd BufEnter * lua require'completion'.on_attach()
set completeopt=menuone,noinsert,noselect " Set completeopt to have a better completion experience
set shortmess+=c " Avoid showing message extra message when using completion
" Use <Tab> and <S-Tab> to navigate through popup menu
inoremap <expr> <Tab>   pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
" Or you want to use <Tab> as trigger keys
imap <tab> <Plug>(completion_smart_tab)
imap <s-tab> <Plug>(completion_smart_s_tab)
let g:completion_matching_strategy_list = ['exact', 'substring', 'fuzzy']
" ['exact', 'substring', 'fuzzy', 'all']
let g:completion_matching_smart_case = 1
let g:completion_trigger_keyword_length = 2
let g:completion_enable_snippet = 'Neosnippet'
let g:completion_auto_change_source = 1
let g:completion_chain_complete_list = {
    \ 'default' : {
    \   'default': [
    \       {'complete_items': ['lsp']},
    \       {'complete_items': ['snippet']},
    \       {'complete_items': ['path'], 'triggered_only': ['/']},
    \       {'complete_items': ['buffers']}]
    \   }
    \}

and if I configure like this , I can get all the completion items ,but I can't set 'triggered_only': ['/']

" Use completion-nvim in every buffer
autocmd BufEnter * lua require'completion'.on_attach()
set completeopt=menuone,noinsert,noselect " Set completeopt to have a better completion experience
set shortmess+=c " Avoid showing message extra message when using completion
" Use <Tab> and <S-Tab> to navigate through popup menu
inoremap <expr> <Tab>   pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
" Or you want to use <Tab> as trigger keys
imap <tab> <Plug>(completion_smart_tab)
imap <s-tab> <Plug>(completion_smart_s_tab)
let g:completion_matching_strategy_list = ['exact', 'substring', 'fuzzy']
" ['exact', 'substring', 'fuzzy', 'all']
let g:completion_matching_smart_case = 1
let g:completion_trigger_keyword_length = 2
let g:completion_enable_snippet = 'Neosnippet'
let g:completion_auto_change_source = 1
let g:completion_chain_complete_list = {
             \'default' :[
            \   {'complete_items': ['lsp', 'snippet', 'buffers','path']},
            \]
             \}

krisfans avatar Feb 25 '21 08:02 krisfans