1

Environment

  • Ubuntu 14.04
  • Vim 7
  • Tmux

I'm just trying to create some snippets for UltiSnips and writing bib files.

What I want

To create custom snippets that will make writing bib files (that I can't download) a bit more straightforward from Vim.

What I've tried

I have opened a .bib file, and then run :UltiSnipsEdit from within Vim. I created a new snip named online and copied the following into it:

@online{$1,
    author = {},
    title = {},
    year = ,
    url = {},
    urldate = {}
}

The snippet looks like this:

snippet online "Cite from website" 
@online{$1,
    author = {},
    title = {},
    year = ,
    url = {},
    urldate = {}
}
endsnippet

Then when I reopen [1] my .bib file and type online I don't get any prompt for this.

If I type @online{onli I will get the prompt appear that I created. However when I try to select this prompt using my assigned key command [2] nothing actually happens.

Some steps that don't work for me :

  • Open new file with vim h.bib

    :UltiSnipsEdit
    
  • Create the following snip :

    snippet mouse "Description"
    something something snippet
    endsnippet
    
  • Return to h.bib (thats still open from the split)

  • Enter insert mode
  • Type mous expecting prompt - no prompt
  • Type @x{mou -> prompt appears
  • Tab to the prompt (mouse) and then enter the command for completion (<leader>df or ,df) - this doesn't do anything.

What's going wrong

The first error (that nothing appears) seems to be related to bib files being in comment mode by default. I'm not sure whether UltiSnips can work inside comments?

I'm not sure why it's not autocompleting when the prompt does appear though.

Perhaps a vim function or something would be more appropriate, I've never written one.


Edit

I've tried using this outside of tmux (default terminal) and muting YouCompleteme, neither of which have helped.

Thanks


Footnotes

[1] I know this isn't meant to be needed, I just thought I'd try it anyway.

[2] the key that I have assigned for UltiSnips is

let g:UltiSnipsExpandTrigger="<Leader>df"

as YouCompleteMe is using the <tab>

  • I just tried replicating this, and it worked for me. I'm honestly not sure what the problem could be here. You might try a minimal vim configuration to see if that would work on your machine. You could then add customizations to potentially identify the conflict. I don't use YouCompleteMe, so maybe there's something going on there. Wish I could help more. – Aaron Massey Apr 1 '15 at 17:33
  • @aaron hmm... Maybe I'm not sure, I don't know why though. I'll have another look when I get home, if I comment out you complete me – baxx Apr 1 '15 at 17:54
  • On my phone so I've messed that up! I'll be back at my computer soon though and I'll go over it, thanks – baxx Apr 1 '15 at 17:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.