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

TODO: integrate with ultisnips for completions with snippet #36

Closed
roxma opened this issue Mar 4, 2017 · 8 comments
Closed

TODO: integrate with ultisnips for completions with snippet #36

roxma opened this issue Mar 4, 2017 · 8 comments

Comments

@roxma
Copy link
Owner

roxma commented Mar 4, 2017

For example:

def foobar(param1,param2)
  pass

foobar|

| is the cursor position after foobar is completed by NCM, then press ultisnips expand trigger should expand the completion into

def foobar(param1,param2)
  pass

foobar(|<param1>,<param2>)

I'm not sure whether this is possible but it's worth a try

roxma added a commit that referenced this issue Mar 7, 2017
@roxma
Copy link
Owner Author

roxma commented Mar 7, 2017

Ultisnips is kind of heavy and complicated for me.

So I started looking into neosnippet by @Shougo. It's more lightweight and easier to integrate, since it has been integrated in neocomplete already. Although I don't enjoy the display of '<2:foo:>' placeholder. It's simple, and it works well.

Requirement: installation of neosnippet and let g:neosnippet#enable_completed_snippet=1
Here's a screencast for python completion and expansion:

A + sign means the completion item is expandable.

soutput

This feature is still experimental.

Besides, the syntax of neosnippet by @Shougo and snipmate maintained by @garbas seems to be compatible at some level.

I'll look into snipmate as another alternative when I have some free time available.

@roxma
Copy link
Owner Author

roxma commented Mar 8, 2017

Just take a deeper look into ultisnips, now it works with ultisnips, 😄

output

@roxma
Copy link
Owner Author

roxma commented Mar 9, 2017

Closing this, snipmate support may be implemented in the future. But this is not high priority.

@roxma roxma closed this as completed Mar 9, 2017
@roxma
Copy link
Owner Author

roxma commented Mar 12, 2017

snipmate is supported now

output

config:

    let g:snips_no_mappings = 1 
    " imap <expr> <c-u> pumvisible() ? "\<c-y>\<Plug>snipMateTrigger" : "\<Plug>snipMateTrigger"
    " wrap the mapping
    imap <expr> <Plug>(snipmate_force_trigger) pumvisible() ? "\<c-y>\<Plug>snipMateTrigger" : "\<Plug>snipMateTrigger"
    " show a list of snippets when no the user has typed nothing
    inoremap <silent> <c-u> <c-r>=cm#sources#snipmate#trigger_or_popup("\<Plug>(snipmate_force_trigger)")<cr>
    vmap <c-u> <Plug>snipMateTrigger
    imap <expr> <c-j> pumvisible() ? "\<c-y>\<Plug>snipMateNextOrTrigger" : "\<Plug>snipMateNextOrTrigger"
    vmap <c-j> <Plug>snipMateNextOrTrigger
    imap <expr> <c-k> pumvisible() ? "\<c-y>\<Plug>snipMateBack" : "\<Plug>snipMateBack"
    vmap <c-k> <Plug>snipMateBack

// cc @ajzafar @garbas

@Battleroid
Copy link

Does anything special need to be done in order to get snippets provided by Ultisnips to expand?

@roxma
Copy link
Owner Author

roxma commented Aug 20, 2017

@Battleroid

No. This issue is about parameter expansion.

@roxma
Copy link
Owner Author

roxma commented Aug 20, 2017

@Battleroid
I’m not sure what you need. But this might be useful.
#89

@Battleroid
Copy link

Thank you, I'll poke at it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants