Skip to content
This repository has been archived by the owner on Jul 27, 2018. It is now read-only.

Selecting snippets fails #196

Closed
hliebert opened this issue Feb 15, 2018 · 16 comments
Closed

Selecting snippets fails #196

hliebert opened this issue Feb 15, 2018 · 16 comments

Comments

@hliebert
Copy link

I've been getting the following error for about a week when selecting a snippet, both in Latex and R. I'm using UltiSnips together with nvim-completion-manager in Vim 8 on Linux.

The culprit seems to be let g:UltiSnipsExpandTrigger = "<Plug>(ultisnips_expand)"

@xrayw
Copy link

xrayw commented Feb 19, 2018

+1

@kodemeister
Copy link

Same for me. The errors started appearing after upgrading from Vim 8.0.1436 to 8.0.1476. Seems like v:completed_item variable is now fully read-only. This works in Neovim 0.2.2 but not in the latest Vim:

let v:completed_item.snippet = "foo"

@Shougo
Copy link

Shougo commented Feb 25, 2018

nvim-completion-manager should use user_data feature instead.

@JR4er
Copy link

JR4er commented Mar 1, 2018

The ugly fix in PR #200 works for me with vim + ultisnips. Neosnippets and Snipmates are not tested.

@qazip
Copy link

qazip commented Mar 4, 2018

I'm having this issue as well. Is this going to be fixed anytime soon? It's a deal breaker!

@qazip
Copy link

qazip commented Mar 6, 2018

@roxma, are you going to accept JR4er PR?

@JR4er
Copy link

JR4er commented Mar 7, 2018

@qazip you can use my fork JR4er/nvim-completion-manager as a temporary solution until a better fix is provided or the PR is accepted. (my fork will be removed then)

@qazip
Copy link

qazip commented Mar 7, 2018

@JR4er , sadly your fork doesn't seem to work with vim-Plug. I'll have to find another way to install it. thanks!

@JR4er
Copy link

JR4er commented Mar 7, 2018

@qazip I use vim-Plug too. Plug 'JR4er/nvim-completion-manager' works for me.

@qazip
Copy link

qazip commented Mar 7, 2018

@JR4er, I was missing PlugClean, my bad. Though there seems to be an error now, when opening gvim: http://i.imgur.com/yocvqfC.png

Probably due to using vim-hug-neovim-rpc?

@JR4er
Copy link

JR4er commented Mar 7, 2018

@qazip likely. You still need to install roxma/vim-hug-neovim-rpc and use pip to install neovim python-client, see the Installation section in README.md

@qazip
Copy link

qazip commented Mar 10, 2018

@JR4er, I did install that. It works fine in vim, in GVim it gives the error I showed you.

@ikalnytskyi
Copy link

😢

@chemzqm
Copy link

chemzqm commented Mar 24, 2018

Actually you can just not rely NCM to do the snip complete for you, for exmaple, I have these code in my .vimrc:

" improved ultisnip complete {{
inoremap <C-l> <C-R>=SnipComplete()<CR>
func! SnipComplete()
  let line = getline('.')
  let start = col('.') - 1
  while start > 0 && line[start - 1] =~# '\k'
    let start -= 1
  endwhile
  let suggestions = []
  let snips =  UltiSnips#SnippetsInCurrentScope(0)
  for item in snips
    let trigger = item.key
    let entry = {'word': item.key, 'menu': item.description}
    call add(suggestions, entry)
  endfor
  if empty(suggestions)
    echohl Error | echon 'no match' | echohl None
  elseif len(suggestions) == 1
    let pos = getcurpos()
    if start == 0
      let str = trigger
    else
      let str = line[0:start - 1] . trigger
    endif
    call setline('.', str)
    let pos[2] = len(str) + 1
    call setpos('.', pos)
    call UltiSnips#ExpandSnippet()
  else
    call complete(start + 1, suggestions)
  endif
  return ''
endfunc
" }}

@ikalnytskyi
Copy link

And I can just don't use NCM as well, but that's not an option. :) I don't want to maintain hacks and workarounds, and it's pity that @roxma don't have enough time to work on this.

@roxma
Copy link
Owner

roxma commented Jul 2, 2018

ncm2 fixes this issue. use ncm2 instead http://github.com/ncm2/ncm2

@roxma roxma closed this as completed Jul 2, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants