roxma / nvim-completion-manager

:warning: PLEASE USE https://github.com/ncm2/ncm2 INSTEAD
MIT License
917 stars 49 forks source link

user defined ultisnips won't show up #174

Open casprwang opened 6 years ago

casprwang commented 6 years ago

Hi, I've been fixing this problem for a long time but never worked, it's really wired, everything else worked fine except user-defined snippet. I defined a snippet but NCM doesn't pop out the option snippet hint(only shows "Tmux" hint), and can't be expanded.

Plug 'roxma/nvim-completion-manager', {'do': 'npm install'} 
Plug 'SirVer/ultisnips'

" ncm config
set shortmess+=c
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
let g:UltiSnipsExpandTrigger = "<Plug>(ultisnips_expand)"
" css
" the omnifunc pattern is PCRE
let g:cm_matcher = {'module': 'cm_matchers.fuzzy_matcher', 'case': 'smartcase'}

let g:cm_refresh_default_min_word_len=2
inoremap <silent> <c-o> <c-r>=cm#sources#ultisnips#trigger_or_popup("\<Plug>(ultisnips_expand)")<cr>
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
" ncm end

" ultisnips config
function! g:UltiSnips_Complete()
  call UltiSnips#ExpandSnippet()
  if g:ulti_expand_res == 0
    if pumvisible()
      return "\<C-n>"
    else
      call UltiSnips#JumpForwards()
      if g:ulti_jump_forwards_res == 0
        return "\<TAB>"
      endif
    endif
  endif
  return ""
endfunction

au BufEnter * exec "inoremap <silent> " . g:UltiSnipsExpandTrigger . " <C-R>=g:UltiSnips_Complete()<cr>"
let g:UltiSnipsJumpForwardTrigger="<tab>"
inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
let g:UltiSnipsEditSplit = 'horizontal'
let g:UltiSnipsSnippetsDir="~/dotfiles/nvim/ultiSnips"
let g:UltiSnipsSnippetDirectories=["ultiSnips"]
" ultisnips end

2018-01-12 07 37 36

viniarck commented 6 years ago

@roxma I'm also facing the same issue as @wangsongiam, could you shed some light? Thanks!

viniarck commented 6 years ago

As a workaround though, if you have a "UltiSnips" folder under your runtime path nvim-completion-manager still finds the snippets. Nice!